Hey Spigot, It is time for me to make a "help post". I'm stuck with this weird problem. First of all, I need friendlyfire set to not allowed. If I use team.setAllowFriendlyFire(false); it won't work. So I tested out a different way, with a EntityDamageByEntityEvent. I test when a player is in the same team and then cancel it. But it doesn't work. WHY ? Code: Code (Text): package svenna.vw.events; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import svenna.vw.TeamManager; public class EventEntityDamageByEntityEvent implements Listener { @EventHandler public void onDamage(EntityDamageByEntityEvent e){ Entity damaged = e.getEntity(); Entity damager = e.getDamager(); System.out.println("EVENT FIRED"); if (damaged instanceof Player && damager instanceof Player){ Player pdamaged = (Player) damaged; Player pdamager = (Player) damager; System.out.println("EVENT FIRED"); if (TeamManager.red.hasPlayer(pdamager)){ if (TeamManager.red.hasPlayer(pdamaged)){ e.setCancelled(true); System.out.println("Zelfde team RED"); } } if (TeamManager.blue.hasPlayer(pdamager)){ if (TeamManager.blue.hasPlayer(pdamaged)){ e.setCancelled(true); System.out.println("Zelfde team BLUE"); } } } } }
If the "EVENT FIRED" does not appear you have not registered the Listener. Else, your .hasPlayer method is wrong
Registered your events? Are you using multiple classes? If so, don't forget to implement the applicable thing e.g. CommandExecutor or Listener
Im pretty sure i did.. I'm ganna figure this out. If I have a solution I'll post it here. Otherways I will still ask for help