aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0172-Extend-Player-Interact-cancellation.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0172-Extend-Player-Interact-cancellation.patch')
-rw-r--r--patches/server/0172-Extend-Player-Interact-cancellation.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/patches/server/0172-Extend-Player-Interact-cancellation.patch b/patches/server/0172-Extend-Player-Interact-cancellation.patch
new file mode 100644
index 0000000000..fee4959d90
--- /dev/null
+++ b/patches/server/0172-Extend-Player-Interact-cancellation.patch
@@ -0,0 +1,27 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Shane Freeder <[email protected]>
+Date: Sun, 11 Feb 2018 10:43:46 +0000
+Subject: [PATCH] Extend Player Interact cancellation
+
+GUIs are opened on the client, meaning that the server cannot block them from opening,
+However, it is possible to close these GUIs from the server.
+
+Flower pots are also not updated on the client when interaction is cancelled, this patch
+also resolves this.
+
+diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+index f4bf927477af23365a2d4618a1634195bd2054c8..5f2dec1917f1c1c3bb69446832321f3fc21dc129 100644
+--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
++++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+@@ -514,7 +514,11 @@ public class ServerPlayerGameMode {
+
+ // send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc)
+ player.connection.send(new ClientboundBlockUpdatePacket(world, blockposition.above()));
++ // Paper start - extend Player Interact cancellation // TODO: consider merging this into the extracted method
++ } else if (iblockdata.is(Blocks.STRUCTURE_BLOCK) || iblockdata.getBlock() instanceof net.minecraft.world.level.block.CommandBlock) {
++ player.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerClosePacket(this.player.containerMenu.containerId));
+ }
++ // Paper end - extend Player Interact cancellation
+ player.getBukkitEntity().updateInventory(); // SPIGOT-2867
+ return (event.useItemInHand() != Event.Result.ALLOW) ? InteractionResult.SUCCESS : InteractionResult.PASS;
+ } else if (this.gameModeForPlayer == GameType.SPECTATOR) {