Paper/Spigot-API-Patches/0133-Add-hand-to-bucket-events.patch
Aikar 835bc39b03
Paper 1.13.1 Update
Updated Upstream (Bukkit/CraftBukkit/Spigot)

Bukkit Changes:
2dcc44dc SPIGOT-4307: Fix hacky API for banners on shields
e0fc6572 SPIGOT-4309: Add "forced" display of particles
efeeab2f Add index to README.md for easier navigation
f502bc6f Update to Minecraft 1.13.1

CraftBukkit Changes:
d0bb0a1d Fix some tests randomly failing
997d378d Fix client stall in specific teleportation scenarios
b3dc2366 SPIGOT-4307: Fix hacky API for banners on shields
2a271162 SPIGOT-4301: Fix more invalid enchants
5d0d83bb SPIGOT-4309: Add "forced" display of particles
a6772578 Add additional tests for CraftBlockData
ce1af0c3 Update to Minecraft 1.13.1

Spigot Changes:
2440e189 Rebuild patches
4ecffced Update to Minecraft 1.13.1
2018-08-26 20:51:39 -04:00

112 lines
4.5 KiB
Diff

From efea6dce832fdacd6d244e7ee4e1e484fba0fc4b Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Thu, 2 Aug 2018 08:44:20 -0500
Subject: [PATCH] Add hand to bucket events
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
index 8fb121a91..7b9596f30 100644
--- a/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
+import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
/**
@@ -17,6 +18,12 @@ public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
super(who, blockClicked, blockFace, bucket, itemInHand);
}
+ // Paper start - add EquipmentSlot
+ public PlayerBucketEmptyEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand, final EquipmentSlot hand) {
+ super(who, blockClicked, blockFace, bucket, itemInHand, hand);
+ }
+ // Paper end
+
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
index 56584687f..3dbe428ba 100644
--- a/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
+import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
/**
@@ -16,13 +17,21 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
private final Block blockClicked;
private final BlockFace blockFace;
private final Material bucket;
+ private final EquipmentSlot hand; // Paper - add EquipmentSlot
public PlayerBucketEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand) {
+ // Paper start - add EquipmentSlot
+ this(who, blockClicked, blockFace, bucket, itemInHand, null);
+ }
+
+ public PlayerBucketEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand, final EquipmentSlot hand) {
+ // Paper end
super(who);
this.blockClicked = blockClicked;
this.blockFace = blockFace;
this.itemStack = itemInHand;
this.bucket = bucket;
+ this.hand = hand == null ? player.getInventory().getItemInMainHand().equals(itemInHand) ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND : hand; // Paper - add EquipmentSlot
}
/**
@@ -70,6 +79,17 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
return blockFace;
}
+ // Paper start
+ /**
+ * The hand used to perform this action.
+ *
+ * @return the hand used
+ */
+ public EquipmentSlot getHand() {
+ return hand;
+ }
+ // Paper end
+
public boolean isCancelled() {
return cancelled;
}
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
index 94e042a36..884b9240b 100644
--- a/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
+import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
/**
@@ -17,6 +18,12 @@ public class PlayerBucketFillEvent extends PlayerBucketEvent {
super(who, blockClicked, blockFace, bucket, itemInHand);
}
+ // Paper start - add EquipmentSlot
+ public PlayerBucketFillEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand, final EquipmentSlot hand) {
+ super(who, blockClicked, blockFace, bucket, itemInHand, hand);
+ }
+ // Paper end
+
@Override
public HandlerList getHandlers() {
return handlers;
--
2.18.0