From 2782b0c375a1bb90f46a02f17cb3aacc7244473b Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 5 Aug 2022 15:58:34 -0700 Subject: [PATCH] 1.19.2 (#8250) --- README.md | 4 +- build.gradle.kts | 2 +- gradle.properties | 4 +- patches/api/Convert-project-to-Gradle.patch | 2 +- .../server/Add-PlayerKickEvent-causes.patch | 16 ++-- .../Add-Velocity-IP-Forwarding-Support.patch | 4 +- ...-debug-information-to-chat-packet-er.patch | 18 ++-- patches/server/Adventure.patch | 94 ++++++++++--------- ...trolled-flushing-for-network-manager.patch | 26 ++--- patches/server/Basic-PlayerProfile-API.patch | 18 ---- ...l-to-changed-postToMainThread-method.patch | 2 +- .../Kick-on-main-for-illegal-chat.patch | 2 +- .../Optimise-non-flush-packet-sending.patch | 8 +- ...-Manager-and-add-advanced-packet-sup.patch | 14 +-- ...e-invalid-signature-login-stacktrace.patch | 8 +- patches/server/Setup-Gradle-project.patch | 2 +- work/BuildData | 2 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 20 files changed, 108 insertions(+), 124 deletions(-) diff --git a/README.md b/README.md index 4c039fb1e8..81900c34ce 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ How To (Plugin Developers) io.papermc.paper paper-api - 1.19.1-R0.1-SNAPSHOT + 1.19.2-R0.1-SNAPSHOT provided ``` @@ -54,7 +54,7 @@ repositories { } dependencies { - compileOnly("io.papermc.paper:paper-api:1.19.1-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT") } java { diff --git a/build.gradle.kts b/build.gradle.kts index 9493c04570..5341c25fbe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -61,7 +61,7 @@ repositories { } dependencies { - paramMappings("net.fabricmc:yarn:1.19.1+build.1:mergedv2") + paramMappings("net.fabricmc:yarn:1.19.2+build.1:mergedv2") remapper("net.fabricmc:tiny-remapper:0.8.2:fat") decompiler("net.minecraftforge:forgeflower:1.5.605.7") spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.6") diff --git a/gradle.properties b/gradle.properties index 8f428ef076..d2cf8c41f7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ group=io.papermc.paper -version=1.19.1-R0.1-SNAPSHOT -mcVersion=1.19.1 +version=1.19.2-R0.1-SNAPSHOT +mcVersion=1.19.2 org.gradle.caching=true org.gradle.parallel=true diff --git a/patches/api/Convert-project-to-Gradle.patch b/patches/api/Convert-project-to-Gradle.patch index 1fe86a83ca..f903c5dda2 100644 --- a/patches/api/Convert-project-to-Gradle.patch +++ b/patches/api/Convert-project-to-Gradle.patch @@ -125,7 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - org.spigotmc - spigot-api -- 1.19.1-R0.1-SNAPSHOT +- 1.19.2-R0.1-SNAPSHOT - jar - - Spigot-API diff --git a/patches/server/Add-PlayerKickEvent-causes.patch b/patches/server/Add-PlayerKickEvent-causes.patch index a92d3bedda..b2f60b98d8 100644 --- a/patches/server/Add-PlayerKickEvent-causes.patch +++ b/patches/server/Add-PlayerKickEvent-causes.patch @@ -259,7 +259,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) { this.server.submit(() -> { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - // Paper end + 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")); @@ -268,14 +268,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } 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)); @@ -0,0 +0,0 @@ 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())) { + if (!playerchatmessage.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; + } + } @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // this.chatSpamTickCount += 20; if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { diff --git a/patches/server/Add-Velocity-IP-Forwarding-Support.patch b/patches/server/Add-Velocity-IP-Forwarding-Support.patch index f0ef7e9bab..d4bf0ceb84 100644 --- a/patches/server/Add-Velocity-IP-Forwarding-Support.patch +++ b/patches/server/Add-Velocity-IP-Forwarding-Support.patch @@ -166,9 +166,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + final ProfilePublicKey.Data forwardedKey = com.destroystokyo.paper.proxy.VelocityProxy.readForwardedKey(buf); + if (this.profilePublicKeyData == null) { + try { -+ ProfilePublicKey.createValidated(this.server.getServiceSignatureValidator(), this.gameProfile.getId(), forwardedKey); ++ ProfilePublicKey.createValidated(this.server.getServiceSignatureValidator(), this.gameProfile.getId(), forwardedKey, Duration.ZERO); + this.profilePublicKeyData = forwardedKey; -+ } catch (CryptException e) { ++ } catch (ProfilePublicKey.ValidationException e) { + this.disconnect("Unable to validate forwarded player key"); + } + } diff --git a/patches/server/Add-some-minimal-debug-information-to-chat-packet-er.patch b/patches/server/Add-some-minimal-debug-information-to-chat-packet-er.patch index 977592cdb6..1a89e85e7a 100644 --- a/patches/server/Add-some-minimal-debug-information-to-chat-packet-er.patch +++ b/patches/server/Add-some-minimal-debug-information-to-chat-packet-er.patch @@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } - // Paper end + + 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); + ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}': {} > {}", this.player.getName().getString(), message, this.lastChatTimeStamp.get().getEpochSecond(), timestamp.getEpochSecond()); // Paper @@ -19,11 +19,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - return false; - } else { - if (message.hasExpiredServer(Instant.now())) { -- ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized?", this.player.getName().getString(), message.signedContent().plain()); -+ ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized? c: {} s: {}", this.player.getName().getString(), message.signedContent().plain(), message.timeStamp().getEpochSecond(), Instant.now().getEpochSecond()); // Paper - } + } - return true; + if (playerchatmessage.hasExpiredServer(Instant.now())) { +- ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized?", this.player.getName().getString(), playerchatmessage.signedContent().plain()); ++ ServerGamePacketListenerImpl.LOGGER.warn("{} sent expired chat: '{}'. Is the client/server system time unsynchronized? c: {} s: {}", this.player.getName().getString(), playerchatmessage.signedContent().plain(), playerchatmessage.timeStamp().getEpochSecond(), Instant.now().getEpochSecond()); // Paper + } + + return true; diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 0152d895b3..8429b9f8c7 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -1510,6 +1510,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @io.papermc.paper.annotation.DoNotUse // Paper CompletableFuture decorate(@Nullable ServerPlayer sender, Component message); ++ @io.papermc.paper.annotation.DoNotUse // Paper + default CompletableFuture decorate(@Nullable ServerPlayer sender, PlayerChatMessage message) { +- return message.signedContent().isDecorated() ? CompletableFuture.completedFuture(message) : this.decorate(sender, message.serverContent()).thenApply(message::withUnsignedContent); ++ return this.decorate(sender, null, message); // Paper + } + + // Paper start + default CompletableFuture decorate(@Nullable ServerPlayer sender, @Nullable net.minecraft.commands.CommandSourceStack commandSourceStack, Component message, boolean isPreview) { + throw new UnsupportedOperationException("Must override this implementation"); @@ -1576,16 +1582,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return new PlayerChatMessage(playerChatMessage.signedHeader(), playerChatMessage.headerSignature(), playerChatMessage.signedBody().withContent(playerChatMessage.signedContent().withDecorationResult(result)), playerChatMessage.unsignedContent(), playerChatMessage.filterMask()).withUnsignedContent(result.component()); + }); + } -+ + // Paper end + -+ @io.papermc.paper.annotation.DoNotUse // Paper - default CompletableFuture decorate(@Nullable ServerPlayer serverPlayer, PlayerChatMessage playerChatMessage) { -- return playerChatMessage.signedContent().isDecorated() ? CompletableFuture.completedFuture(playerChatMessage) : this.decorate(serverPlayer, playerChatMessage.serverContent()).thenApply(playerChatMessage::withUnsignedContent); -+ return this.decorate(serverPlayer, null, playerChatMessage); // Paper + static PlayerChatMessage attachIfNotDecorated(PlayerChatMessage message, Component attached) { + return !message.signedContent().isDecorated() ? message.withUnsignedContent(attached) : message; } - - static PlayerChatMessage attachIfNotDecorated(PlayerChatMessage playerChatMessage, Component component) { diff --git a/src/main/java/net/minecraft/network/chat/ChatMessageContent.java b/src/main/java/net/minecraft/network/chat/ChatMessageContent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/chat/ChatMessageContent.java @@ -1694,49 +1695,50 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/network/chat/OutgoingPlayerChatMessage.java +++ b/src/main/java/net/minecraft/network/chat/OutgoingPlayerChatMessage.java @@ -0,0 +0,0 @@ public interface OutgoingPlayerChatMessage { - Component serverContent(); - void sendToPlayer(ServerPlayer serverPlayer, boolean bl, ChatType.Bound bound); + void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params); + + // Paper start -+ default void sendToPlayer(ServerPlayer serverPlayer, boolean shouldFilter, ChatType.Bound bound, @javax.annotation.Nullable Component unsigned) { -+ this.sendToPlayer(serverPlayer, shouldFilter, bound); ++ default void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params, @javax.annotation.Nullable Component unsigned) { ++ this.sendToPlayer(sender, filterMaskEnabled, params); + } + // Paper end - ++ void sendHeadersToRemainingPlayers(PlayerList playerManager); + static OutgoingPlayerChatMessage create(PlayerChatMessage message) { @@ -0,0 +0,0 @@ public interface OutgoingPlayerChatMessage { @Override - public void sendToPlayer(ServerPlayer serverPlayer, boolean bl, ChatType.Bound bound) { + public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params) { + // Paper start -+ this.sendToPlayer(serverPlayer, bl, bound, null); ++ this.sendToPlayer(sender, filterMaskEnabled, params, null); + } + + @Override -+ public void sendToPlayer(ServerPlayer serverPlayer, boolean bl, ChatType.Bound bound, @javax.annotation.Nullable Component unsigned) { ++ public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params, @javax.annotation.Nullable Component unsigned) { + // Paper end - PlayerChatMessage playerChatMessage = this.message.filter(bl); + PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled); + playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper if (!playerChatMessage.isFullyFiltered()) { - RegistryAccess registryAccess = serverPlayer.level.registryAccess(); - ChatType.BoundNetwork boundNetwork = bound.toNetwork(registryAccess); + RegistryAccess registryAccess = sender.level.registryAccess(); + ChatType.BoundNetwork boundNetwork = params.toNetwork(registryAccess); @@ -0,0 +0,0 @@ public interface OutgoingPlayerChatMessage { @Override - public void sendToPlayer(ServerPlayer serverPlayer, boolean bl, ChatType.Bound bound) { + public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params) { + // Paper start -+ this.sendToPlayer(serverPlayer, bl, bound, null); ++ this.sendToPlayer(sender, filterMaskEnabled, params, null); + } + + @Override -+ public void sendToPlayer(ServerPlayer serverPlayer, boolean bl, ChatType.Bound bound, @javax.annotation.Nullable Component unsigned) { ++ public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params, @javax.annotation.Nullable Component unsigned) { + // Paper end - PlayerChatMessage playerChatMessage = this.message.filter(bl); + PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled); + playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper if (!playerChatMessage.isFullyFiltered()) { - this.playersWithFullMessage.add(serverPlayer); - RegistryAccess registryAccess = serverPlayer.level.registryAccess(); + this.playersWithFullMessage.add(sender); + RegistryAccess registryAccess = sender.level.registryAccess(); diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java @@ -2011,15 +2013,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { } - public void sendChatMessage(OutgoingPlayerChatMessage message, boolean flag, ChatType.Bound chatmessagetype_a) { + public void sendChatMessage(OutgoingPlayerChatMessage message, boolean filterMaskEnabled, ChatType.Bound params) { + // Paper start -+ this.sendChatMessage(message, flag, chatmessagetype_a, null); ++ this.sendChatMessage(message, filterMaskEnabled, params, null); + } -+ public void sendChatMessage(OutgoingPlayerChatMessage message, boolean flag, ChatType.Bound chatmessagetype_a, @Nullable Component unsigned) { ++ public void sendChatMessage(OutgoingPlayerChatMessage message, boolean filterMaskEnabled, ChatType.Bound params, @Nullable Component unsigned) { + // Paper end if (this.acceptsChatMessages()) { -- message.sendToPlayer(this, flag, chatmessagetype_a); -+ message.sendToPlayer(this, flag, chatmessagetype_a, unsigned); // Paper +- message.sendToPlayer(this, filterMaskEnabled, params); ++ message.sendToPlayer(this, filterMaskEnabled, params, unsigned); // Paper } } @@ -2161,7 +2163,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return packet.signedPreview() && ichatbasecomponent != null ? new ChatMessageContent(packet.message(), ichatbasecomponent, result.decoratorResult()) : new ChatMessageContent(packet.message()); // Paper end } - private void broadcastChatMessage(PlayerChatMessage playerchatmessage) { + private void broadcastChatMessage(PlayerChatMessage message) { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic private CompletableFuture queryChatPreview(String query) { @@ -2391,38 +2393,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class PlayerList { } - public void broadcastChatMessage(PlayerChatMessage playerchatmessage, ServerPlayer sender, ChatType.Bound params) { + public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound params) { + // Paper start -+ this.broadcastChatMessage(playerchatmessage, sender, params, null); ++ this.broadcastChatMessage(message, sender, params, null); + } -+ public void broadcastChatMessage(PlayerChatMessage playerchatmessage, ServerPlayer sender, ChatType.Bound params, @Nullable Function unsignedFunction) { ++ public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound params, @Nullable Function unsignedFunction) { + // Paper end Objects.requireNonNull(sender); -- this.broadcastChatMessage(playerchatmessage, sender::shouldFilterMessageTo, sender, sender.asChatSender(), params); -+ this.broadcastChatMessage(playerchatmessage, sender::shouldFilterMessageTo, sender, sender.asChatSender(), params, unsignedFunction); // Paper +- this.broadcastChatMessage(message, sender::shouldFilterMessageTo, sender, sender.asChatSender(), params); ++ this.broadcastChatMessage(message, sender::shouldFilterMessageTo, sender, sender.asChatSender(), params, unsignedFunction); // Paper } - private void broadcastChatMessage(PlayerChatMessage playerchatmessage, Predicate shouldSendFiltered, @Nullable ServerPlayer entityplayer, ChatSender chatsender, ChatType.Bound chatmessagetype_a) { + private void broadcastChatMessage(PlayerChatMessage message, Predicate shouldSendFiltered, @Nullable ServerPlayer sender, ChatSender sourceProfile, ChatType.Bound params) { + // Paper start -+ this.broadcastChatMessage(playerchatmessage, shouldSendFiltered, entityplayer, chatsender, chatmessagetype_a, null); ++ this.broadcastChatMessage(message, shouldSendFiltered, sender, sourceProfile, params, null); + } + -+ private void broadcastChatMessage(PlayerChatMessage playerchatmessage, Predicate shouldSendFiltered, @Nullable ServerPlayer entityplayer, ChatSender chatsender, ChatType.Bound chatmessagetype_a, @Nullable Function unsignedFunction) { ++ private void broadcastChatMessage(PlayerChatMessage message, Predicate shouldSendFiltered, @Nullable ServerPlayer sender, ChatSender sourceProfile, ChatType.Bound params, @Nullable Function unsignedFunction) { + // Paper end - boolean flag = this.verifyChatTrusted(playerchatmessage, chatsender); + boolean flag = this.verifyChatTrusted(message, sourceProfile); -- this.server.logChatMessage(playerchatmessage.serverContent(), chatmessagetype_a, flag ? null : "Not Secure"); -+ this.server.logChatMessage((unsignedFunction == null ? playerchatmessage : playerchatmessage.withUnsignedContent(unsignedFunction.apply(this.server.console))).serverContent(), chatmessagetype_a, flag ? null : "Not Secure"); // Paper - OutgoingPlayerChatMessage outgoingplayerchatmessage = OutgoingPlayerChatMessage.create(playerchatmessage); - boolean flag1 = playerchatmessage.isFullyFiltered(); +- this.server.logChatMessage(message.serverContent(), params, flag ? null : "Not Secure"); ++ this.server.logChatMessage((unsignedFunction == null ? message : message.withUnsignedContent(unsignedFunction.apply(this.server.console))).serverContent(), params, flag ? null : "Not Secure"); // Paper + OutgoingPlayerChatMessage outgoingplayerchatmessage = OutgoingPlayerChatMessage.create(message); + boolean flag1 = message.isFullyFiltered(); boolean flag2 = false; @@ -0,0 +0,0 @@ public abstract class PlayerList { ServerPlayer entityplayer1 = (ServerPlayer) iterator.next(); boolean flag3 = shouldSendFiltered.test(entityplayer1); -- entityplayer1.sendChatMessage(outgoingplayerchatmessage, flag3, chatmessagetype_a); -+ entityplayer1.sendChatMessage(outgoingplayerchatmessage, flag3, chatmessagetype_a, unsignedFunction == null ? null : unsignedFunction.apply(entityplayer1.getBukkitEntity())); - if (entityplayer != entityplayer1) { +- entityplayer1.sendChatMessage(outgoingplayerchatmessage, flag3, params); ++ entityplayer1.sendChatMessage(outgoingplayerchatmessage, flag3, params, unsignedFunction == null ? null : unsignedFunction.apply(entityplayer1.getBukkitEntity())); // Paper + if (sender != entityplayer1) { flag2 |= flag1 && flag3; } @@ -0,0 +0,0 @@ public abstract class PlayerList { diff --git a/patches/server/Allow-controlled-flushing-for-network-manager.patch b/patches/server/Allow-controlled-flushing-for-network-manager.patch index 5f4cd480df..1a685bd7ae 100644 --- a/patches/server/Allow-controlled-flushing-for-network-manager.patch +++ b/patches/server/Allow-controlled-flushing-for-network-manager.patch @@ -56,19 +56,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 net.minecraft.server.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() && (packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty()) ))) { -- this.sendPacket(packet, packetsendlistener); -+ this.sendPacket(packet, packetsendlistener, null); // Paper +- this.sendPacket(packet, callbacks); ++ this.sendPacket(packet, callbacks, null); // Paper return; } // write the packets to the queue, then flush - antixray hooks there already @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { } - private void sendPacket(Packet packet, @Nullable PacketSendListener packetsendlistener) { + private void sendPacket(Packet packet, @Nullable PacketSendListener callbacks) { + // Paper start - add flush parameter -+ this.sendPacket(packet, packetsendlistener, Boolean.TRUE); ++ this.sendPacket(packet, callbacks, Boolean.TRUE); + } -+ private void sendPacket(Packet packet, @Nullable PacketSendListener packetsendlistener, Boolean flushConditional) { ++ private void sendPacket(Packet packet, @Nullable PacketSendListener callbacks, Boolean flushConditional) { + this.packetWrites.getAndIncrement(); // must be befeore using canFlush + boolean effectiveFlush = flushConditional == null ? this.canFlush : flushConditional.booleanValue(); + final boolean flush = effectiveFlush || packet instanceof net.minecraft.network.protocol.game.ClientboundKeepAlivePacket || packet instanceof ClientboundDisconnectPacket; // no delay for certain packets @@ -80,22 +80,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } if (this.channel.eventLoop().inEventLoop()) { -- this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1); -+ this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter +- this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1); ++ this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper } else { this.channel.eventLoop().execute(() -> { -- this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1); -+ this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter +- this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1); ++ this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper }); } } - private void doSendPacket(Packet packet, @Nullable PacketSendListener packetsendlistener, ConnectionProtocol packetState, ConnectionProtocol currentState) { + private void doSendPacket(Packet packet, @Nullable PacketSendListener callbacks, ConnectionProtocol packetState, ConnectionProtocol currentState) { + // Paper start - add flush parameter -+ this.doSendPacket(packet, packetsendlistener, packetState, currentState, true); ++ this.doSendPacket(packet, callbacks, packetState, currentState, true); + } -+ private void doSendPacket(Packet packet, @Nullable PacketSendListener packetsendlistener, ConnectionProtocol packetState, ConnectionProtocol currentState, boolean flush) { ++ private void doSendPacket(Packet packet, @Nullable PacketSendListener callbacks, ConnectionProtocol packetState, ConnectionProtocol currentState, boolean flush) { + // Paper end - add flush parameter if (packetState != currentState) { this.setProtocol(packetState); @@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - ChannelFuture channelfuture = this.channel.writeAndFlush(packet); + ChannelFuture channelfuture = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet); // Paper - add flush parameter - if (packetsendlistener != null) { + if (callbacks != null) { channelfuture.addListener((future) -> { @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { } diff --git a/patches/server/Basic-PlayerProfile-API.patch b/patches/server/Basic-PlayerProfile-API.patch index 57e1a0926e..de9324fede 100644 --- a/patches/server/Basic-PlayerProfile-API.patch +++ b/patches/server/Basic-PlayerProfile-API.patch @@ -598,24 +598,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } - - private boolean tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) { -+ // Paper start -+ final ProfilePublicKey key = this.player.getProfilePublicKey(); -+ if (key != null && key.data().hasExpired()) { -+ this.disconnect(Component.translatable("multiplayer.disconnect.missing_public_key"), org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); -+ return false; -+ } -+ // Paper end - 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")); diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java diff --git a/patches/server/Fix-CB-call-to-changed-postToMainThread-method.patch b/patches/server/Fix-CB-call-to-changed-postToMainThread-method.patch index 1fa574255b..124b8e0420 100644 --- a/patches/server/Fix-CB-call-to-changed-postToMainThread-method.patch +++ b/patches/server/Fix-CB-call-to-changed-postToMainThread-method.patch @@ -16,4 +16,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + minecraftserver.scheduleOnMain(networkmanager::handleDisconnection); // Paper } - private CompletableFuture filterTextPacket(T text, BiFunction> bifunction) { + private CompletableFuture filterTextPacket(T text, BiFunction> filterer) { diff --git a/patches/server/Kick-on-main-for-illegal-chat.patch b/patches/server/Kick-on-main-for-illegal-chat.patch index c4aef2beab..a195ae0ffd 100644 --- a/patches/server/Kick-on-main-for-illegal-chat.patch +++ b/patches/server/Kick-on-main-for-illegal-chat.patch @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) { this.server.submit(() -> { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - // Paper end + 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.server.scheduleOnMain(() -> { // Paper - push to main diff --git a/patches/server/Optimise-non-flush-packet-sending.patch b/patches/server/Optimise-non-flush-packet-sending.patch index 4eb05f9b43..c3dd3c4721 100644 --- a/patches/server/Optimise-non-flush-packet-sending.patch +++ b/patches/server/Optimise-non-flush-packet-sending.patch @@ -34,20 +34,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static final float AVERAGE_PACKETS_SMOOTHING = 0.75F; @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { if (this.channel.eventLoop().inEventLoop()) { - this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter + this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper } else { + // Paper start - optimise packets that are not flushed + // note: since the type is not dynamic here, we need to actually copy the old executor code + // into two branches. On conflict, just re-copy - no changes were made inside the executor code. + if (!flush) { + AbstractEventExecutor.LazyRunnable run = () -> { -+ this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter ++ this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter + }; + this.channel.eventLoop().execute(run); + } else { // Paper end - optimise packets that are not flushed this.channel.eventLoop().execute(() -> { -- this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter -+ this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter // Paper - diff on change +- this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper ++ this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter // Paper - diff on change }); + } // Paper } diff --git a/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch index bcdebf1f3d..1e39689980 100644 --- a/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.send(packet, (PacketSendListener) null); } - public void send(Packet packet, @Nullable PacketSendListener packetsendlistener) { + public void send(Packet packet, @Nullable PacketSendListener callbacks) { - if (this.isConnected()) { - this.flushQueue(); + // Paper start - handle oversized packets better @@ -118,16 +118,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + net.minecraft.server.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() && + (packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty()) + ))) { - this.sendPacket(packet, packetsendlistener); + this.sendPacket(packet, callbacks); - } else { -- this.queue.add(new Connection.PacketHolder(packet, packetsendlistener)); +- this.queue.add(new Connection.PacketHolder(packet, callbacks)); + return; } + // write the packets to the queue, then flush - antixray hooks there already + java.util.List extraPackets = InnerUtil.buildExtraPackets(packet); + boolean hasExtraPackets = extraPackets != null && !extraPackets.isEmpty(); + if (!hasExtraPackets) { -+ this.queue.add(new Connection.PacketHolder(packet, packetsendlistener)); ++ this.queue.add(new Connection.PacketHolder(packet, callbacks)); + } else { + java.util.List packets = new java.util.ArrayList<>(1 + extraPackets.size()); + packets.add(new Connection.PacketHolder(packet, null)); // delay the future listener until the end of the extra packets @@ -135,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + for (int i = 0, len = extraPackets.size(); i < len;) { + Packet extra = extraPackets.get(i); + boolean end = ++i == len; -+ packets.add(new Connection.PacketHolder(extra, end ? packetsendlistener : null)); // append listener to the end ++ packets.add(new Connection.PacketHolder(extra, end ? callbacks : null)); // append listener to the end + } + this.queue.addAll(packets); // atomic + } @@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } - private void sendPacket(Packet packet, @Nullable PacketSendListener packetsendlistener) { + private void sendPacket(Packet packet, @Nullable PacketSendListener callbacks) { @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { this.setProtocol(packetState); } @@ -159,7 +159,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end ChannelFuture channelfuture = this.channel.writeAndFlush(packet); - if (packetsendlistener != null) { + if (callbacks != null) { @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { }); diff --git a/patches/server/Remove-invalid-signature-login-stacktrace.patch b/patches/server/Remove-invalid-signature-login-stacktrace.patch index a84c280446..4bb30846eb 100644 --- a/patches/server/Remove-invalid-signature-login-stacktrace.patch +++ b/patches/server/Remove-invalid-signature-login-stacktrace.patch @@ -11,9 +11,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se profilepublickey = ServerLoginPacketListenerImpl.validatePublicKey(this.profilePublicKeyData, this.gameProfile.getId(), signaturevalidator, this.server.enforceSecureProfile()); - } catch (ServerLoginPacketListenerImpl.PublicKeyValidationException loginlistener_a) { -- ServerLoginPacketListenerImpl.LOGGER.error(loginlistener_a.getMessage(), loginlistener_a.getCause()); -+ //ServerLoginPacketListenerImpl.LOGGER.error(loginlistener_a.getMessage(), loginlistener_a.getCause()); // Paper - unnecessary stacktrace + } catch (ProfilePublicKey.ValidationException profilepublickey_b) { +- ServerLoginPacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); ++ // ServerLoginPacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); // Paper - unnecessary log if (!this.connection.isMemoryConnection()) { - this.disconnect(loginlistener_a.getComponent()); + this.disconnect(profilepublickey_b.getComponent()); return; diff --git a/patches/server/Setup-Gradle-project.patch b/patches/server/Setup-Gradle-project.patch index fd31a84f86..4860d3d202 100644 --- a/patches/server/Setup-Gradle-project.patch +++ b/patches/server/Setup-Gradle-project.patch @@ -182,7 +182,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - org.spigotmc - spigot - jar -- 1.19.1-R0.1-SNAPSHOT +- 1.19.2-R0.1-SNAPSHOT - Spigot - https://www.spigotmc.org/ - diff --git a/work/BuildData b/work/BuildData index c540b6e228..d96ad8e1e6 160000 --- a/work/BuildData +++ b/work/BuildData @@ -1 +1 @@ -Subproject commit c540b6e228dc33c13c02b2af63a2691cda0cdea8 +Subproject commit d96ad8e1e64b7c35bb632339c23621353be1f028 diff --git a/work/Bukkit b/work/Bukkit index caa7c4866a..bf60995c03 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit caa7c4866ac49b04808b75284715543f221649a5 +Subproject commit bf60995c031e1c046dfe1a322b94298426eb2f84 diff --git a/work/CraftBukkit b/work/CraftBukkit index 1e3bf58cdb..ec2b5d4cd1 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 1e3bf58cdb2b099308d94dbc34d950155ee83ac3 +Subproject commit ec2b5d4cd1f039ef34be82c2d3954fb1a88bf3b5 diff --git a/work/Spigot b/work/Spigot index 21831450a4..584b459dce 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 21831450a43f67f1730dd0dec987c7a7ff19caa9 +Subproject commit 584b459dceac6e6f4708b70706671206d7a2c8ea