diff options
author | md_5 <git@md-5.net> | 2018-01-28 09:55:16 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-01-28 09:56:55 +1100 |
commit | 015bda4b7d4849e4036193411dfef3007afef24e (patch) | |
tree | 3fd7f314afee8392895cb2ae61af12d9dc1f46b8 /src/main/java | |
parent | dac2a4a6ae4dcc26ffac0e6d5bc883ce98a676d2 (diff) | |
download | craftbukkit-015bda4b7d4849e4036193411dfef3007afef24e.tar craftbukkit-015bda4b7d4849e4036193411dfef3007afef24e.tar.gz craftbukkit-015bda4b7d4849e4036193411dfef3007afef24e.tar.lz craftbukkit-015bda4b7d4849e4036193411dfef3007afef24e.tar.xz craftbukkit-015bda4b7d4849e4036193411dfef3007afef24e.zip |
SPIGOT-2911: Implement AbstractHorseInventory
Diffstat (limited to 'src/main/java')
4 files changed, 28 insertions, 14 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java index 62c7d44c..14d04168 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java @@ -5,11 +5,11 @@ import net.minecraft.server.EntityHorse; import net.minecraft.server.EntityHorseAbstract; import org.apache.commons.lang.Validate; import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.inventory.CraftInventory; +import org.bukkit.craftbukkit.inventory.CraftInventoryAbstractHorse; import org.bukkit.entity.AbstractHorse; import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.Horse; -import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.AbstractHorseInventory; public abstract class CraftAbstractHorse extends CraftAnimals implements AbstractHorse { @@ -91,7 +91,7 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac } @Override - public Inventory getInventory() { - return new CraftInventory(getHandle().inventoryChest); + public AbstractHorseInventory getInventory() { + return new CraftInventoryAbstractHorse(getHandle().inventoryChest); } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAbstractHorse.java new file mode 100644 index 00000000..b7793caa --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAbstractHorse.java @@ -0,0 +1,22 @@ +package org.bukkit.craftbukkit.inventory; + +import net.minecraft.server.IInventory; +import org.bukkit.inventory.AbstractHorseInventory; +import org.bukkit.inventory.ItemStack; + +public class CraftInventoryAbstractHorse extends CraftInventory implements AbstractHorseInventory { + + public CraftInventoryAbstractHorse(IInventory inventory) { + super(inventory); + } + + @Override + public ItemStack getSaddle() { + return getItem(0); + } + + @Override + public void setSaddle(ItemStack stack) { + setItem(0, stack); + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java index 5adbd743..173818e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java @@ -4,24 +4,16 @@ import net.minecraft.server.IInventory; import org.bukkit.inventory.HorseInventory; import org.bukkit.inventory.ItemStack; -public class CraftInventoryHorse extends CraftInventory implements HorseInventory { +public class CraftInventoryHorse extends CraftInventoryAbstractHorse implements HorseInventory { public CraftInventoryHorse(IInventory inventory) { super(inventory); } - public ItemStack getSaddle() { - return getItem(0); - } - public ItemStack getArmor() { return getItem(1); } - public void setSaddle(ItemStack stack) { - setItem(0, stack); - } - public void setArmor(ItemStack stack) { setItem(1, stack); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryLlama.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryLlama.java index 342b74ae..c910f5e9 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryLlama.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryLlama.java @@ -4,7 +4,7 @@ import net.minecraft.server.IInventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.LlamaInventory; -public class CraftInventoryLlama extends CraftInventory implements LlamaInventory { +public class CraftInventoryLlama extends CraftInventoryAbstractHorse implements LlamaInventory { public CraftInventoryLlama(IInventory inventory) { super(inventory); |