928bcc8d3a
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 09943450 Update SnakeYAML version 5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc 6f82b381 PR-788: Add getHand() to all relevant events CraftBukkit Changes: aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe 5329dd6fd PR-1107: Add getHand() to all relevant events 93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
67 lines
2.8 KiB
Diff
67 lines
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Madeline Miller <mnmiller1@me.com>
|
|
Date: Mon, 4 Jan 2021 16:40:55 +1000
|
|
Subject: [PATCH] Add API to get exact interaction point in PlayerInteractEvent
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
|
|
index 1208e1f8c2163d83c5b12bbb9b7ac044c72380e0..a01f86e6aba8b66ecc713da0787cd861e2930a2a 100644
|
|
--- a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
|
|
@@ -1,5 +1,6 @@
|
|
package org.bukkit.event.player;
|
|
|
|
+import org.bukkit.Location;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.block.Block;
|
|
import org.bukkit.block.BlockFace;
|
|
@@ -34,22 +35,30 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
|
private Result useClickedBlock;
|
|
private Result useItemInHand;
|
|
private EquipmentSlot hand;
|
|
+ private Location interactionPoint; // Paper
|
|
|
|
public PlayerInteractEvent(@NotNull final Player who, @NotNull final Action action, @Nullable final ItemStack item, @Nullable final Block clickedBlock, @NotNull final BlockFace clickedFace) {
|
|
this(who, action, item, clickedBlock, clickedFace, EquipmentSlot.HAND);
|
|
}
|
|
|
|
public PlayerInteractEvent(@NotNull final Player who, @NotNull final Action action, @Nullable final ItemStack item, @Nullable final Block clickedBlock, @NotNull final BlockFace clickedFace, @Nullable final EquipmentSlot hand) {
|
|
+ // Paper start - Add interactionPoint
|
|
+ this(who, action, item, clickedBlock, clickedFace, hand, null);
|
|
+ }
|
|
+
|
|
+ public PlayerInteractEvent(@NotNull final Player who, @NotNull final Action action, @Nullable final ItemStack item, @Nullable final Block clickedBlock, @NotNull final BlockFace clickedFace, @Nullable final EquipmentSlot hand, @Nullable final Location interactionPoint) {
|
|
super(who);
|
|
this.action = action;
|
|
this.item = item;
|
|
this.blockClicked = clickedBlock;
|
|
this.blockFace = clickedFace;
|
|
this.hand = hand;
|
|
+ this.interactionPoint = interactionPoint;
|
|
|
|
useItemInHand = Result.DEFAULT;
|
|
useClickedBlock = clickedBlock == null ? Result.DENY : Result.ALLOW;
|
|
}
|
|
+ // Paper end
|
|
|
|
/**
|
|
* Returns the action type
|
|
@@ -221,6 +230,18 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
|
return hand;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ /**
|
|
+ * The exact point at which the interaction occurred. May be null.
|
|
+ *
|
|
+ * @return the exact interaction point. May be null.
|
|
+ */
|
|
+ @Nullable
|
|
+ public Location getInteractionPoint() {
|
|
+ return interactionPoint;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@NotNull
|
|
@Override
|
|
public HandlerList getHandlers() {
|