Prevent death effect armor stand modification

This commit is contained in:
Thanos Paravantis 2016-04-29 13:41:16 +03:00
parent 8874b52b39
commit aff5396384
2 changed files with 13 additions and 9 deletions

View File

@ -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;
}
}
}

View File

@ -25,6 +25,11 @@ public class DeathEffectData
_player = player;
_death = death;
}
public boolean isChickenHead(ArmorStand armorStand)
{
return _chickenHead.equals(armorStand);
}
public void addFoodItems(ArrayList<Item> foodItems)
{