From ff1d29bd2e631fc6992672153dad4b8abaf9a558 Mon Sep 17 00:00:00 2001 From: xGamingDudex Date: Fri, 21 Oct 2016 01:37:14 +0200 Subject: [PATCH] Apply wool bomb damage to self in team games --- .../game/arcade/kit/perks/PerkWoolBomb.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java index 27efa4a4c..73c7df885 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWoolBomb.java @@ -15,6 +15,7 @@ import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; @@ -43,6 +44,7 @@ import mineplex.core.recharge.RechargedEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; + import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.data.WoolBombData; @@ -288,6 +290,32 @@ public class PerkWoolBomb extends Perk implements IThrown 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 public void Collide(LivingEntity target, Block block, ProjectileUser data)