diff --git a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/ItemStats.java b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/ItemStats.java index c1f624be..85776049 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/ItemStats.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/ItemStats.java @@ -51,6 +51,7 @@ public class ItemStats { DISABLE_REPAIRING = new DisableStat("REPAIRING", Material.ANVIL, "Disable Repairing", new String[]{"!block", "all"}, "Players can't use this item in anvils."), DISABLE_ARROW_SHOOTING = new DisableStat("ARROW_SHOOTING", Material.ARROW, "Disable Arrow Shooting", new Material[]{Material.ARROW}, "Players can't shoot this", "item using a bow."), DISABLE_ATTACK_PASSIVE = new DisableStat("ATTACK_PASSIVE", Material.BARRIER, "Disable Attack Passive", new String[]{"piercing", "slashing", "blunt"}, "Disables the blunt/slashing/piercing", "passive effects on attacks."), + DISABLE_DROP = new DisableStat("DROPING", Material.LAVA_BUCKET, "Disable Item Dropping", new String[]{"all"}, "Disables the dropping of this item!"), // RPG Stats REQUIRED_LEVEL = new RequiredLevel(), diff --git a/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/DisableInteractions.java b/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/DisableInteractions.java index bf73c4d4..4f70dd35 100644 --- a/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/DisableInteractions.java +++ b/MMOItems-Dist/src/main/java/net/Indyuce/mmoitems/listener/DisableInteractions.java @@ -22,6 +22,7 @@ import org.bukkit.event.inventory.FurnaceSmeltEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType.SlotType; +import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; @@ -31,6 +32,15 @@ import org.bukkit.inventory.ItemStack; public class DisableInteractions implements Listener { + @EventHandler(ignoreCancelled = true) + public void itemDropping(PlayerDropItemEvent event){ + ItemStack itemStack = event.getItemDrop().getItemStack(); + + if (isDisabled(NBTItem.get(itemStack),"drop")){ + event.setCancelled(true); + } + + } @EventHandler public void anvilInteractions(InventoryClickEvent event) { Inventory inv = event.getClickedInventory();