0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/spigot.git synced 2024-11-21 22:06:13 +00:00
spigot/CraftBukkit-Patches/0019-Disallow-Interaction-With-Self.patch

28 lines
1.2 KiB
Diff

From 18d688db44b904fc1654c215f200ef84475ecb18 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Fri, 28 Jun 2013 19:52:54 +1000
Subject: [PATCH] Disallow Interaction With Self
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
index 4f72da4f06..865171a0ef 100644
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
@@ -2343,6 +2343,13 @@ public class PlayerConnection extends ServerCommonPacketListenerImpl implements
if (this.player.isImmobile()) return; // CraftBukkit
final WorldServer worldserver = this.player.serverLevel();
final Entity entity = packetplayinuseentity.getTarget(worldserver);
+ // Spigot Start
+ if ( entity == player && !player.isSpectator() )
+ {
+ disconnect( IChatBaseComponent.literal( "Cannot interact with self!" ) );
+ return;
+ }
+ // Spigot End
this.player.resetLastActionTime();
this.player.setShiftKeyDown(packetplayinuseentity.isUsingSecondaryAction());
--
2.47.0