Hi everyone, I'm doing a McMMO plugin, but in spades ability, the same faction player can advance levels of swords by beating a member of the same faction, how do I block this using FactionPro functions? I used this: Code: Swords.php PHP: public function onDamage(EntityDamageEvent $ev){ if(!$ev instanceof EntityDamageByEntityEvent){ return; } if($ev instanceof EntityDamageByEntityEvent){ if($ev->getDamager() instanceof Player){ if($ev->isCancelled()){ return; } $entity = $ev->getEntity()->getName(); $player = $ev->getDamager()->getName(); $faction = $this->pl->getServer()->getPluginManager()->getPlugin("FactionsPro"); if($faction->getPlayerFaction($entity) == $faction->getPlayerFaction($player)){ $this->pl->getServer()->getLogger()->info("CONDITION TEST. The two players are from the same faction"); return; } } } } but nothing happens... Not even a mistake...
Try with this inside your if() PHP: $faction->sameFaction($entity, $player); Also lines 3, 4 and 5 don't make sense if you're going to check the same thing below.
Tip: you no longer need to check $event instanceof EntityDamageByEntityEvent. You could directly put EntityDamageByEntityEvent in the parameter type. (This has actually been fixed for ages)