Archiviert
13
0

Fix block action handling (#6213)

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-07-17 14:46:46 +02:00 committet von GitHub
Ursprung 7f89e96357
Commit b1cdc1274c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
21 geänderte Dateien mit 71 neuen und 95 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Don't allow digging into unloaded chunks
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 315dad4789f5f2582ee9b4fc176affd1f57537ef..482eebf61944add9f1ad6abea6124a9f3191628e 100644
index 315dad4789f5f2582ee9b4fc176affd1f57537ef..8659df9d2e9d8b3b0cd992efc9a1f3b2d958e9c8 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -119,8 +119,8 @@ public class ServerPlayerGameMode {
@ -34,19 +34,15 @@ index 315dad4789f5f2582ee9b4fc176affd1f57537ef..482eebf61944add9f1ad6abea6124a9f
if (iblockdata.isAir()) {
this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1);
this.lastSentState = -1;
@@ -161,6 +167,11 @@ public class ServerPlayerGameMode {
double d1 = this.player.getY() - ((double) pos.getY() + 0.5D) + 1.5D;
double d2 = this.player.getZ() - ((double) pos.getZ() + 0.5D);
@@ -163,6 +169,7 @@ public class ServerPlayerGameMode {
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
+ // Paper start
+ this.handleBlockBreakAction(pos, action, direction, worldHeight, d3);
+ }
+ public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, double d3) {
+ // Paper end
if (d3 > 36.0D) {
+ if (d3 < 80 * 80) // Paper - Don't notify if unreasonably far away
this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, false, "too far"));
@@ -295,10 +306,12 @@ public class ServerPlayerGameMode {
} else if (pos.getY() >= worldHeight) {
this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, false, "too high"));
@@ -295,10 +302,12 @@ public class ServerPlayerGameMode {
this.player.connection.send(new ClientboundBlockBreakAckPacket(pos, this.level.getBlockState(pos), action, true, "stopped destroying"));
} else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) {
this.isDestroyingBlock = false;
@ -63,29 +59,18 @@ 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..386412d651002c44742d3c87201d184885f2bd08 100644
index 38a48add445e8dd6888bc5bb22e7bf5482682536..a615821cf605208c61be27f8bd026437b799de14 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1544,7 +1544,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1544,7 +1544,12 @@ 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
+ // 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");
+ return;
+ }
+ if (this.player.level.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
+ return;
+ }
+ this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level.getMaxBuildHeight(), blockDistanceSquared);
this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level.getMaxBuildHeight());
+ // Paper end - Don't allow digging in unloaded chunks
return;
default:

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 31104c09ef135bad9a5541b9f48cec18420b5501..6a1aebac1fbf1260ee3d1eb0199146ab732e6f78 100644
index 0103c76c183d0e866a98c26f2d1cf557ba4f67e8..d24d42ef0a00b9420700e58f555f8448f8d01747 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 31104c09ef135bad9a5541b9f48cec18420b5501..6a1aebac1fbf1260ee3d1eb0199146ab
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) {
@@ -2857,10 +2858,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2847,10 +2848,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 6a1aebac1fbf1260ee3d1eb0199146ab732e6f78..7edc5cc07c33ca534e617cd6346402a9941f2be7 100644
index d24d42ef0a00b9420700e58f555f8448f8d01747..fafb0052efb2942955d3964967f203413cb09574 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2278,7 +2278,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2268,7 +2268,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 d04119dc814f66116281986ac7c9bb2bbd6fbb35..bff69aaa5cd41d2ed35e79b0ca5a52a6b2376a2e 100644
index ea19697d8e60a993979d61a4d0f89110fd2cc574..b3527b60028663695f2b2e3d4e01d772ac23fbb5 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1730,6 +1730,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1720,6 +1720,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
return;
}

Datei anzeigen

