mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-21 04:27:45 +01:00
disable drop stat - with listener as requested in #1289
This commit is contained in:
parent
7f8afdff65
commit
1c350339a4
@ -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(),
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user