Stop player's dropping leather armour

This commit is contained in:
Sam 2017-12-12 01:47:01 +00:00 committed by Alexander Meech
parent 0714399dcf
commit 6362033b9e

View File

@ -16,6 +16,7 @@ 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.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
@ -28,6 +29,7 @@ import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -405,6 +407,22 @@ public class CakeTeamModule extends CakeModule
.build();
}
@EventHandler
public void playerDropItem(PlayerDropItemEvent event)
{
if (!_game.IsLive())
{
return;
}
ItemStack itemStack = event.getItemDrop().getItemStack();
if (UtilItem.isLeatherProduct(itemStack))
{
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void playerQuit(PlayerQuitEvent event)
{