Apply wool bomb damage to self in team games

This commit is contained in:
xGamingDudex 2016-10-21 01:37:14 +02:00
parent 70d554fa2d
commit ff1d29bd2e

View File

@ -15,6 +15,7 @@ import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
@ -43,6 +44,7 @@ import mineplex.core.recharge.RechargedEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.data.WoolBombData; import nautilus.game.arcade.kit.perks.data.WoolBombData;
@ -288,6 +290,32 @@ public class PerkWoolBomb extends Perk implements IThrown
return true; return true;
} }
@EventHandler(priority = EventPriority.HIGH)
public void onDamageSelf(CustomDamageEvent event)
{
if(event.GetDamageePlayer() == null || event.GetDamagerPlayer(true) == null)
{
return;
}
if(!event.GetDamageePlayer().equals(event.GetDamagerPlayer(true)))
{
return;
}
if(event.GetCause() != DamageCause.CUSTOM)
{
return;
}
if(!event.IsCancelled())
{
return;
}
event.GetCancellers().remove("Team Damage");
}
@Override @Override
public void Collide(LivingEntity target, Block block, ProjectileUser data) public void Collide(LivingEntity target, Block block, ProjectileUser data)