From b0411e8799585b1c8a119c5a2530e8f9b6d3e974 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 2 Mar 2016 17:03:20 +1100 Subject: SPIGOT-1622: Add drop chance methods for off hand. --- .../inventory/CraftEntityEquipment.java | 24 +++++++++++++++++++++- .../inventory/CraftInventoryPlayer.java | 24 +++++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java index e95fb3a8..3ed9e2bb 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java @@ -113,14 +113,36 @@ public class CraftEntityEquipment implements EntityEquipment { return entity; } + @Override public float getItemInHandDropChance() { - return getDropChance(EnumItemSlot.MAINHAND); + return getItemInMainHandDropChance(); } + @Override public void setItemInHandDropChance(float chance) { + setItemInMainHandDropChance(chance); + } + + @Override + public float getItemInMainHandDropChance() { + return getDropChance(EnumItemSlot.MAINHAND); + } + + @Override + public void setItemInMainHandDropChance(float chance) { setDropChance(EnumItemSlot.MAINHAND, chance); } + @Override + public float getItemInOffHandDropChance() { + return getDropChance(EnumItemSlot.OFFHAND); + } + + @Override + public void setItemInOffHandDropChance(float chance) { + setDropChance(EnumItemSlot.OFFHAND, chance); + } + public float getHelmetDropChance() { return getDropChance(EnumItemSlot.HEAD); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java index 8f78b8c6..afdc796a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java @@ -191,11 +191,33 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i return (HumanEntity) inventory.getOwner(); } + @Override public float getItemInHandDropChance() { - return 1; + return getItemInMainHandDropChance(); } + @Override public void setItemInHandDropChance(float chance) { + setItemInMainHandDropChance(chance); + } + + @Override + public float getItemInMainHandDropChance() { + return 1; + } + + @Override + public void setItemInMainHandDropChance(float chance) { + throw new UnsupportedOperationException(); + } + + @Override + public float getItemInOffHandDropChance() { + return 1; + } + + @Override + public void setItemInOffHandDropChance(float chance) { throw new UnsupportedOperationException(); } -- cgit v1.2.3