Archiviert
13
0

Added 1.19 kick event causes (#8204)

Dieser Commit ist enthalten in:
Jake Potrebic 2022-07-29 09:31:02 -07:00 committet von GitHub
Ursprung 3b895f36fd
Commit e5bbb56ac6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
16 geänderte Dateien mit 146 neuen und 80 gelöschten Zeilen

Datei anzeigen

@ -24,7 +24,7 @@ index ae009440a7b1e073f3772b1c3d91b6ae6fca0495..0a400ecdffa18eb836fed62961f151ff
/** /**
diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
index efbf4b657c99ce3a5096d041d275af9ccaea7911..b76966953753dabcb31293846d39a4b4d5ef472a 100644 index efbf4b657c99ce3a5096d041d275af9ccaea7911..449f2dccd466ba5f220148a20a03b36a2a565d9b 100644
--- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
@@ -12,6 +12,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { @@ -12,6 +12,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
@ -61,7 +61,7 @@ index efbf4b657c99ce3a5096d041d275af9ccaea7911..b76966953753dabcb31293846d39a4b4
} }
/** /**
@@ -132,4 +144,65 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { @@ -132,4 +144,73 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
public static HandlerList getHandlerList() { public static HandlerList getHandlerList() {
return handlers; return handlers;
} }
@ -110,6 +110,14 @@ index efbf4b657c99ce3a5096d041d275af9ccaea7911..b76966953753dabcb31293846d39a4b4
+ +
+ ILLEGAL_CHARACTERS, + ILLEGAL_CHARACTERS,
+ +
+ OUT_OF_ORDER_CHAT,
+
+ UNSIGNED_CHAT,
+
+ CHAT_VALIDATION_FAILED,
+
+ TOO_MANY_PENDING_CHATS,
+
+ SELF_INTERACTION, + SELF_INTERACTION,
+ +
+ DUPLICATE_LOGIN, + DUPLICATE_LOGIN,

Datei anzeigen

@ -57,7 +57,7 @@ index 65637a33ba171a4b598f70cd943d24b0ee44a69f..57a9146bf2dee7a60aab16716e25348f
} }
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 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72ff08aad83 100644 index 2217d9b3bb589278da5b421ffce9e00261d08469..26b0bc810b4b09df9c910e3b8b49c18ddd65f832 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
@@ -372,7 +372,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -372,7 +372,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -96,33 +96,37 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
} }
this.chatPreviewThrottler.tick(); this.chatPreviewThrottler.tick();
@@ -469,14 +469,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -467,16 +467,26 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return this.server.isSingleplayerOwner(this.player.getGameProfile());
}
+ @io.papermc.paper.annotation.DoNotUse // Paper
public void disconnect(String s) { public void disconnect(String s) {
// Paper start // Paper start
- this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); - this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s));
+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); + this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
+ }
+
+ public void disconnect(String s, PlayerKickEvent.Cause cause) {
+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), cause);
} }
+ public void disconnect(String s, PlayerKickEvent.Cause cause) {
+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), cause);
+ }
+
+ @io.papermc.paper.annotation.DoNotUse // Paper
public void disconnect(final Component reason) { public void disconnect(final Component reason) {
- this.disconnect(PaperAdventure.asAdventure(reason)); - this.disconnect(PaperAdventure.asAdventure(reason));
+ this.disconnect(PaperAdventure.asAdventure(reason), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); + this.disconnect(PaperAdventure.asAdventure(reason), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
+ }
+
+ public void disconnect(final Component reason, PlayerKickEvent.Cause cause) {
+ this.disconnect(PaperAdventure.asAdventure(reason), cause);
} }
- public void disconnect(net.kyori.adventure.text.Component reason) { - public void disconnect(net.kyori.adventure.text.Component reason) {
+ public void disconnect(final Component reason, PlayerKickEvent.Cause cause) {
+ this.disconnect(PaperAdventure.asAdventure(reason), cause);
+ }
+
+ public void disconnect(net.kyori.adventure.text.Component reason, org.bukkit.event.player.PlayerKickEvent.Cause cause) { + public void disconnect(net.kyori.adventure.text.Component reason, org.bukkit.event.player.PlayerKickEvent.Cause cause) {
// Paper end // Paper end
// CraftBukkit start - fire PlayerKickEvent // CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) { if (this.processedDisconnect) {
@@ -505,7 +513,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -505,7 +515,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
@ -131,7 +135,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
if (this.cserver.getServer().isRunning()) { if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
@@ -575,7 +583,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -575,7 +585,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) { public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) { if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) {
@ -140,7 +144,16 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
} else { } else {
Entity entity = this.player.getRootVehicle(); Entity entity = this.player.getRootVehicle();
@@ -826,13 +834,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -773,7 +783,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) {
- this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"));
+ this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
return;
}
@@ -826,13 +836,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async
// CraftBukkit start // CraftBukkit start
if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
@ -156,7 +169,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
return; return;
} }
// Paper end // Paper end
@@ -985,7 +993,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -985,7 +995,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Paper start - validate pick item position // Paper start - validate pick item position
if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) { if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {
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());
@ -165,7 +178,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
return; return;
} }
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
@@ -1172,7 +1180,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1172,7 +1182,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
if (byteLength > 256 * 4) { if (byteLength > 256 * 4) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
@ -174,7 +187,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
return; return;
} }
byteTotal += byteLength; byteTotal += byteLength;
@@ -1195,14 +1203,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1195,14 +1205,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (byteTotal > byteAllowed) { if (byteTotal > byteAllowed) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
@ -191,16 +204,16 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
return; return;
} }
this.lastBookTick = MinecraftServer.currentTick; this.lastBookTick = MinecraftServer.currentTick;
@@ -1326,7 +1334,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1326,7 +1336,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handleMovePlayer(ServerboundMovePlayerPacket packet) { public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) { if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
- this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement")); - this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"));
+ this.disconnect(Component.translatable(("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT)); // Paper - kick event cause + this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
} else { } else {
ServerLevel worldserver = this.player.getLevel(); ServerLevel worldserver = this.player.getLevel();
@@ -1753,7 +1761,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1753,7 +1763,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.dropCount++; this.dropCount++;
if (this.dropCount >= 20) { if (this.dropCount >= 20) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
@ -209,7 +222,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
return; return;
} }
} }
@@ -1961,7 +1969,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1961,7 +1971,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
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 +231,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
} }
// Paper start // Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()]; PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
@@ -2074,7 +2082,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2074,7 +2084,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
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 +240,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
} }
} }
@@ -2087,7 +2095,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2087,7 +2097,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
// CraftBukkit end // CraftBukkit end
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) { if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) {
@ -236,7 +249,34 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
} else { } else {
if (this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages())) { if (this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages())) {
// this.server.submit(() -> { // CraftBukkit - async chat // this.server.submit(() -> { // CraftBukkit - async chat
@@ -2477,7 +2485,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2115,7 +2125,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleChatCommand(ServerboundChatCommandPacket packet) {
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) {
- this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
+ this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper
} else {
if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) {
this.server.submit(() -> {
@@ -2201,7 +2211,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
if (!this.updateChatOrder(timestamp)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message);
- this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"));
+ this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event cause
return false;
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
@@ -2450,7 +2460,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
ChatSender chatsender = this.player.asChatSender();
if (chatsender.profilePublicKey() != null && !message.verify(chatsender)) {
- this.disconnect(Component.translatable("multiplayer.disconnect.unsigned_chat"));
+ this.disconnect(Component.translatable("multiplayer.disconnect.unsigned_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event cause
return false;
} else {
if (message.hasExpiredServer(Instant.now())) {
@@ -2477,7 +2487,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// this.chatSpamTickCount += 20; // this.chatSpamTickCount += 20;
if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
// CraftBukkit end // CraftBukkit end
@ -245,7 +285,25 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
} }
} }
@@ -2739,7 +2747,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2577,7 +2587,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private void handleValidationFailure(Set<LastSeenMessagesValidator.ErrorCondition> reasons) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message from {}, reasons: {}", this.player.getName().getString(), reasons.stream().map(LastSeenMessagesValidator.ErrorCondition::message).collect(Collectors.joining(",")));
- this.disconnect(Component.translatable("multiplayer.disconnect.chat_validation_failed"));
+ this.disconnect(Component.translatable("multiplayer.disconnect.chat_validation_failed"), org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event cause
}
@Override
@@ -2724,7 +2734,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
if (i > 4096) {
- this.disconnect(Component.translatable("multiplayer.disconnect.too_many_pending_chats"));
+ this.disconnect(Component.translatable("multiplayer.disconnect.too_many_pending_chats"), org.bukkit.event.player.PlayerKickEvent.Cause.TOO_MANY_PENDING_CHATS); // Paper - kick event cause
}
}
@@ -2739,7 +2749,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Spigot Start // Spigot Start
if ( entity == this.player && !this.player.isSpectator() ) if ( entity == this.player && !this.player.isSpectator() )
{ {
@ -254,7 +312,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
return; return;
} }
// Spigot End // Spigot End
@@ -2832,7 +2840,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2832,7 +2842,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
// CraftBukkit end // CraftBukkit end
} else { } else {
@ -263,7 +321,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
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());
} }
} }
@@ -3240,7 +3248,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3240,7 +3250,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Paper start // Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) { if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
@ -272,7 +330,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
return; return;
} }
} }
@@ -3443,7 +3451,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3443,7 +3453,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} 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(() -> {
@ -281,7 +339,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
}); });
// Paper end // Paper end
} }
@@ -3489,7 +3497,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3489,7 +3499,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -290,7 +348,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
} }
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try { try {
@@ -3499,7 +3507,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3499,7 +3509,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -299,7 +357,7 @@ index 2217d9b3bb589278da5b421ffce9e00261d08469..d19ca87b0819d281cc36d812ce01b72f
} }
} else { } else {
try { try {
@@ -3517,7 +3525,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3517,7 +3527,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
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);
@ -333,7 +391,7 @@ index bdb37391b9df7ec4983728de8324aa3f1ed20f4b..ca0ad4fd5f4aafacd197494970f2aec3
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 60024a387429a13593f7f709004282d27678cbbe..d72e5c06ab4f34742ec74448d1cad892048f159b 100644 index 7d030d7a8a58f4a031e09d09c9718af3d3c1e707..140730ff3e10066d19321c75e241a1e0d8d3ba17 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -516,7 +516,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -516,7 +516,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main
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 a768e09c5ce6718435b50f1502c5ace773fff470..dfe1966bfb30b3d2e60e6b88d0a7c2331b02e9a4 100644 index 5cb42f3ec712bec46d76684e8e0a3f0f547d2586..685745b853f86fa2eda031ad20317ad321b1379a 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
@@ -1210,7 +1210,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1212,7 +1212,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Paper end // Paper end
// CraftBukkit start // CraftBukkit start
if (this.lastBookTick + 20 > MinecraftServer.currentTick) { if (this.lastBookTick + 20 > MinecraftServer.currentTick) {

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 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7727749b09ef5a4bf5ea51f12befd3c106f3a56f..7c9f4f7b0687dcd04eee24464c2902f931552aba 100644 index 685745b853f86fa2eda031ad20317ad321b1379a..c65c72a2dd3c87621c1369c52770b912057eafd2 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
@@ -2616,7 +2616,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2618,7 +2618,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
// Arm swing animation // Arm swing animation

Datei anzeigen

@ -17,10 +17,10 @@ index 6e53214042ab515d9c66fb24f6aa1c07d6c3539d..7670c02dca163d360e64a1491f2efe69
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
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 781c3abc7693ef1e310c963d154f312b06d9c392..bc20661f3b70f1e769d6be5f2a8bbb81cd7b2dca 100644 index c65c72a2dd3c87621c1369c52770b912057eafd2..bd152bdb0e00b807c514f601ec400a1aa7e8413d 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
@@ -523,7 +523,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -525,7 +525,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Do not kick the player // Do not kick the player
return; return;
} }
@ -28,7 +28,7 @@ index 781c3abc7693ef1e310c963d154f312b06d9c392..bc20661f3b70f1e769d6be5f2a8bbb81
// Send the possibly modified leave message // Send the possibly modified leave message
final Component ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure final Component ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end // CraftBukkit end
@@ -532,7 +531,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -534,7 +533,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> { this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
this.connection.disconnect(ichatbasecomponent); this.connection.disconnect(ichatbasecomponent);
})); }));
@ -37,7 +37,7 @@ index 781c3abc7693ef1e310c963d154f312b06d9c392..bc20661f3b70f1e769d6be5f2a8bbb81
this.connection.setReadOnly(); this.connection.setReadOnly();
MinecraftServer minecraftserver = this.server; MinecraftServer minecraftserver = this.server;
Connection networkmanager = this.connection; Connection networkmanager = this.connection;
@@ -1994,6 +1993,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1996,6 +1995,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override @Override
public void onDisconnect(Component reason) { public void onDisconnect(Component reason) {
@ -49,7 +49,7 @@ index 781c3abc7693ef1e310c963d154f312b06d9c392..bc20661f3b70f1e769d6be5f2a8bbb81
// 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;
@@ -2010,7 +2014,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2012,7 +2016,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player.disconnect(); this.player.disconnect();
// Paper start - Adventure // Paper start - Adventure
@ -59,7 +59,7 @@ index 781c3abc7693ef1e310c963d154f312b06d9c392..bc20661f3b70f1e769d6be5f2a8bbb81
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false); this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
// Paper end // Paper end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 69af47c070806ae410a2f4c80c121f48689f56bc..387158d5aad22e0da186e1087364d8a990aadd23 100644 index ca0ad4fd5f4aafacd197494970f2aec3b2a6c4d0..0354b7e20bbc9f888cf85d6db42ce2b64a25b4c2 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -592,6 +592,11 @@ public abstract class PlayerList { @@ -592,6 +592,11 @@ public abstract class PlayerList {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when
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 e8cd8adad14c6bcab3ccef7fcc458b38d90592c3..ac09598d2152b5dc9be004a6088ed65f3d1d6f59 100644 index 1f5ccfd997392d010a9375b87f01e5a248802acc..331c700ec85d84417bf734f30a3870659c5da2e9 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
@@ -844,6 +844,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -846,6 +846,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
// Paper end // Paper end
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Optimise collision checking in player move packet handling
Move collision logic to just the hasNewCollision call instead of getCubes + hasNewCollision Move collision logic to just the hasNewCollision call instead of getCubes + hasNewCollision
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 ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e195824110e018 100644 index 331c700ec85d84417bf734f30a3870659c5da2e9..abd9ee4c2cddf0fd1e31bffbb60db025491e8315 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
@@ -656,7 +656,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -658,7 +658,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return; return;
} }
@ -18,7 +18,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582
d6 = d3 - this.vehicleLastGoodX; // Paper - diff on change, used for checking large move vectors above d6 = d3 - this.vehicleLastGoodX; // Paper - diff on change, used for checking large move vectors above
d7 = d4 - this.vehicleLastGoodY - 1.0E-6D; // Paper - diff on change, used for checking large move vectors above d7 = d4 - this.vehicleLastGoodY - 1.0E-6D; // Paper - diff on change, used for checking large move vectors above
@@ -664,6 +664,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -666,6 +666,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
boolean flag1 = entity.verticalCollisionBelow; boolean flag1 = entity.verticalCollisionBelow;
entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); entity.move(MoverType.PLAYER, new Vec3(d6, d7, d8));
@ -26,7 +26,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582
double d11 = d7; double d11 = d7;
d6 = d3 - entity.getX(); d6 = d3 - entity.getX();
@@ -677,16 +678,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -679,16 +680,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
boolean flag2 = false; boolean flag2 = false;
if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
@ -54,7 +54,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582
entity.absMoveTo(d0, d1, d2, f, f1); entity.absMoveTo(d0, d1, d2, f, f1);
this.player.absMoveTo(d0, d1, d2, this.player.getYRot(), this.player.getXRot()); // CraftBukkit this.player.absMoveTo(d0, d1, d2, this.player.getYRot(), this.player.getXRot()); // CraftBukkit
this.connection.send(new ClientboundMoveVehiclePacket(entity)); this.connection.send(new ClientboundMoveVehiclePacket(entity));
@@ -772,7 +781,32 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -774,7 +783,32 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
private boolean noBlocksAround(Entity entity) { private boolean noBlocksAround(Entity entity) {
@ -88,7 +88,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582
} }
@Override @Override
@@ -1348,7 +1382,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1350,7 +1384,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
if (this.awaitingPositionFromClient != null) { if (this.awaitingPositionFromClient != null) {
@ -97,7 +97,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582
this.awaitingTeleportTime = this.tickCount; this.awaitingTeleportTime = this.tickCount;
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
} }
@@ -1442,7 +1476,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1444,7 +1478,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
} }
@ -106,7 +106,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582
d7 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above d7 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above
d8 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above d8 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above
@@ -1483,6 +1517,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1485,6 +1519,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
boolean flag1 = this.player.verticalCollisionBelow; boolean flag1 = this.player.verticalCollisionBelow;
this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9)); this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9));
@ -114,7 +114,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move
// Paper start - prevent position desync // Paper start - prevent position desync
if (this.awaitingPositionFromClient != null) { if (this.awaitingPositionFromClient != null) {
@@ -1502,12 +1537,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1504,12 +1539,23 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
boolean flag2 = false; boolean flag2 = false;
if (!this.player.isChangingDimension() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot if (!this.player.isChangingDimension() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot
@ -140,7 +140,7 @@ index ac09598d2152b5dc9be004a6088ed65f3d1d6f59..e31f1fc855da5dcde77f0bced4e19582
this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet(), false); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet. this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet(), false); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
} else { } else {
// CraftBukkit start - fire PlayerMoveEvent // CraftBukkit start - fire PlayerMoveEvent
@@ -1593,6 +1639,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1595,6 +1641,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
} }

Datei anzeigen

@ -7,10 +7,10 @@ Makes the PlayerKickEvent fire on the main thread for
illegal characters or chat out-of-order errors. illegal characters or chat out-of-order errors.
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 e31f1fc855da5dcde77f0bced4e195824110e018..9a719ee2f2e1394458da2d459b4bc434e06786cd 100644 index abd9ee4c2cddf0fd1e31bffbb60db025491e8315..067b18932a39a97cd13b59d43350c1fe7239a3da 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
@@ -2171,7 +2171,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2173,7 +2173,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
// CraftBukkit end // CraftBukkit end
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) { if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) {
@ -20,22 +20,22 @@ index e31f1fc855da5dcde77f0bced4e195824110e018..9a719ee2f2e1394458da2d459b4bc434
} else { } else {
if (this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages())) { if (this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages())) {
// this.server.submit(() -> { // CraftBukkit - async chat // this.server.submit(() -> { // CraftBukkit - async chat
@@ -2199,7 +2201,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2201,7 +2203,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override @Override
public void handleChatCommand(ServerboundChatCommandPacket packet) { public void handleChatCommand(ServerboundChatCommandPacket packet) {
if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) { if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) {
+ this.server.scheduleOnMain(() -> { // Paper - push to main for event firing + this.server.scheduleOnMain(() -> { // Paper - push to main for event firing
this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters")); this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper
+ }); // Paper - push to main for event firing + }); // Paper - push to main for event firing
} else { } else {
if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) { if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) {
this.server.submit(() -> { this.server.submit(() -> {
@@ -2285,7 +2289,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2287,7 +2291,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) { private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
if (!this.updateChatOrder(timestamp)) { if (!this.updateChatOrder(timestamp)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message); ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message);
+ this.server.scheduleOnMain(() -> { // Paper - push to main + this.server.scheduleOnMain(() -> { // Paper - push to main
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat")); this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event cause
+ }); // Paper - push to main + }); // Paper - push to main
return false; return false;
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales

Datei anzeigen

@ -7,10 +7,10 @@ Bring the vehicle move packet behavior in line with the
regular player move packet. regular player move packet.
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 9a719ee2f2e1394458da2d459b4bc434e06786cd..8ac6bba7a4427733f9f03835480fd574fe17dd93 100644 index 067b18932a39a97cd13b59d43350c1fe7239a3da..55bf584ace138e6df855c011f1fb44dbdc0e7d98 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
@@ -586,6 +586,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -588,6 +588,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} else { } else {
Entity entity = this.player.getRootVehicle(); Entity entity = this.player.getRootVehicle();

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity copies loading chunks
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 a73f7e62de04f8e9556014c2a7c33b20220a38de..f72402cc1fef02f72b4b0dfda1c01d1d0774205b 100644 index 55bf584ace138e6df855c011f1fb44dbdc0e7d98..9507988d7650204b6ae0137bc0b8bcd486a83028 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
@@ -3391,7 +3391,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3393,7 +3393,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound); BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
if (this.player.level.isLoaded(blockposition)) { if (this.player.level.isLoaded(blockposition)) {

Datei anzeigen

@ -18,10 +18,10 @@ index 20670bc075c387ee0422eb1014207e26105efccd..bdd6560fe85950b0a857a949cb38c044
if (dedicatedserverproperties.enableQuery) { if (dedicatedserverproperties.enableQuery) {
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 f72402cc1fef02f72b4b0dfda1c01d1d0774205b..a480c1a64d6d22f973ab1b4399816610da836101 100644 index 9507988d7650204b6ae0137bc0b8bcd486a83028..de6bbe320c32b512bd995a86c782a25cd1b770d8 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
@@ -2987,7 +2987,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2989,7 +2989,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
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()) {
this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Do not accept invalid client settings
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 a480c1a64d6d22f973ab1b4399816610da836101..ca066bb34e4bbad587b1ecb07f06958742082c64 100644 index de6bbe320c32b512bd995a86c782a25cd1b770d8..a54ea66d2c85fc82075bb8c27b34e2d1407e8375 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
@@ -3570,6 +3570,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -3572,6 +3572,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override @Override
public void handleClientInformation(ServerboundClientInformationPacket packet) { public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Don't print component in resource pack rejection message
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 c5278cc28eaba16d6adc31fc5f276e0c972fd8dc..ea47d8f0275a99920c6e3f5c7a9c09ccb2341139 100644 index a54ea66d2c85fc82075bb8c27b34e2d1407e8375..c00443e73cd31f79679f8e4ba45a6f551349bb85 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
@@ -2045,7 +2045,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2047,7 +2047,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handleResourcePackResponse(ServerboundResourcePackPacket packet) { public void handleResourcePackResponse(ServerboundResourcePackPacket packet) {
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()) {

Datei anzeigen

@ -6,19 +6,19 @@ Subject: [PATCH] Add some minimal debug information to chat packet errors
TODO: potentially add some kick leeway TODO: potentially add some kick leeway
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 ad083a1e57e15568d05f54f5606f7c9b355c1927..66fa86f67a835b7a4c2de6c5111367d1ab6034fb 100644 index c00443e73cd31f79679f8e4ba45a6f551349bb85..cdf7ed204cf6216337ab9667158b33143c82a819 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
@@ -2294,7 +2294,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2296,7 +2296,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) { private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
if (!this.updateChatOrder(timestamp)) { if (!this.updateChatOrder(timestamp)) {
- ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message); - ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message);
+ ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}': {} > {}", this.player.getName().getString(), message, this.lastChatTimeStamp.get().getEpochSecond(), timestamp.getEpochSecond()); // Paper + ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}': {} > {}", this.player.getName().getString(), message, this.lastChatTimeStamp.get().getEpochSecond(), timestamp.getEpochSecond()); // Paper
this.server.scheduleOnMain(() -> { // Paper - push to main this.server.scheduleOnMain(() -> { // Paper - push to main
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat")); this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event cause
}); // Paper - push to main }); // Paper - push to main
@@ -2550,7 +2550,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2552,7 +2552,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return false; return false;
} else { } else {
if (message.hasExpiredServer(Instant.now())) { if (message.hasExpiredServer(Instant.now())) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix Spigot Config not using commands.spam-exclusions
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 66fa86f67a835b7a4c2de6c5111367d1ab6034fb..309fce97cff8ec60c4734e61c0572897927539b4 100644 index cdf7ed204cf6216337ab9667158b33143c82a819..72864ca3f0fa94512d7f57b4e05929be7d2912cd 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
@@ -2571,7 +2571,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -2573,7 +2573,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
// Spigot end // Spigot end
// this.chatSpamTickCount += 20; // this.chatSpamTickCount += 20;

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] More Teleport API
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 309fce97cff8ec60c4734e61c0572897927539b4..a14710afaabf2b3b43f18ebe52eec8befff2b4ed 100644 index 72864ca3f0fa94512d7f57b4e05929be7d2912cd..2fe2336a9dd307dbd92cbf9472ffe698515f5ee9 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
@@ -1726,11 +1726,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -1728,11 +1728,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return false; // CraftBukkit - Return event status return false; // CraftBukkit - Return event status
} }
@ -69,7 +69,7 @@ index 2a6c67634c31c332102d24bef293da1bacd0c000..b80cc0938b2b3928f4450f1314a9fbd7
// Let the server handle cross world teleports // Let the server handle cross world teleports
if (location.getWorld() != null && !location.getWorld().equals(this.getWorld())) { if (location.getWorld() != null && !location.getWorld().equals(this.getWorld())) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6acac39e4fe5a9303ee2bd8356633b5173de55af..9b5eb67b085c706acbf38278abacc1cd0c01d388 100644 index f74802748438f4d40fb5ab772a209dfb2ee406e6..d2249145046d728240cf1ae0b71c9ec16184bc18 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1135,7 +1135,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1135,7 +1135,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {