From fe152f147fd26adf6573f2231d95fa14f8a44d71 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Fri, 11 Mar 2016 13:02:00 -0500 Subject: [PATCH] SPIGOT-1806: Add HumanEntity#getMainHand By: Matthew --- .../src/main/java/org/bukkit/entity/HumanEntity.java | 8 ++++++++ .../src/main/java/org/bukkit/inventory/MainHand.java | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 paper-api/src/main/java/org/bukkit/inventory/MainHand.java diff --git a/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java b/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java index 3d216770c5..1ceb0728f3 100644 --- a/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/paper-api/src/main/java/org/bukkit/entity/HumanEntity.java @@ -2,6 +2,7 @@ package org.bukkit.entity; import org.bukkit.GameMode; import org.bukkit.Location; +import org.bukkit.inventory.MainHand; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryView; @@ -36,6 +37,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible, Inv */ public Inventory getEnderChest(); + /** + * Gets the players selected main hand + * + * @return the players main hand + */ + public MainHand getMainHand(); + /** * If the player currently has an inventory window open, this method will * set a property of that window, such as the state of a progress bar. diff --git a/paper-api/src/main/java/org/bukkit/inventory/MainHand.java b/paper-api/src/main/java/org/bukkit/inventory/MainHand.java new file mode 100644 index 0000000000..75f12f1567 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/inventory/MainHand.java @@ -0,0 +1,9 @@ +package org.bukkit.inventory; + +/** + * Represents the chosen main hand of a player + */ +public enum MainHand { + LEFT, + RIGHT +}