fix cancellation

This commit is contained in:
Isaac - The456 2024-09-13 01:58:20 +01:00
parent b59a2f4ac3
commit 565343ba80
No known key found for this signature in database
GPG Key ID: 57A848D2F87C14EF

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerLiddedOpenEvent
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java b/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
index dfc184ed9f49524cf198ff672282326c16b41441..bdb80c8c07c18140232b248b88849ab76461c7cc 100644
index dfc184ed9f49524cf198ff672282326c16b41441..46b4b6212d47bc18daa0ae326227631fafee1005 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
@@ -47,6 +47,7 @@ public abstract class ContainerOpenersCounter {
@ -21,7 +21,7 @@ index dfc184ed9f49524cf198ff672282326c16b41441..bdb80c8c07c18140232b248b88849ab7
public void incrementOpeners(@javax.annotation.Nullable Player player, Level world, BlockPos pos, BlockState state) { // Paper - make player nullable for New Lidded API
+ // Paper start - Call PlayerLiddedOpenEvent
+ if (player != null && org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerLiddedOpenEvent(player, world, pos)) {
+ if (player != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerLiddedOpenEvent(player, world, pos)) {
+ cancelledPlayers.add(player);
+ return;
+ }
@ -50,7 +50,7 @@ index dfc184ed9f49524cf198ff672282326c16b41441..bdb80c8c07c18140232b248b88849ab7
Player entityhuman;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
index 53a77dddfd6ae8b0cf102acd5a8e7679df500704..5f7ecfe65bd3528443abed923711283f784da6fb 100644
index 53a77dddfd6ae8b0cf102acd5a8e7679df500704..347c7d09784ebd8435134d2797f6cf16dfb0fb29 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
@@ -202,6 +202,7 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
@ -66,7 +66,7 @@ index 53a77dddfd6ae8b0cf102acd5a8e7679df500704..5f7ecfe65bd3528443abed923711283f
this.openCount = 0;
}
+ // Paper start - Call PlayerLiddedOpenEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerLiddedOpenEvent(player, this.level, this.worldPosition)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerLiddedOpenEvent(player, this.level, this.worldPosition)) {
+ cancelledPlayers.add(player);
+ return;
+ }