How can i make that Teams can't hit each other?

Discussion in 'Spigot Plugin Development' started by LarexCode, Jun 4, 2017.

  1. Hey guy, i want to make a 'Team' Plugin. With /team <Name> you can Team with a Person. That person you can't hit. But how do i do that they can't hit each other?

    BTW Sorry for my Bad english :D
     
  2. Create a hashmap storing team as a key, and user uuid, on damage events, if damager and damaged are on same team, cancel.
     
    • Agree Agree x 1
  3. when you are creating teams, you are able to perform the method #team.setallowfriendlyfire(false);
    Now the members of the team cant hit each other. If I understood right, this is what you need.
    then you just have to add the players to the team. for each team in game you have to add a new team. and there you go!
    Hope this helped you!;)
     
  4. If I recall... /scoreboard team create teamone
    /scoreboard team join teamone player
    /scoreboard team option friendlyfire false
    Something like that. I haven't played with that for a while, so be sure to fact check it. It's 100% vanilla.