mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
Improve interact distance check (#6591)
This commit is contained in:
parent
06db5d08b0
commit
810d200bb4
11 changed files with 58 additions and 42 deletions
|
@ -5,17 +5,33 @@ Subject: [PATCH] Move range check for block placing up
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 36a69fb0a9cd81ceb0f9cbe6549fc89bd643c77c..7f4673bb2809729e3722300173a10ec5922fcc76 100644
|
index 36a69fb0a9cd81ceb0f9cbe6549fc89bd643c77c..7bf9f2b85c51424b53c08166b6ba3943f1abe0fe 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1673,17 +1673,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -1661,6 +1661,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
}
|
||||||
|
// Spigot end
|
||||||
|
|
||||||
|
+ // Paper start
|
||||||
|
+ private boolean isOutsideOfReach(double x, double y, double z) {
|
||||||
|
+ Location eyeLoc = this.getCraftPlayer().getEyeLocation();
|
||||||
|
+ double reachDistance = NumberConversions.square(eyeLoc.getX() - x) + NumberConversions.square(eyeLoc.getY() - y) + NumberConversions.square(eyeLoc.getZ() - z);
|
||||||
|
+ return reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED);
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public void handleUseItemOn(ServerboundUseItemOnPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
@@ -1673,17 +1681,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
|
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
|
||||||
Direction enumdirection = movingobjectpositionblock.getDirection();
|
Direction enumdirection = movingobjectpositionblock.getDirection();
|
||||||
|
|
||||||
+ // Paper start - move check up
|
+ // Paper start - move check up and check actual location as well
|
||||||
+ Location eyeLoc = this.getCraftPlayer().getEyeLocation();
|
+ final Vec3 clickedLocation = movingobjectpositionblock.getLocation();
|
||||||
+ double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ());
|
+ if (isOutsideOfReach(blockposition.getX(), blockposition.getY(), blockposition.getZ())
|
||||||
+ if (reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) {
|
+ || !Double.isFinite(clickedLocation.x) || !Double.isFinite(clickedLocation.y) || !Double.isFinite(clickedLocation.z)
|
||||||
|
+ || isOutsideOfReach(clickedLocation.x, clickedLocation.y, clickedLocation.z)) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - move check up
|
+ // Paper end - move check up
|
||||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 7f4673bb2809729e3722300173a10ec5922fcc76..c05ced79e5bf6d2900f0479db3150e76e3874ba0 100644
|
index 121b612a80f7a6f6a52d916d61c9f46f91ffb1f1..b6a7a129b0357ab7d25037e646960aee152a9261 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
|
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
|
||||||
|
@ -33,7 +33,7 @@ index 7f4673bb2809729e3722300173a10ec5922fcc76..c05ced79e5bf6d2900f0479db3150e76
|
||||||
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
|
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
@@ -2982,6 +2986,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -2991,6 +2995,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
|
private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
|
||||||
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
|
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ index 7f4673bb2809729e3722300173a10ec5922fcc76..c05ced79e5bf6d2900f0479db3150e76
|
||||||
@Override
|
@Override
|
||||||
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
|
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
@@ -3009,6 +3015,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -3018,6 +3024,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
try {
|
try {
|
||||||
byte[] data = new byte[packet.data.readableBytes()];
|
byte[] data = new byte[packet.data.readableBytes()];
|
||||||
packet.data.readBytes(data);
|
packet.data.readBytes(data);
|
||||||
|
@ -58,7 +58,7 @@ index 7f4673bb2809729e3722300173a10ec5922fcc76..c05ced79e5bf6d2900f0479db3150e76
|
||||||
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
|
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
|
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
|
||||||
@@ -3018,6 +3033,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -3027,6 +3042,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ index 4747eb55decd797c7872028997f4e22d15c5a661..ff337f7f5317f30b65e1b40c11c17834
|
||||||
public static boolean velocityOnlineMode;
|
public static boolean velocityOnlineMode;
|
||||||
public static byte[] velocitySecretKey;
|
public static byte[] velocitySecretKey;
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 19f2751ed35ea7157b5f4b8c30b3328710967be6..cda4fba2003fc35021b0cece9ade9cf8e3fce422 100644
|
index 4224cf13528c2c2deeb1c1ffeadc954e166d3f61..ecb62a1fd7d0458bd2e7dbbf54c3a415a6889832 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -231,6 +231,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -231,6 +231,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@ -42,7 +42,7 @@ index 19f2751ed35ea7157b5f4b8c30b3328710967be6..cda4fba2003fc35021b0cece9ade9cf8
|
||||||
/* Use thread-safe field access instead
|
/* Use thread-safe field access instead
|
||||||
if (this.chatSpamTickCount > 0) {
|
if (this.chatSpamTickCount > 0) {
|
||||||
--this.chatSpamTickCount;
|
--this.chatSpamTickCount;
|
||||||
@@ -2792,6 +2794,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -2801,6 +2803,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
|
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
|
||||||
|
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Fix interact event not being called in adventure
|
||||||
Call PlayerInteractEvent when left-clicking on a block in adventure mode
|
Call PlayerInteractEvent when left-clicking on a block in adventure mode
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index cda4fba2003fc35021b0cece9ade9cf8e3fce422..9141b04fd67522cfcea26b3b740d1ea4eebd2dbe 100644
|
index ecb62a1fd7d0458bd2e7dbbf54c3a415a6889832..cd2494a8396ef7f4372207ab89271386efdffa4f 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1725,7 +1725,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -1734,7 +1734,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED);
|
MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED);
|
||||||
|
|
||||||
this.player.sendMessage((Component) ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID);
|
this.player.sendMessage((Component) ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID);
|
||||||
|
@ -18,7 +18,7 @@ index cda4fba2003fc35021b0cece9ade9cf8e3fce422..9141b04fd67522cfcea26b3b740d1ea4
|
||||||
this.player.swing(enumhand, true);
|
this.player.swing(enumhand, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2197,7 +2197,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -2206,7 +2206,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
Vec3 vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
Vec3 vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||||
HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.player));
|
HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.player));
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,10 @@ index e53b6515ca427b90f21441cf142ecde6e986058d..1da69d56f0b58708d4c85e76307b7252
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 9141b04fd67522cfcea26b3b740d1ea4eebd2dbe..b06e38f916434dc585f24c041f359b532002cc3c 100644
|
index cd2494a8396ef7f4372207ab89271386efdffa4f..35ccf3b784c114df269151ec9beed3de6b294319 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1714,7 +1714,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -1723,7 +1723,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
int i = this.player.level.getMaxBuildHeight();
|
int i = this.player.level.getMaxBuildHeight();
|
||||||
|
|
||||||
if (blockposition.getY() < i) {
|
if (blockposition.getY() < i) {
|
||||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 7543354f18a46c52022b90318373071fe7da913c..7ea60ced8fc10430c2564913ac80bee47b395326 100644
|
index a32f5f3618aa6b4c7257eb082d54a590f01437ac..08c7eeb53266fe003be1c86bb3afe33c7335f0f8 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1918,6 +1918,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -1927,6 +1927,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
if (this.player.isImmobile()) return; // CraftBukkit
|
if (this.player.isImmobile()) return; // CraftBukkit
|
||||||
if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) {
|
if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) {
|
||||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 7ea60ced8fc10430c2564913ac80bee47b395326..9070424222daacd2174da71b898ee90dea0ea3c5 100644
|
index 08c7eeb53266fe003be1c86bb3afe33c7335f0f8..18c36a21d3ef1f439fa7ef625609a5eb59e63ae9 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -2452,7 +2452,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -2461,7 +2461,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
case PERFORM_RESPAWN:
|
case PERFORM_RESPAWN:
|
||||||
if (this.player.wonGame) {
|
if (this.player.wonGame) {
|
||||||
this.player.wonGame = false;
|
this.player.wonGame = false;
|
||||||
|
|
|
@ -126,10 +126,10 @@ index da2ae74b6f5875200e22c42ed07431016a90845e..35d05cc4bddea5b168a6498add1de9bc
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 9070424222daacd2174da71b898ee90dea0ea3c5..06bdfd91167de980b30463bd4ba972e39f441193 100644
|
index 18c36a21d3ef1f439fa7ef625609a5eb59e63ae9..5f7abfba4154a3191d56eddb6dc75f26d3da3ca9 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -2461,7 +2461,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -2470,7 +2470,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
|
||||||
this.player = this.server.getPlayerList().respawn(this.player, false);
|
this.player = this.server.getPlayerList().respawn(this.player, false);
|
||||||
if (this.server.isHardcore()) {
|
if (this.server.isHardcore()) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerKickEvent causes
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index 2855749701f9fe6d3284e6f072e0971b46816e2a..154b0dd9bcfefbd7e7eae8c2f28bbabcd0fde531 100644
|
index 22edac5278efc495885a5fc34677f26ea67ae9ca..b7beb5c778c010d37e737f09cc9f0e7af3b47cef 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -2125,7 +2125,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -2125,7 +2125,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
@ -57,7 +57,7 @@ index 708ac03d5a849bf09c49547306e4a8c5a5ef8d91..5a8df368a4a25839cd4ac9be6972da2e
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e2f8dc80f 100644
|
index 5f7abfba4154a3191d56eddb6dc75f26d3da3ca9..1a3ebbfdeeff1dee8d6cf2e1611453172fab852e 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -320,7 +320,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -320,7 +320,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@ -209,7 +209,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1830,7 +1838,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -1839,7 +1847,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
|
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
|
||||||
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
|
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
|
||||||
|
@ -218,7 +218,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
}
|
}
|
||||||
// Paper start
|
// Paper start
|
||||||
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
|
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
|
||||||
@@ -1935,7 +1943,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -1944,7 +1952,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
this.player.resetLastActionTime();
|
this.player.resetLastActionTime();
|
||||||
} else {
|
} else {
|
||||||
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||||
|
@ -227,7 +227,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1951,7 +1959,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -1960,7 +1968,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
|
||||||
for (int i = 0; i < s.length(); ++i) {
|
for (int i = 0; i < s.length(); ++i) {
|
||||||
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
|
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
|
||||||
|
@ -236,7 +236,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2024,7 +2032,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -2033,7 +2041,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
Waitable waitable = new Waitable() {
|
Waitable waitable = new Waitable() {
|
||||||
@Override
|
@Override
|
||||||
protected Object evaluate() {
|
protected Object evaluate() {
|
||||||
|
@ -245,7 +245,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -2039,7 +2047,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -2048,7 +2056,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -254,7 +254,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
@@ -2312,7 +2320,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -2321,7 +2329,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
// Spigot Start
|
// Spigot Start
|
||||||
if ( entity == this.player && !this.player.isSpectator() )
|
if ( entity == this.player && !this.player.isSpectator() )
|
||||||
{
|
{
|
||||||
|
@ -263,7 +263,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Spigot End
|
// Spigot End
|
||||||
@@ -2403,7 +2411,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -2412,7 +2420,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
} else {
|
} else {
|
||||||
|
@ -272,7 +272,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
|
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2803,7 +2811,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -2812,7 +2820,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
// Paper start
|
// Paper start
|
||||||
if (!org.bukkit.Bukkit.isPrimaryThread()) {
|
if (!org.bukkit.Bukkit.isPrimaryThread()) {
|
||||||
if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
|
if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
|
||||||
|
@ -281,7 +281,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2992,7 +3000,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -3001,7 +3009,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
} else if (!this.isSingleplayerOwner()) {
|
} else if (!this.isSingleplayerOwner()) {
|
||||||
// Paper start - This needs to be handled on the main thread for plugins
|
// Paper start - This needs to be handled on the main thread for plugins
|
||||||
server.submit(() -> {
|
server.submit(() -> {
|
||||||
|
@ -290,7 +290,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
});
|
});
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
@@ -3038,7 +3046,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -3047,7 +3055,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
|
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
|
||||||
|
@ -299,7 +299,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
}
|
}
|
||||||
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
|
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
|
||||||
try {
|
try {
|
||||||
@@ -3048,7 +3056,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -3057,7 +3065,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
|
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
|
||||||
|
@ -308,7 +308,7 @@ index 06bdfd91167de980b30463bd4ba972e39f441193..93826caece07029911a90919361b773e
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@@ -3066,7 +3074,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -3075,7 +3083,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
|
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
|
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
|
||||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Adds PlayerArmSwingEvent
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 640ee1b8ca4ba7308d94832fc23b0c57c81a99e1..a8fa5d4b13fe439aef00cc15272f0342984c4de1 100644
|
index 07f9b6269fa156672ed8a6572ec5dd72ca08419f..3a562f0c2c851e190ca9a681bbd33721df46a06a 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -2216,7 +2216,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -2225,7 +2225,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arm swing animation
|
// Arm swing animation
|
||||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fixes kick event leave message not being sent
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index a8fa5d4b13fe439aef00cc15272f0342984c4de1..1c7d0f4b594cc0e0ae28c89514fa21f7d42f2644 100644
|
index 3a562f0c2c851e190ca9a681bbd33721df46a06a..6a0b473e3ae663644b15e3921b87e3cb28621b31 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -457,7 +457,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -457,7 +457,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@ -17,7 +17,7 @@ index a8fa5d4b13fe439aef00cc15272f0342984c4de1..1c7d0f4b594cc0e0ae28c89514fa21f7
|
||||||
this.connection.setReadOnly();
|
this.connection.setReadOnly();
|
||||||
MinecraftServer minecraftserver = this.server;
|
MinecraftServer minecraftserver = this.server;
|
||||||
Connection networkmanager = this.connection;
|
Connection networkmanager = this.connection;
|
||||||
@@ -1863,6 +1863,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -1872,6 +1872,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisconnect(Component reason) {
|
public void onDisconnect(Component reason) {
|
||||||
|
@ -29,7 +29,7 @@ index a8fa5d4b13fe439aef00cc15272f0342984c4de1..1c7d0f4b594cc0e0ae28c89514fa21f7
|
||||||
// CraftBukkit start - Rarely it would send a disconnect line twice
|
// CraftBukkit start - Rarely it would send a disconnect line twice
|
||||||
if (this.processedDisconnect) {
|
if (this.processedDisconnect) {
|
||||||
return;
|
return;
|
||||||
@@ -1879,7 +1884,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
@@ -1888,7 +1893,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
|
||||||
this.player.disconnect();
|
this.player.disconnect();
|
||||||
// Paper start - Adventure
|
// Paper start - Adventure
|
||||||
|
|
Loading…
Reference in a new issue