mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 22:13:42 +01:00
275173e538
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: 0c5d8709 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends 255c4fdb SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot CraftBukkit Changes: b6b514b7e SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends fcff84de9 SPIGOT-7399: Revert null check in CraftMetaItem#safelyAdd 44a4b5649 SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot 676969d01 SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory
49 lines
1.7 KiB
Diff
49 lines
1.7 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 ed72095b5cf669d9f25852e8ef772a710c54012a..ddea08e4de2198a0a7565e2fd7a05571ed48f27b 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;
|
|
@@ -234,13 +235,30 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
|
* <p>
|
|
* All vector components are between 0.0 and 1.0 inclusive.
|
|
*
|
|
+ * @deprecated misleading, use {@link #getInteractionPoint()}
|
|
* @return the clicked position. May be null.
|
|
*/
|
|
@Nullable
|
|
+ @Deprecated // Paper
|
|
public Vector getClickedPosition() {
|
|
return clickedPosistion;
|
|
}
|
|
|
|
+ // 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() {
|
|
+ if (this.blockClicked == null || this.clickedPosistion == null) {
|
|
+ return null;
|
|
+ }
|
|
+ return this.blockClicked.getLocation().add(this.clickedPosistion);
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@NotNull
|
|
@Override
|
|
public HandlerList getHandlers() {
|