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 e34eaf79..e084e2c4 100644 --- a/MMOItems-API/src/main/java/net/Indyuce/mmoitems/ItemStats.java +++ b/MMOItems-API/src/main/java/net/Indyuce/mmoitems/ItemStats.java @@ -50,8 +50,9 @@ public class ItemStats { DISABLE_ENCHANTING = new DisableStat("ENCHANTING", VersionMaterial.ENCHANTING_TABLE.toMaterial(), "Disable Enchanting", new String[]{"!block", "all"}, "Players can't enchant this item."), 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!"), DISABLE_ARROW_CONSUMPTION = new DisableStat("ARROW_CONSUMPTION", Material.ARROW, "Disable Arrow Consumption", new String[]{"crossbow"}, "Disable arrow requirement and consumption."), - DISABLE_ATTACK_PASSIVE = new DisableStat("ATTACK_PASSIVE", Material.BARRIER, "Disable Attack Passive", new String[]{"piercing", "slashing", "blunt"}, "Disable blunt/slashing/piercing", "passive attack effects."), // RPG Stats REQUIRED_LEVEL = new RequiredLevel(), @@ -205,5 +206,4 @@ public class ItemStats { */ @Deprecated public static final ItemStat DURABILITY = ITEM_DAMAGE; - } 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();