summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorMinusKube <MinusKube@bitbucket.org>2016-03-02 05:16:35 +0100
committermd_5 <git@md-5.net>2016-03-14 16:53:14 +1100
commita63b264027e186d73adc5131056271aa4e28af8d (patch)
tree122a165889bda2eb4c100cbcc06fc52490ba645a /src/main/java/org
parenta09454032a06eeeb9e405167a9a4aff02b4ce0f9 (diff)
downloadbukkit-a63b264027e186d73adc5131056271aa4e28af8d.tar
bukkit-a63b264027e186d73adc5131056271aa4e28af8d.tar.gz
bukkit-a63b264027e186d73adc5131056271aa4e28af8d.tar.lz
bukkit-a63b264027e186d73adc5131056271aa4e28af8d.tar.xz
bukkit-a63b264027e186d73adc5131056271aa4e28af8d.zip
SPIGOT-1532: Add PlayerSwapHandItemsEvent
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java b/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java
new file mode 100644
index 00000000..483eb17e
--- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerSwapHandItemsEvent.java
@@ -0,0 +1,81 @@
+package org.bukkit.event.player;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.inventory.ItemStack;
+
+/**
+ * Called when a player swap items between main hand and off hand using the
+ * hotkey.
+ */
+public class PlayerSwapHandItemsEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ //
+ private ItemStack mainHandItem;
+ private ItemStack offHandItem;
+ private boolean cancelled;
+
+ public PlayerSwapHandItemsEvent(Player player, ItemStack mainHandItem, ItemStack offHandItem) {
+ super(player);
+
+ this.mainHandItem = mainHandItem;
+ this.offHandItem = offHandItem;
+ }
+
+ /**
+ * Gets the item switched to the main hand.
+ *
+ * @return item in the main hand
+ */
+ public ItemStack getMainHandItem() {
+ return mainHandItem;
+ }
+
+ /**
+ * Sets the item in the main hand.
+ *
+ * @param mainHandItem new item in the main hand
+ */
+ public void setMainHandItem(ItemStack mainHandItem) {
+ this.mainHandItem = mainHandItem;
+ }
+
+ /**
+ * Gets the item switched to the off hand.
+ *
+ * @return item in the off hand
+ */
+ public ItemStack getOffHandItem() {
+ return offHandItem;
+ }
+
+ /**
+ * Sets the item in the off hand.
+ *
+ * @param offHandItem new item in the off hand
+ */
+ public void setOffHandItem(ItemStack offHandItem) {
+ this.offHandItem = offHandItem;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}