3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

Fix distanceSq check on block breaking (#6195)

Dieser Commit ist enthalten in:
Jake Potrebic 2021-07-15 20:01:48 -07:00 committet von GitHub
Ursprung b41b5b5c7e
Commit 5a9c14bace
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
17 geänderte Dateien mit 56 neuen und 52 gelöschten Zeilen

Datei anzeigen

@ -63,16 +63,20 @@ index 315dad4789f5f2582ee9b4fc176affd1f57537ef..482eebf61944add9f1ad6abea6124a9f
this.level.destroyBlockProgress(this.player.getId(), pos, -1);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 38a48add445e8dd6888bc5bb22e7bf5482682536..e8d23504c02225713a01c4b34530b053685de63e 100644
index 38a48add445e8dd6888bc5bb22e7bf5482682536..386412d651002c44742d3c87201d184885f2bd08 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1544,7 +1544,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1544,7 +1544,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
case START_DESTROY_BLOCK:
case ABORT_DESTROY_BLOCK:
case STOP_DESTROY_BLOCK:
- this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level.getMaxBuildHeight());
+ // Paper start - Don't allow digging in unloaded chunks
+ double blockDistanceSquared = this.player.distanceToSqr(blockposition.getX() + 0.5D, blockposition.getY() + 0.5D + 1.5D, blockposition.getZ() + 0.5D); // Copied from ServerPlayerGameMode#handleBlockBreakAction
+ // Copied from ServerPlayerGameMode#handleBlockBreakAction
+ double d0 = this.player.getX() - ((double) blockposition.getX() + 0.5D);
+ double d1 = this.player.getY() - ((double) blockposition.getY() + 0.5D) + 1.5D;
+ double d2 = this.player.getZ() - ((double) blockposition.getZ() + 0.5D);
+ double blockDistanceSquared = d0 * d0 + d1 * d1 + d2 * d2;
+ if (blockDistanceSquared > 40 * 40) {
+ LOGGER.warn("{} tried to break a block {} square blocks away from their position", this.player.getScoreboardName(), blockDistanceSquared);
+ this.disconnect("Invalid block break distance");

Datei anzeigen

@ -22,7 +22,7 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d016b1dc976d982320b1c08452dad8a1fccbed18..1bec16d210c1edc9e7d7547ad719e9a759e910d4 100644
index 31104c09ef135bad9a5541b9f48cec18420b5501..6a1aebac1fbf1260ee3d1eb0199146ab732e6f78 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -254,6 +254,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -33,7 +33,7 @@ index d016b1dc976d982320b1c08452dad8a1fccbed18..1bec16d210c1edc9e7d7547ad719e9a7
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
@@ -2853,10 +2854,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2857,10 +2858,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>();
for (int i = 0; i < list.size(); ++i) {

Datei anzeigen

@ -22,10 +22,10 @@ index f835ef1c7109f56f32da394c9afc9fd35b05b51a..58cae4202e61cded7d5dfa9652bbfb97
this.broadcast.accept(packet);
if (this.entity instanceof ServerPlayer) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1bec16d210c1edc9e7d7547ad719e9a759e910d4..7b89b075de9181f6eac00141518e7702f88c2ae2 100644
index 6a1aebac1fbf1260ee3d1eb0199146ab732e6f78..7edc5cc07c33ca534e617cd6346402a9941f2be7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2274,7 +2274,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2278,7 +2278,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem) {
// Refresh the current entity metadata

Datei anzeigen

@ -7,10 +7,10 @@ Fixes an AssertionError when setting the player's item in hand to null or a new
Fixes GH-2718
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 31b61bcc7e899f77787c23db74a5641e58591aa9..e21d52e700cdc67547c2b116a4c8bb6bb6a1e650 100644
index d04119dc814f66116281986ac7c9bb2bbd6fbb35..bff69aaa5cd41d2ed35e79b0ca5a52a6b2376a2e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1726,6 +1726,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1730,6 +1730,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
return;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 61993c40a854f73ee3c3b8fb5e51c63cce21358c..b2e609f9e525ffe0ca5dd7112fb13f3473aeb3c0 100644
index 5338e459dc30a9ff259fbe911625a19295020fbd..9edf7d1864f0cbd84220f6c00e37b62707084f4b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2769,9 +2769,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2773,9 +2773,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
this.player.resetLastActionTime();
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) {

Datei anzeigen

@ -63,10 +63,10 @@ index a335d48467d1730bfed25eb5fd9046e115f23ed0..0a930147663850dc2ea7ffe9ced5611d
@Override
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index aa237c12187e3ab852d495008d969c20f4166b64..9637ed4ead0a88be09c809a874281f75496ee75d 100644
index c1aa7704888c1886bfe6585d5f8658f5976fa5f2..ecb22bd5f7ed3e5969b2fe8dc6bfb404c05f0f7c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3027,7 +3027,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3031,7 +3031,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {

Datei anzeigen

@ -5,10 +5,10 @@ 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
index fbfe38f6fac250216e2029ce0ce0be85d83e59e1..75c7f93fdca73f84d38ba5ba30a4959b7fede0de 100644
index 99cc9b89e1c271bc4a128f7fedccc0998aa04010..c01bababb2fe17be8f904f825561a4f038bd4395 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1679,17 +1679,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1683,17 +1683,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
Direction enumdirection = movingobjectpositionblock.getDirection();

Datei anzeigen

@ -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
index 75c7f93fdca73f84d38ba5ba30a4959b7fede0de..013a049dca56af91a2a2195933703bb97bfd3198 100644
index c01bababb2fe17be8f904f825561a4f038bd4395..66427aec3830b8073cf809d19a7cef1fffc1b076 100644
--- a/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;
@ -33,7 +33,7 @@ index 75c7f93fdca73f84d38ba5ba30a4959b7fede0de..013a049dca56af91a2a2195933703bb9
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.server = server;
this.connection = connection;
@@ -2987,6 +2991,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_UNREGISTER = new ResourceLocation("unregister");
@ -42,7 +42,7 @@ index 75c7f93fdca73f84d38ba5ba30a4959b7fede0de..013a049dca56af91a2a2195933703bb9
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -3014,6 +3020,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3018,6 +3024,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
try {
byte[] data = new byte[packet.data.readableBytes()];
packet.data.readBytes(data);
@ -58,7 +58,7 @@ index 75c7f93fdca73f84d38ba5ba30a4959b7fede0de..013a049dca56af91a2a2195933703bb9
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@@ -3023,6 +3038,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3027,6 +3042,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}

Datei anzeigen

@ -23,7 +23,7 @@ index 3e486376a49a61d52cdcd32ea877996d81186a73..e62bb33852b0dca346aeb3cb2747d1a5
public static boolean velocityOnlineMode;
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
index f1dde77239f71d4c7300bd48512defea2886aeef..3f25e634cbe52f9ab208c02e7aa4d09bcaa27777 100644
index 5b42180e7e289f498763f2d64ae1e47130259899..dc4809a4e77db84b992b5bd0d2f6b103accf91a9 100644
--- a/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
@ -42,7 +42,7 @@ index f1dde77239f71d4c7300bd48512defea2886aeef..3f25e634cbe52f9ab208c02e7aa4d09b
/* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount;
@@ -2786,6 +2788,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2790,6 +2792,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {

Datei anzeigen

@ -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
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 3f25e634cbe52f9ab208c02e7aa4d09bcaa27777..2437565e754414366ed76fa16c5a5f146647cb63 100644
index dc4809a4e77db84b992b5bd0d2f6b103accf91a9..425d74c43d6256ddc4a53a6f5c400756a2b4783a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1719,7 +1719,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1723,7 +1723,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED);
this.player.sendMessage((Component) ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID);
@ -18,7 +18,7 @@ index 3f25e634cbe52f9ab208c02e7aa4d09bcaa27777..2437565e754414366ed76fa16c5a5f14
this.player.swing(enumhand, true);
}
}
@@ -2191,7 +2191,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2195,7 +2195,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
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));

Datei anzeigen

@ -20,10 +20,10 @@ index 20eb4aea24cc6699747b18b2c00e5b01dafb47c6..acd61a9033fdfb91e29a5fa6a10b8983
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2437565e754414366ed76fa16c5a5f146647cb63..1daeaddfb46b1e35c6ce1355c8c9ef2d45917fad 100644
index 425d74c43d6256ddc4a53a6f5c400756a2b4783a..551c96ee836e1b69af28cf3bf0f2ccb0a56e1e15 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1708,7 +1708,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1712,7 +1712,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
int i = this.player.level.getMaxBuildHeight();
if (blockposition.getY() < i) {

Datei anzeigen

@ -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
index d416f404c3a04627beb19909f1641f5673f2b110..664ae55e11910e5acc8b9ab0444d2377ab17dd53 100644
index 2995a496382fea5668bc71de3b23fa83165650fb..87a8b912f9f6f432b7fb1d487c4b73760404fc98 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1912,6 +1912,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1916,6 +1916,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (this.player.isImmobile()) return; // CraftBukkit
if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) {

Datei anzeigen

@ -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
index 664ae55e11910e5acc8b9ab0444d2377ab17dd53..9ffa79d11edc0baed397ade1fc77a336df34a252 100644
index 87a8b912f9f6f432b7fb1d487c4b73760404fc98..f15c003b4ea948881e1b54d88c17414ae26f2553 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2446,7 +2446,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2450,7 +2450,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;

Datei anzeigen

@ -124,10 +124,10 @@ index 78852ebbc57ead857f051edf49345466e250337d..c607cbae6306bea4eaf9c7abc55c59e9
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9ffa79d11edc0baed397ade1fc77a336df34a252..083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a 100644
index f15c003b4ea948881e1b54d88c17414ae26f2553..a0038eed3a88b4965c406ca4c36e93d127631e77 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2455,7 +2455,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2459,7 +2459,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player = this.server.getPlayerList().respawn(this.player, false);
if (this.server.isHardcore()) {

Datei anzeigen

@ -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
index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe05e4eb359 100644
index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3d866f4e8 100644
--- a/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
@ -209,8 +209,8 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
return;
}
}
@@ -1645,7 +1653,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
double blockDistanceSquared = this.player.distanceToSqr(blockposition.getX() + 0.5D, blockposition.getY() + 0.5D + 1.5D, blockposition.getZ() + 0.5D); // Copied from ServerPlayerGameMode#handleBlockBreakAction
@@ -1649,7 +1657,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
double blockDistanceSquared = d0 * d0 + d1 * d1 + d2 * d2;
if (blockDistanceSquared > 40 * 40) {
LOGGER.warn("{} tried to break a block {} square blocks away from their position", this.player.getScoreboardName(), blockDistanceSquared);
- this.disconnect("Invalid block break distance");
@ -218,7 +218,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
return;
}
if (this.player.level.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
@@ -1824,7 +1832,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1828,7 +1836,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
@ -227,7 +227,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
}
// Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
@@ -1929,7 +1937,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1933,7 +1941,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.resetLastActionTime();
} else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -236,7 +236,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
}
}
@@ -1945,7 +1953,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1949,7 +1957,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
@ -245,7 +245,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
return;
}
}
@@ -2018,7 +2026,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2022,7 +2030,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
@ -254,7 +254,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
return null;
}
};
@@ -2033,7 +2041,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2037,7 +2045,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
throw new RuntimeException(e);
}
} else {
@ -263,7 +263,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
}
// CraftBukkit end
}
@@ -2306,7 +2314,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2310,7 +2318,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Spigot Start
if ( entity == this.player && !this.player.isSpectator() )
{
@ -272,7 +272,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
return;
}
// Spigot End
@@ -2397,7 +2405,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2401,7 +2409,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
// CraftBukkit end
} else {
@ -281,7 +281,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
}
@@ -2797,7 +2805,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2801,7 +2809,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
@ -290,7 +290,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
return;
}
}
@@ -2985,7 +2993,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2989,7 +2997,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> {
@ -299,7 +299,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
});
// Paper end
}
@@ -3031,7 +3039,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3035,7 +3043,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -308,7 +308,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
}
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try {
@@ -3041,7 +3049,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3045,7 +3053,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -317,7 +317,7 @@ index 083ae2f6356c08c5b4242f8e29d7741eb7f7ed9a..6c8e36c8bf60522c499fbd2d7175afe0
}
} else {
try {
@@ -3059,7 +3067,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3063,7 +3071,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);

Datei anzeigen

@ -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
index 4bd49df9e6ff108a8ae95f9924d1a701e22eea49..87388f6339d740544414c9c33237013bd26155b8 100644
index e39ac447c91849ccaa8c6911f740651a88fe0a35..a917452aa36ec34cbe960d1dd7b9efc43a9d26b8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2210,7 +2210,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2214,7 +2214,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
// Arm swing animation

Datei anzeigen

@ -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
index 87388f6339d740544414c9c33237013bd26155b8..fa01e45afcc7f888e78ef95a5a4dbca373083ad0 100644
index a917452aa36ec34cbe960d1dd7b9efc43a9d26b8..45b57cbd619cec8a77014f977df9778f0ff88917 100644
--- a/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
@ -17,7 +17,7 @@ index 87388f6339d740544414c9c33237013bd26155b8..fa01e45afcc7f888e78ef95a5a4dbca3
this.connection.setReadOnly();
MinecraftServer minecraftserver = this.server;
Connection networkmanager = this.connection;
@@ -1857,6 +1857,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1861,6 +1861,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override
public void onDisconnect(Component reason) {
@ -29,7 +29,7 @@ index 87388f6339d740544414c9c33237013bd26155b8..fa01e45afcc7f888e78ef95a5a4dbca3
// CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) {
return;
@@ -1873,7 +1878,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1877,7 +1882,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.disconnect();
// Paper start - Adventure