summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorFearThe1337 <admin@fearthe1337.com>2015-02-15 12:24:14 +1100
committermd_5 <git@md-5.net>2015-02-15 12:24:14 +1100
commit116514c162035ff7fd99e97fe70b7af9f055ec6d (patch)
treea828a7c4c250c63adff1402c3e17992ce1ada43a /src/main/java
parent9648edfa6136394153d524fa89c347d86f455641 (diff)
downloadcraftbukkit-116514c162035ff7fd99e97fe70b7af9f055ec6d.tar
craftbukkit-116514c162035ff7fd99e97fe70b7af9f055ec6d.tar.gz
craftbukkit-116514c162035ff7fd99e97fe70b7af9f055ec6d.tar.lz
craftbukkit-116514c162035ff7fd99e97fe70b7af9f055ec6d.tar.xz
craftbukkit-116514c162035ff7fd99e97fe70b7af9f055ec6d.zip
Implement armor stand event.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java b/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java
new file mode 100644
index 00000000..a33f446f
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/CraftEquipmentSlot.java
@@ -0,0 +1,35 @@
+package org.bukkit.craftbukkit;
+
+import org.bukkit.inventory.EquipmentSlot;
+
+public class CraftEquipmentSlot {
+
+ private static final int[] slots = new int[EquipmentSlot.values().length];
+ private static final EquipmentSlot[] enums = new EquipmentSlot[EquipmentSlot.values().length];
+
+ static {
+ set(EquipmentSlot.HAND, 0);
+ set(EquipmentSlot.FEET, 1);
+ set(EquipmentSlot.LEGS, 2);
+ set(EquipmentSlot.CHEST, 3);
+ set(EquipmentSlot.HEAD, 4);
+ }
+
+ private static void set(EquipmentSlot type, int value) {
+ slots[type.ordinal()] = value;
+ if (value < enums.length) {
+ enums[value] = type;
+ }
+ }
+
+ public static EquipmentSlot getSlot(int magic) {
+ if (magic > 0 && magic < enums.length) {
+ return enums[magic];
+ }
+ return null;
+ }
+
+ public static int getSlotIndex(EquipmentSlot slot) {
+ return slots[slot.ordinal()];
+ }
+}