From aff5396384476287b0f44d3b1a83a5667b08ace7 Mon Sep 17 00:00:00 2001 From: Thanos Paravantis Date: Fri, 29 Apr 2016 13:41:16 +0300 Subject: [PATCH] Prevent death effect armor stand modification --- .../game/games/mineware/BawkBawkBattles.java | 17 ++++++++--------- .../games/mineware/effect/DeathEffectData.java | 5 +++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java index f6c63c001..ea99846a4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/BawkBawkBattles.java @@ -32,9 +32,9 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerArmorStandManipulateEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -1422,17 +1422,16 @@ public class BawkBawkBattles extends TeamGame implements IThrown } @EventHandler - public void blockDeathEffectHeadInteract(PlayerInteractEntityEvent event) + public void blockDeathEffectHeadModification(PlayerArmorStandManipulateEvent event) { - if (event.getRightClicked().getType() == EntityType.ARMOR_STAND) + ArmorStand armorStand = event.getRightClicked(); + + for (DeathEffectData data : _deathEffect.getData()) { - for (DeathEffectData data : _deathEffect.getData()) + if (data.isChickenHead(armorStand)) { - if (data.getChickenHead().equals(event.getRightClicked())) - { - event.setCancelled(true); - return; - } + event.setCancelled(true); + break; } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/DeathEffectData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/DeathEffectData.java index 63de8d826..6515caf94 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/DeathEffectData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/effect/DeathEffectData.java @@ -25,6 +25,11 @@ public class DeathEffectData _player = player; _death = death; } + + public boolean isChickenHead(ArmorStand armorStand) + { + return _chickenHead.equals(armorStand); + } public void addFoodItems(ArrayList foodItems) {