@ -1117,7 +1117,7 @@ index 60de95d72ca4e4b2e12a2b3363c59a08b75d0aae..fac80bdbf0fa68cd8e63130a6a9de3b6
this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile());
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 482eebf61944add9f1ad6abea6124a9f3191628e..6007d9ac5b95b26e59c358710214708d521761e6 100644
index 8659df9d2e9d8b3b0cd992efc9a1f3b2d958e9c8..3f7919f4e8f5a5b79bf4e541ea5f4ce482965fa1 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -49,7 +49,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
@ -1129,7 +1129,7 @@ index 482eebf61944add9f1ad6abea6124a9f3191628e..6007d9ac5b95b26e59c358710214708d
protected final ServerPlayer player;
private GameType gameModeForPlayer;
@Nullable
@@ -319,6 +319,8 @@ public class ServerPlayerGameMode {
@@ -315,6 +315,8 @@ public class ServerPlayerGameMode {
}
}
@ -1204,7 +1204,7 @@ index 69c2454533e6f21c70792b555ec02c6bc6d169b3..f9e0e109497d685a9d88d2fa8892287b
@Override
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 0530de6e9167419b180a3fd6e890d27d9d86c04c..7661f956e7c900602ceedbcd030d3049d90b8cca 100644
index 8141935e2ee58bbb58c6b5cfdef5a9a88d7658ec..515e28eea8cbab261320352ee0db9b877807f3ed 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -456,7 +456,7 @@ public class LevelChunk implements ChunkAccess {

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 5338e459dc30a9ff259fbe911625a19295020fbd..9edf7d1864f0cbd84220f6c00e37b62707084f4b 100644
index c9bc5e355411d9b6d7cabab6cb8d96bfefe635a5..d6fc3ed5339f974b826123d4833045527007ae6e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2773,9 +2773,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2763,9 +2763,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

@ -5,10 +5,10 @@ Subject: [PATCH] Add permission for command blocks
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 6007d9ac5b95b26e59c358710214708d521761e6..e03ce8f89fcbfe6414877c0d1446865ee6474e38 100644
index 3f7919f4e8f5a5b79bf4e541ea5f4ce482965fa1..81275857101522b2bb8824313159744036a1cc4f 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -396,7 +396,7 @@ public class ServerPlayerGameMode {
@@ -392,7 +392,7 @@ public class ServerPlayerGameMode {
BlockEntity tileentity = this.level.getBlockEntity(pos);
Block block = iblockdata.getBlock();
@ -18,7 +18,7 @@ index 6007d9ac5b95b26e59c358710214708d521761e6..e03ce8f89fcbfe6414877c0d1446865e
return false;
} else if (this.player.blockActionRestricted((Level) this.level, pos, this.gameModeForPlayer)) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 282d5d8db0cc15a7b81a08c721fb38777e0be89a..5d9446190e7a4062c91a2f6504224e2142de4181 100644
index d6fc3ed5339f974b826123d4833045527007ae6e..70c9cfa62af326ee030c4e70fc3d120c82a82a4c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -787,7 +787,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser

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 c1aa7704888c1886bfe6585d5f8658f5976fa5f2..ecb22bd5f7ed3e5969b2fe8dc6bfb404c05f0f7c 100644
index 70c9cfa62af326ee030c4e70fc3d120c82a82a4c..9b04ce1b82e954eca6e59360e606438695dd3bb4 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3031,7 +3031,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3021,7 +3021,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 99cc9b89e1c271bc4a128f7fedccc0998aa04010..c01bababb2fe17be8f904f825561a4f038bd4395 100644
index ae65830c10888993e0a4c7863abf91f560313da1..3c4eab3b562c1fb137a8cf2c64ace05bc0f92d44 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1683,17 +1683,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1673,17 +1673,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 c01bababb2fe17be8f904f825561a4f038bd4395..66427aec3830b8073cf809d19a7cef1fffc1b076 100644
index 3c4eab3b562c1fb137a8cf2c64ace05bc0f92d44..c7f18e142b0294291d7c47cf95943cb3cbc10a11 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 c01bababb2fe17be8f904f825561a4f038bd4395..66427aec3830b8073cf809d19a7cef1f
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.server = server;
this.connection = connection;
@@ -2991,6 +2995,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2981,6 +2985,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 c01bababb2fe17be8f904f825561a4f038bd4395..66427aec3830b8073cf809d19a7cef1f
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -3018,6 +3024,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3008,6 +3014,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
try {
byte[] data = new byte[packet.data.readableBytes()];
packet.data.readBytes(data);
@ -58,7 +58,7 @@ index c01bababb2fe17be8f904f825561a4f038bd4395..66427aec3830b8073cf809d19a7cef1f
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@@ -3027,6 +3042,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3017,6 +3032,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
@ -72,7 +72,7 @@ index c01bababb2fe17be8f904f825561a4f038bd4395..66427aec3830b8073cf809d19a7cef1f
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ead9c15cfe31d1c9582826ad079691a1f147f3fa..56155f59c9a8ce6dd0e60e23bf346e6ab6312886 100644
index 9144fbd3754b21295248103eac8cf9ac989d4614..5a7f6ba01167784894e549e1b04193bf9c9db89c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2436,6 +2436,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -24,7 +24,7 @@ index 3fc9847d26395a19abc5a16150ff8816a1b95dc8..c818a34e17718f0d60979aa24c7385ba
return false;
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index e03ce8f89fcbfe6414877c0d1446865ee6474e38..ab1ac92ddd3810821e996426850c0cd11740fc2a 100644
index 81275857101522b2bb8824313159744036a1cc4f..2fb45e48cc5845c71cca21c43bb012f3eb6a0b53 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -7,6 +7,7 @@ import net.minecraft.world.InteractionResult;
@ -35,7 +35,7 @@ index e03ce8f89fcbfe6414877c0d1446865ee6474e38..ab1ac92ddd3810821e996426850c0cd1
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.DoubleHighBlockItem;
import net.minecraft.world.item.ItemStack;
@@ -428,10 +429,12 @@ public class ServerPlayerGameMode {
@@ -424,10 +425,12 @@ public class ServerPlayerGameMode {
// return true; // CraftBukkit
}
// CraftBukkit start

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 5b42180e7e289f498763f2d64ae1e47130259899..dc4809a4e77db84b992b5bd0d2f6b103accf91a9 100644
index b804a29dc0c3538f5f14d6276247f8f7a299e481..946d537c3049a884a175b20bd79fc97dc762f0f1 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 5b42180e7e289f498763f2d64ae1e47130259899..dc4809a4e77db84b992b5bd0d2f6b103
/* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount;
@@ -2790,6 +2792,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2780,6 +2782,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 dc4809a4e77db84b992b5bd0d2f6b103accf91a9..425d74c43d6256ddc4a53a6f5c400756a2b4783a 100644
index 946d537c3049a884a175b20bd79fc97dc762f0f1..99cbf29c7a9928a140fdc3fd2a4516731670507b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1723,7 +1723,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1713,7 +1713,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 dc4809a4e77db84b992b5bd0d2f6b103accf91a9..425d74c43d6256ddc4a53a6f5c400756
this.player.swing(enumhand, true);
}
}
@@ -2195,7 +2195,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2185,7 +2185,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

@ -5,10 +5,10 @@ Subject: [PATCH] Implement API to expose exact interaction point
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index ab1ac92ddd3810821e996426850c0cd11740fc2a..78852ebbc57ead857f051edf49345466e250337d 100644
index 2fb45e48cc5845c71cca21c43bb012f3eb6a0b53..5ef649dec31ba6d6b74a7bd757727ffd2a79d71e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -505,7 +505,7 @@ public class ServerPlayerGameMode {
@@ -501,7 +501,7 @@ public class ServerPlayerGameMode {
cancelledBlock = true;
}
@ -18,7 +18,7 @@ index ab1ac92ddd3810821e996426850c0cd11740fc2a..78852ebbc57ead857f051edf49345466
this.interactResult = event.useItemInHand() == Event.Result.DENY;
this.interactPosition = blockposition.immutable();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 03250ab358f46095c4fbe969d6d678d7e79b4a96..a2c8deb54e9a8448f2473b58a01329b44f6a3d8f 100644
index e6474142eb8f7f19f083d1ad8797b662eca27565..5e030bddc8e9fe9cbe16a53242b6be8f2232fbc1 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -55,7 +55,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;

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 425d74c43d6256ddc4a53a6f5c400756a2b4783a..551c96ee836e1b69af28cf3bf0f2ccb0a56e1e15 100644
index 99cbf29c7a9928a140fdc3fd2a4516731670507b..373edbfde76af6733911e40ff343faccf9f6df99 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1712,7 +1712,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1702,7 +1702,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 2995a496382fea5668bc71de3b23fa83165650fb..87a8b912f9f6f432b7fb1d487c4b73760404fc98 100644
index 89867d1dce38400a70efa0758b46397dcb3f64f9..38ab031b1f8d9d923efa6686d81b31288efac8b1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1916,6 +1916,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1906,6 +1906,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 87a8b912f9f6f432b7fb1d487c4b73760404fc98..f15c003b4ea948881e1b54d88c17414ae26f2553 100644
index 38ab031b1f8d9d923efa6686d81b31288efac8b1..a0a2839f4c746f1a76b700241da0a32c2736a558 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2450,7 +2450,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2440,7 +2440,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;

Datei anzeigen

@ -91,7 +91,7 @@ index 91a03f4ed215c882d2ae930402220e4cbbf1ea00..8e2bccc3a9ddb17a4978596056189eb7
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 78852ebbc57ead857f051edf49345466e250337d..c607cbae6306bea4eaf9c7abc55c59e92e3304c8 100644
index cc2d2f4885ba0946f93f08aba2b2ec828bb83d85..9ace6b067b46831ee381ee6b40dedd952d3c7562 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -74,18 +74,24 @@ public class ServerPlayerGameMode {
@ -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 f15c003b4ea948881e1b54d88c17414ae26f2553..a0038eed3a88b4965c406ca4c36e93d127631e77 100644
index a0a2839f4c746f1a76b700241da0a32c2736a558..fa77ff7be0f9d499461de0f42da302fca2a43c9f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2459,7 +2459,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2449,7 +2449,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player = this.server.getPlayerList().respawn(this.player, false);
if (this.server.isHardcore()) {
@ -137,7 +137,7 @@ index f15c003b4ea948881e1b54d88c17414ae26f2553..a0038eed3a88b4965c406ca4c36e93d1
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c5aa6f3edab0dbb6a9121200c46e31e5e5f39293..c283d1cb8ba22ba87de1433cbbbcf1d0075a1151 100644
index 418aa0d31fae7c5fa9c0826ef99ac00729c2de71..26ffc901c3a57cb0d85982083d2b0eb6e0f26b69 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1250,7 +1250,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

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 a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3d866f4e8 100644
index fa77ff7be0f9d499461de0f42da302fca2a43c9f..c4c3c9c19ce0d35c8d7937f5d166412872fbdf1b 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,16 +209,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
return;
}
}
@@ -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");
+ this.disconnect("Invalid block break distance", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION);
return;
}
if (this.player.level.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
@@ -1828,7 +1836,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1818,7 +1826,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 +218,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
}
// Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
@@ -1933,7 +1941,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1923,7 +1931,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 +227,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
}
}
@@ -1949,7 +1957,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1939,7 +1947,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
@ -245,7 +236,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
return;
}
}
@@ -2022,7 +2030,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2012,7 +2020,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
@ -254,7 +245,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
return null;
}
};
@@ -2037,7 +2045,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2027,7 +2035,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
throw new RuntimeException(e);
}
} else {
@ -263,7 +254,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
}
// CraftBukkit end
}
@@ -2310,7 +2318,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2300,7 +2308,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Spigot Start
if ( entity == this.player && !this.player.isSpectator() )
{
@ -272,7 +263,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
return;
}
// Spigot End
@@ -2401,7 +2409,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2391,7 +2399,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
// CraftBukkit end
} else {
@ -281,7 +272,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
}
@@ -2801,7 +2809,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2791,7 +2799,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 +281,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
return;
}
}
@@ -2989,7 +2997,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2979,7 +2987,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 +290,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
});
// Paper end
}
@@ -3035,7 +3043,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3025,7 +3033,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -308,7 +299,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
}
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try {
@@ -3045,7 +3053,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 unregister custom payload", ex);
@ -317,7 +308,7 @@ index a0038eed3a88b4965c406ca4c36e93d127631e77..b98c0150be40c8774530dc064c6f2ca3
}
} else {
try {
@@ -3063,7 +3071,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3053,7 +3061,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);
@ -351,7 +342,7 @@ index fffb31c761625b803ac397799af890df84f26951..65657c009f6d5a5d5740e80f912a5893
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c283d1cb8ba22ba87de1433cbbbcf1d0075a1151..7b8885f48245c37ba7166abd44486027779e134e 100644
index 26ffc901c3a57cb0d85982083d2b0eb6e0f26b69..9f8f3ad5fd2c9e43a5b99804e404f11e5056897f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -499,16 +499,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

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 e39ac447c91849ccaa8c6911f740651a88fe0a35..a917452aa36ec34cbe960d1dd7b9efc43a9d26b8 100644
index 98a77dfce1f24751b77b6a1dc6f2b040819f2a6d..52c9678d8f97a163f3bd1430b51ae031536f5869 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2214,7 +2214,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2204,7 +2204,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 a917452aa36ec34cbe960d1dd7b9efc43a9d26b8..45b57cbd619cec8a77014f977df9778f0ff88917 100644
index 52c9678d8f97a163f3bd1430b51ae031536f5869..68c3d744717cef8eeb16d640877157340a45e81c 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 a917452aa36ec34cbe960d1dd7b9efc43a9d26b8..45b57cbd619cec8a77014f977df9778f
this.connection.setReadOnly();
MinecraftServer minecraftserver = this.server;
Connection networkmanager = this.connection;
@@ -1861,6 +1861,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1851,6 +1851,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override
public void onDisconnect(Component reason) {
@ -29,7 +29,7 @@ index a917452aa36ec34cbe960d1dd7b9efc43a9d26b8..45b57cbd619cec8a77014f977df9778f
// CraftBukkit start - Rarely it would send a disconnect line twice
if (this.processedDisconnect) {
return;
@@ -1877,7 +1882,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1867,7 +1872,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.disconnect();
// Paper start - Adventure