Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/CraftBukkit-Patches/0173-Force-Close-Inventory-On-Move.patch
Zach Brown 3727c00bdd Update from upstream SpigotMC
Abridged: Force close player inventories when they move/interact
This prevents modified clients from using the 2x2 crafting square as permanent storage

Force Close Inventory On Move SpigotMC/Spigot@db78a70788
Only close once, if needed SpigotMC/Spigot@b652de8e7f
Move to interact event closing SpigotMC/Spigot@b5378850d3
Disregard arm swings - racy SpigotMC/Spigot@f86634e280
2014-08-10 00:21:18 -05:00

53 Zeilen
1.8 KiB
Diff

From c9d9a1ae8bc827c6b3128bf8fa74cc260ac9adec Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 10 Aug 2014 11:01:02 +1000
Subject: [PATCH] Force Close Inventory On Move
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0e2bc03..e8bfc41 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -489,6 +489,12 @@ public class PlayerConnection implements PacketPlayInListener {
public void a(PacketPlayInBlockDig packetplayinblockdig) {
if (this.player.dead) return; // CraftBukkit
+ // Spigot start
+ if ( player.activeContainer != player.defaultContainer )
+ {
+ getPlayer().closeInventory();
+ }
+ // Spigot end
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
this.player.v();
@@ -615,6 +621,12 @@ public class PlayerConnection implements PacketPlayInListener {
// a notch bug where the item doesn't update correctly.
boolean always = false;
// CraftBukkit end
+ // Spigot start
+ if ( player.activeContainer != player.defaultContainer )
+ {
+ getPlayer().closeInventory();
+ }
+ // Spigot end
ItemStack itemstack = this.player.inventory.getItemInHand();
boolean flag = false;
@@ -1118,6 +1130,12 @@ public class PlayerConnection implements PacketPlayInListener {
return;
}
// Spigot End
+ // Spigot start
+ if ( player.activeContainer != player.defaultContainer )
+ {
+ getPlayer().closeInventory();
+ }
+ // Spigot end
this.player.v();
if (entity != null) {
--
1.9.1