mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
1.19.2 (#8250)
This commit is contained in:
parent
522db24de0
commit
2782b0c375
20 changed files with 108 additions and 124 deletions
|
@ -38,7 +38,7 @@ How To (Plugin Developers)
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.papermc.paper</groupId>
|
<groupId>io.papermc.paper</groupId>
|
||||||
<artifactId>paper-api</artifactId>
|
<artifactId>paper-api</artifactId>
|
||||||
<version>1.19.1-R0.1-SNAPSHOT</version>
|
<version>1.19.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
@ -54,7 +54,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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 {
|
java {
|
||||||
|
|
|
@ -61,7 +61,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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")
|
remapper("net.fabricmc:tiny-remapper:0.8.2:fat")
|
||||||
decompiler("net.minecraftforge:forgeflower:1.5.605.7")
|
decompiler("net.minecraftforge:forgeflower:1.5.605.7")
|
||||||
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.6")
|
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.6")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
group=io.papermc.paper
|
group=io.papermc.paper
|
||||||
version=1.19.1-R0.1-SNAPSHOT
|
version=1.19.2-R0.1-SNAPSHOT
|
||||||
mcVersion=1.19.1
|
mcVersion=1.19.2
|
||||||
|
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
|
@ -125,7 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
-
|
-
|
||||||
- <groupId>org.spigotmc</groupId>
|
- <groupId>org.spigotmc</groupId>
|
||||||
- <artifactId>spigot-api</artifactId>
|
- <artifactId>spigot-api</artifactId>
|
||||||
- <version>1.19.1-R0.1-SNAPSHOT</version>
|
- <version>1.19.2-R0.1-SNAPSHOT</version>
|
||||||
- <packaging>jar</packaging>
|
- <packaging>jar</packaging>
|
||||||
-
|
-
|
||||||
- <name>Spigot-API</name>
|
- <name>Spigot-API</name>
|
||||||
|
|
|
@ -259,7 +259,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) {
|
if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) {
|
||||||
this.server.submit(() -> {
|
this.server.submit(() -> {
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -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)) {
|
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.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"));
|
- 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
|
} 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));
|
this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
ChatSender chatsender = this.player.asChatSender();
|
}
|
||||||
|
|
||||||
if (chatsender.profilePublicKey() != null && !message.verify(chatsender)) {
|
if (!playerchatmessage.verify(chatsender)) {
|
||||||
- this.disconnect(Component.translatable("multiplayer.disconnect.unsigned_chat"));
|
- 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
|
+ this.disconnect(Component.translatable("multiplayer.disconnect.unsigned_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event cause
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
if (message.hasExpiredServer(Instant.now())) {
|
}
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -0,0 +0,0 @@ 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())) {
|
||||||
|
|
|
@ -166,9 +166,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ final ProfilePublicKey.Data forwardedKey = com.destroystokyo.paper.proxy.VelocityProxy.readForwardedKey(buf);
|
+ final ProfilePublicKey.Data forwardedKey = com.destroystokyo.paper.proxy.VelocityProxy.readForwardedKey(buf);
|
||||||
+ if (this.profilePublicKeyData == null) {
|
+ if (this.profilePublicKeyData == null) {
|
||||||
+ try {
|
+ try {
|
||||||
+ ProfilePublicKey.createValidated(this.server.getServiceSignatureValidator(), this.gameProfile.getId(), forwardedKey);
|
+ ProfilePublicKey.createValidated(this.server.getServiceSignatureValidator(), this.gameProfile.getId(), forwardedKey, Duration.ZERO);
|
||||||
+ this.profilePublicKeyData = forwardedKey;
|
+ this.profilePublicKeyData = forwardedKey;
|
||||||
+ } catch (CryptException e) {
|
+ } catch (ProfilePublicKey.ValidationException e) {
|
||||||
+ this.disconnect("Unable to validate forwarded player key");
|
+ this.disconnect("Unable to validate forwarded player key");
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- 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
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -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)) {
|
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
|
||||||
|
@ -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
|
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
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -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;
|
||||||
|
|
|
@ -1510,6 +1510,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ @io.papermc.paper.annotation.DoNotUse // Paper
|
+ @io.papermc.paper.annotation.DoNotUse // Paper
|
||||||
CompletableFuture<Component> decorate(@Nullable ServerPlayer sender, Component message);
|
CompletableFuture<Component> decorate(@Nullable ServerPlayer sender, Component message);
|
||||||
|
|
||||||
|
+ @io.papermc.paper.annotation.DoNotUse // Paper
|
||||||
|
default CompletableFuture<PlayerChatMessage> 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
|
+ // Paper start
|
||||||
+ default CompletableFuture<Result> decorate(@Nullable ServerPlayer sender, @Nullable net.minecraft.commands.CommandSourceStack commandSourceStack, Component message, boolean isPreview) {
|
+ default CompletableFuture<Result> decorate(@Nullable ServerPlayer sender, @Nullable net.minecraft.commands.CommandSourceStack commandSourceStack, Component message, boolean isPreview) {
|
||||||
+ throw new UnsupportedOperationException("Must override this implementation");
|
+ 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());
|
+ return new PlayerChatMessage(playerChatMessage.signedHeader(), playerChatMessage.headerSignature(), playerChatMessage.signedBody().withContent(playerChatMessage.signedContent().withDecorationResult(result)), playerChatMessage.unsignedContent(), playerChatMessage.filterMask()).withUnsignedContent(result.component());
|
||||||
+ });
|
+ });
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+
|
+
|
||||||
+ @io.papermc.paper.annotation.DoNotUse // Paper
|
static PlayerChatMessage attachIfNotDecorated(PlayerChatMessage message, Component attached) {
|
||||||
default CompletableFuture<PlayerChatMessage> decorate(@Nullable ServerPlayer serverPlayer, PlayerChatMessage playerChatMessage) {
|
return !message.signedContent().isDecorated() ? message.withUnsignedContent(attached) : message;
|
||||||
- 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 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
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/ChatMessageContent.java
|
--- 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
|
--- a/src/main/java/net/minecraft/network/chat/OutgoingPlayerChatMessage.java
|
||||||
+++ b/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 {
|
@@ -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
|
+ // Paper start
|
||||||
+ default void sendToPlayer(ServerPlayer serverPlayer, boolean shouldFilter, ChatType.Bound bound, @javax.annotation.Nullable Component unsigned) {
|
+ default void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params, @javax.annotation.Nullable Component unsigned) {
|
||||||
+ this.sendToPlayer(serverPlayer, shouldFilter, bound);
|
+ this.sendToPlayer(sender, filterMaskEnabled, params);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
+
|
||||||
void sendHeadersToRemainingPlayers(PlayerList playerManager);
|
void sendHeadersToRemainingPlayers(PlayerList playerManager);
|
||||||
|
|
||||||
|
static OutgoingPlayerChatMessage create(PlayerChatMessage message) {
|
||||||
@@ -0,0 +0,0 @@ public interface OutgoingPlayerChatMessage {
|
@@ -0,0 +0,0 @@ public interface OutgoingPlayerChatMessage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendToPlayer(ServerPlayer serverPlayer, boolean bl, ChatType.Bound bound) {
|
public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params) {
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ this.sendToPlayer(serverPlayer, bl, bound, null);
|
+ this.sendToPlayer(sender, filterMaskEnabled, params, null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @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
|
+ // Paper end
|
||||||
PlayerChatMessage playerChatMessage = this.message.filter(bl);
|
PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled);
|
||||||
+ playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
|
+ playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
|
||||||
if (!playerChatMessage.isFullyFiltered()) {
|
if (!playerChatMessage.isFullyFiltered()) {
|
||||||
RegistryAccess registryAccess = serverPlayer.level.registryAccess();
|
RegistryAccess registryAccess = sender.level.registryAccess();
|
||||||
ChatType.BoundNetwork boundNetwork = bound.toNetwork(registryAccess);
|
ChatType.BoundNetwork boundNetwork = params.toNetwork(registryAccess);
|
||||||
@@ -0,0 +0,0 @@ public interface OutgoingPlayerChatMessage {
|
@@ -0,0 +0,0 @@ public interface OutgoingPlayerChatMessage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendToPlayer(ServerPlayer serverPlayer, boolean bl, ChatType.Bound bound) {
|
public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params) {
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ this.sendToPlayer(serverPlayer, bl, bound, null);
|
+ this.sendToPlayer(sender, filterMaskEnabled, params, null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @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
|
+ // Paper end
|
||||||
PlayerChatMessage playerChatMessage = this.message.filter(bl);
|
PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled);
|
||||||
+ playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
|
+ playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
|
||||||
if (!playerChatMessage.isFullyFiltered()) {
|
if (!playerChatMessage.isFullyFiltered()) {
|
||||||
this.playersWithFullMessage.add(serverPlayer);
|
this.playersWithFullMessage.add(sender);
|
||||||
RegistryAccess registryAccess = serverPlayer.level.registryAccess();
|
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
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java
|
--- 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 {
|
@@ -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
|
+ // 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
|
+ // Paper end
|
||||||
if (this.acceptsChatMessages()) {
|
if (this.acceptsChatMessages()) {
|
||||||
- message.sendToPlayer(this, flag, chatmessagetype_a);
|
- message.sendToPlayer(this, filterMaskEnabled, params);
|
||||||
+ message.sendToPlayer(this, flag, chatmessagetype_a, unsigned); // Paper
|
+ 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
|
+ 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
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
|
||||||
private CompletableFuture<Component> queryChatPreview(String query) {
|
private CompletableFuture<Component> queryChatPreview(String query) {
|
||||||
|
@ -2391,38 +2393,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -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
|
+ // 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<net.kyori.adventure.audience.Audience, Component> unsignedFunction) {
|
+ public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound params, @Nullable Function<net.kyori.adventure.audience.Audience, Component> unsignedFunction) {
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
Objects.requireNonNull(sender);
|
Objects.requireNonNull(sender);
|
||||||
- this.broadcastChatMessage(playerchatmessage, sender::shouldFilterMessageTo, sender, sender.asChatSender(), params);
|
- this.broadcastChatMessage(message, 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, unsignedFunction); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
private void broadcastChatMessage(PlayerChatMessage playerchatmessage, Predicate<ServerPlayer> shouldSendFiltered, @Nullable ServerPlayer entityplayer, ChatSender chatsender, ChatType.Bound chatmessagetype_a) {
|
private void broadcastChatMessage(PlayerChatMessage message, Predicate<ServerPlayer> shouldSendFiltered, @Nullable ServerPlayer sender, ChatSender sourceProfile, ChatType.Bound params) {
|
||||||
+ // Paper start
|
+ // 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<ServerPlayer> shouldSendFiltered, @Nullable ServerPlayer entityplayer, ChatSender chatsender, ChatType.Bound chatmessagetype_a, @Nullable Function<net.kyori.adventure.audience.Audience, Component> unsignedFunction) {
|
+ private void broadcastChatMessage(PlayerChatMessage message, Predicate<ServerPlayer> shouldSendFiltered, @Nullable ServerPlayer sender, ChatSender sourceProfile, ChatType.Bound params, @Nullable Function<net.kyori.adventure.audience.Audience, Component> unsignedFunction) {
|
||||||
+ // Paper end
|
+ // 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(message.serverContent(), params, 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
|
+ this.server.logChatMessage((unsignedFunction == null ? message : message.withUnsignedContent(unsignedFunction.apply(this.server.console))).serverContent(), params, flag ? null : "Not Secure"); // Paper
|
||||||
OutgoingPlayerChatMessage outgoingplayerchatmessage = OutgoingPlayerChatMessage.create(playerchatmessage);
|
OutgoingPlayerChatMessage outgoingplayerchatmessage = OutgoingPlayerChatMessage.create(message);
|
||||||
boolean flag1 = playerchatmessage.isFullyFiltered();
|
boolean flag1 = message.isFullyFiltered();
|
||||||
boolean flag2 = false;
|
boolean flag2 = false;
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
ServerPlayer entityplayer1 = (ServerPlayer) iterator.next();
|
ServerPlayer entityplayer1 = (ServerPlayer) iterator.next();
|
||||||
boolean flag3 = shouldSendFiltered.test(entityplayer1);
|
boolean flag3 = shouldSendFiltered.test(entityplayer1);
|
||||||
|
|
||||||
- entityplayer1.sendChatMessage(outgoingplayerchatmessage, flag3, chatmessagetype_a);
|
- entityplayer1.sendChatMessage(outgoingplayerchatmessage, flag3, params);
|
||||||
+ entityplayer1.sendChatMessage(outgoingplayerchatmessage, flag3, chatmessagetype_a, unsignedFunction == null ? null : unsignedFunction.apply(entityplayer1.getBukkitEntity()));
|
+ entityplayer1.sendChatMessage(outgoingplayerchatmessage, flag3, params, unsignedFunction == null ? null : unsignedFunction.apply(entityplayer1.getBukkitEntity())); // Paper
|
||||||
if (entityplayer != entityplayer1) {
|
if (sender != entityplayer1) {
|
||||||
flag2 |= flag1 && flag3;
|
flag2 |= flag1 && flag3;
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
|
|
|
@ -56,19 +56,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
net.minecraft.server.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() &&
|
net.minecraft.server.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() &&
|
||||||
(packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty())
|
(packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty())
|
||||||
))) {
|
))) {
|
||||||
- this.sendPacket(packet, packetsendlistener);
|
- this.sendPacket(packet, callbacks);
|
||||||
+ this.sendPacket(packet, packetsendlistener, null); // Paper
|
+ this.sendPacket(packet, callbacks, null); // Paper
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// write the packets to the queue, then flush - antixray hooks there already
|
// write the packets to the queue, then flush - antixray hooks there already
|
||||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendPacket(Packet<?> packet, @Nullable PacketSendListener packetsendlistener) {
|
private void sendPacket(Packet<?> packet, @Nullable PacketSendListener callbacks) {
|
||||||
+ // Paper start - add flush parameter
|
+ // 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
|
+ this.packetWrites.getAndIncrement(); // must be befeore using canFlush
|
||||||
+ boolean effectiveFlush = flushConditional == null ? this.canFlush : flushConditional.booleanValue();
|
+ 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
|
+ 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()) {
|
if (this.channel.eventLoop().inEventLoop()) {
|
||||||
- this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1);
|
- this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1);
|
||||||
+ this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
+ this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper
|
||||||
} else {
|
} else {
|
||||||
this.channel.eventLoop().execute(() -> {
|
this.channel.eventLoop().execute(() -> {
|
||||||
- this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1);
|
- this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1);
|
||||||
+ this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
+ 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
|
+ // 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
|
+ // Paper end - add flush parameter
|
||||||
if (packetState != currentState) {
|
if (packetState != currentState) {
|
||||||
this.setProtocol(packetState);
|
this.setProtocol(packetState);
|
||||||
|
@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
|
- ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
|
||||||
+ ChannelFuture channelfuture = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet); // Paper - add flush parameter
|
+ ChannelFuture channelfuture = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet); // Paper - add flush parameter
|
||||||
|
|
||||||
if (packetsendlistener != null) {
|
if (callbacks != null) {
|
||||||
channelfuture.addListener((future) -> {
|
channelfuture.addListener((future) -> {
|
||||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -598,24 +598,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||||
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
|
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
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
||||||
|
|
|
@ -16,4 +16,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ minecraftserver.scheduleOnMain(networkmanager::handleDisconnection); // Paper
|
+ minecraftserver.scheduleOnMain(networkmanager::handleDisconnection); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T, R> CompletableFuture<R> filterTextPacket(T text, BiFunction<TextFilter, T, CompletableFuture<R>> bifunction) {
|
private <T, R> CompletableFuture<R> filterTextPacket(T text, BiFunction<TextFilter, T, CompletableFuture<R>> filterer) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) {
|
if (this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages())) {
|
||||||
this.server.submit(() -> {
|
this.server.submit(() -> {
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -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)) {
|
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
|
||||||
|
|
|
@ -34,20 +34,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
private static final float AVERAGE_PACKETS_SMOOTHING = 0.75F;
|
private static final float AVERAGE_PACKETS_SMOOTHING = 0.75F;
|
||||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
if (this.channel.eventLoop().inEventLoop()) {
|
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 {
|
} else {
|
||||||
+ // Paper start - optimise packets that are not flushed
|
+ // 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
|
+ // 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.
|
+ // into two branches. On conflict, just re-copy - no changes were made inside the executor code.
|
||||||
+ if (!flush) {
|
+ if (!flush) {
|
||||||
+ AbstractEventExecutor.LazyRunnable run = () -> {
|
+ 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);
|
+ this.channel.eventLoop().execute(run);
|
||||||
+ } else { // Paper end - optimise packets that are not flushed
|
+ } else { // Paper end - optimise packets that are not flushed
|
||||||
this.channel.eventLoop().execute(() -> {
|
this.channel.eventLoop().execute(() -> {
|
||||||
- this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
|
- this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper
|
||||||
+ this.doSendPacket(packet, packetsendlistener, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter // Paper - diff on change
|
+ this.doSendPacket(packet, callbacks, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter // Paper - diff on change
|
||||||
});
|
});
|
||||||
+ } // Paper
|
+ } // Paper
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
this.send(packet, (PacketSendListener) null);
|
this.send(packet, (PacketSendListener) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void send(Packet<?> packet, @Nullable PacketSendListener packetsendlistener) {
|
public void send(Packet<?> packet, @Nullable PacketSendListener callbacks) {
|
||||||
- if (this.isConnected()) {
|
- if (this.isConnected()) {
|
||||||
- this.flushQueue();
|
- this.flushQueue();
|
||||||
+ // Paper start - handle oversized packets better
|
+ // Paper start - handle oversized packets better
|
||||||
|
@ -118,16 +118,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ net.minecraft.server.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() &&
|
+ net.minecraft.server.MCUtil.isMainThread() && packet.isReady() && this.queue.isEmpty() &&
|
||||||
+ (packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty())
|
+ (packet.getExtraPackets() == null || packet.getExtraPackets().isEmpty())
|
||||||
+ ))) {
|
+ ))) {
|
||||||
this.sendPacket(packet, packetsendlistener);
|
this.sendPacket(packet, callbacks);
|
||||||
- } else {
|
- } else {
|
||||||
- this.queue.add(new Connection.PacketHolder(packet, packetsendlistener));
|
- this.queue.add(new Connection.PacketHolder(packet, callbacks));
|
||||||
+ return;
|
+ return;
|
||||||
}
|
}
|
||||||
+ // write the packets to the queue, then flush - antixray hooks there already
|
+ // write the packets to the queue, then flush - antixray hooks there already
|
||||||
+ java.util.List<Packet> extraPackets = InnerUtil.buildExtraPackets(packet);
|
+ java.util.List<Packet> extraPackets = InnerUtil.buildExtraPackets(packet);
|
||||||
+ boolean hasExtraPackets = extraPackets != null && !extraPackets.isEmpty();
|
+ boolean hasExtraPackets = extraPackets != null && !extraPackets.isEmpty();
|
||||||
+ if (!hasExtraPackets) {
|
+ if (!hasExtraPackets) {
|
||||||
+ this.queue.add(new Connection.PacketHolder(packet, packetsendlistener));
|
+ this.queue.add(new Connection.PacketHolder(packet, callbacks));
|
||||||
+ } else {
|
+ } else {
|
||||||
+ java.util.List<Connection.PacketHolder> packets = new java.util.ArrayList<>(1 + extraPackets.size());
|
+ java.util.List<Connection.PacketHolder> 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
|
+ 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;) {
|
+ for (int i = 0, len = extraPackets.size(); i < len;) {
|
||||||
+ Packet extra = extraPackets.get(i);
|
+ Packet extra = extraPackets.get(i);
|
||||||
+ boolean end = ++i == len;
|
+ 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
|
+ this.queue.addAll(packets); // atomic
|
||||||
+ }
|
+ }
|
||||||
|
@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper end
|
+ // 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<Packet<?>> {
|
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
this.setProtocol(packetState);
|
this.setProtocol(packetState);
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
|
ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
|
||||||
|
|
||||||
if (packetsendlistener != null) {
|
if (callbacks != null) {
|
||||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,9 +11,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
|
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
|
||||||
|
|
||||||
profilepublickey = ServerLoginPacketListenerImpl.validatePublicKey(this.profilePublicKeyData, this.gameProfile.getId(), signaturevalidator, this.server.enforceSecureProfile());
|
profilepublickey = ServerLoginPacketListenerImpl.validatePublicKey(this.profilePublicKeyData, this.gameProfile.getId(), signaturevalidator, this.server.enforceSecureProfile());
|
||||||
} catch (ServerLoginPacketListenerImpl.PublicKeyValidationException loginlistener_a) {
|
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
|
||||||
- ServerLoginPacketListenerImpl.LOGGER.error(loginlistener_a.getMessage(), loginlistener_a.getCause());
|
- ServerLoginPacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
|
||||||
+ //ServerLoginPacketListenerImpl.LOGGER.error(loginlistener_a.getMessage(), loginlistener_a.getCause()); // Paper - unnecessary stacktrace
|
+ // ServerLoginPacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); // Paper - unnecessary log
|
||||||
if (!this.connection.isMemoryConnection()) {
|
if (!this.connection.isMemoryConnection()) {
|
||||||
this.disconnect(loginlistener_a.getComponent());
|
this.disconnect(profilepublickey_b.getComponent());
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -182,7 +182,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- <groupId>org.spigotmc</groupId>
|
- <groupId>org.spigotmc</groupId>
|
||||||
- <artifactId>spigot</artifactId>
|
- <artifactId>spigot</artifactId>
|
||||||
- <packaging>jar</packaging>
|
- <packaging>jar</packaging>
|
||||||
- <version>1.19.1-R0.1-SNAPSHOT</version>
|
- <version>1.19.2-R0.1-SNAPSHOT</version>
|
||||||
- <name>Spigot</name>
|
- <name>Spigot</name>
|
||||||
- <url>https://www.spigotmc.org/</url>
|
- <url>https://www.spigotmc.org/</url>
|
||||||
-
|
-
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c540b6e228dc33c13c02b2af63a2691cda0cdea8
|
Subproject commit d96ad8e1e64b7c35bb632339c23621353be1f028
|
|
@ -1 +1 @@
|
||||||
Subproject commit caa7c4866ac49b04808b75284715543f221649a5
|
Subproject commit bf60995c031e1c046dfe1a322b94298426eb2f84
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1e3bf58cdb2b099308d94dbc34d950155ee83ac3
|
Subproject commit ec2b5d4cd1f039ef34be82c2d3954fb1a88bf3b5
|
|
@ -1 +1 @@
|
||||||
Subproject commit 21831450a43f67f1730dd0dec987c7a7ff19caa9
|
Subproject commit 584b459dceac6e6f4708b70706671206d7a2c8ea
|
Loading…
Reference in a new issue