13
0
geforkt von Mirrors/Paper

fix some tests and DoNotUse violations

Dieser Commit ist enthalten in:
Jake Potrebic 2022-12-08 09:06:14 -08:00
Ursprung c29c901ae8
Commit b344c04a4a
5 geänderte Dateien mit 175 neuen und 27 gelöschten Zeilen

Datei anzeigen

@ -223,7 +223,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag DOORS = new MaterialSetTag(keyFor("doors")) + public static final MaterialSetTag DOORS = new MaterialSetTag(keyFor("doors"))
+ .endsWith("_DOOR") + .endsWith("_DOOR")
+ .ensureSize("DOORS", 10).lock(); + .ensureSize("DOORS", 11).lock();
+ +
+ /** + /**
+ * Covers all dyes. + * Covers all dyes.
@ -237,14 +237,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates")) + public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates"))
+ .endsWith("_GATE") + .endsWith("_GATE")
+ .ensureSize("FENCE_GATES", 9).lock(); + .ensureSize("FENCE_GATES", 10).lock();
+ +
+ /** + /**
+ * Covers all variants of fences. + * Covers all variants of fences.
+ */ + */
+ public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences")) + public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences"))
+ .endsWith("_FENCE") + .endsWith("_FENCE")
+ .ensureSize("FENCES", 10).lock(); + .ensureSize("FENCES", 11).lock();
+ +
+ /** + /**
+ * Covers all variants of fish buckets. + * Covers all variants of fish buckets.
@ -358,7 +358,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates")) + public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates"))
+ .endsWith("_PRESSURE_PLATE") + .endsWith("_PRESSURE_PLATE")
+ .ensureSize("PRESSURE_PLATES", 13).lock(); + .ensureSize("PRESSURE_PLATES", 14).lock();
+ +
+ /** + /**
+ * Covers the variants of prismarine blocks. + * Covers the variants of prismarine blocks.
@ -430,14 +430,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .endsWith("_HEAD") + .endsWith("_HEAD")
+ .endsWith("_SKULL") + .endsWith("_SKULL")
+ .not(Material.PISTON_HEAD) + .not(Material.PISTON_HEAD)
+ .ensureSize("SKULLS", 12).lock(); + .ensureSize("SKULLS", 14).lock();
+ +
+ /** + /**
+ * Covers all spawn egg items. + * Covers all spawn egg items.
+ */ + */
+ public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs")) + public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
+ .endsWith("_SPAWN_EGG") + .endsWith("_SPAWN_EGG")
+ .ensureSize("SPAWN_EGGS", 71).lock(); + .ensureSize("SPAWN_EGGS", 76).lock();
+ +
+ /** + /**
+ * Covers all colors of stained glass. + * Covers all colors of stained glass.
@ -458,7 +458,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors")) + public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors"))
+ .endsWith("_TRAPDOOR") + .endsWith("_TRAPDOOR")
+ .ensureSize("TRAPDOORS", 10).lock(); + .ensureSize("TRAPDOORS", 11).lock();
+ +
+ /** + /**
+ * Covers all wood variants of doors. + * Covers all wood variants of doors.
@ -466,7 +466,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static final MaterialSetTag WOODEN_DOORS = new MaterialSetTag(keyFor("wooden_doors")) + public static final MaterialSetTag WOODEN_DOORS = new MaterialSetTag(keyFor("wooden_doors"))
+ .endsWith("_DOOR") + .endsWith("_DOOR")
+ .not(Material.IRON_DOOR) + .not(Material.IRON_DOOR)
+ .ensureSize("WOODEN_DOORS", 9).lock(); + .ensureSize("WOODEN_DOORS", 10).lock();
+ +
+ /** + /**
+ * Covers all wood variants of fences. + * Covers all wood variants of fences.
@ -474,7 +474,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences")) + public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences"))
+ .endsWith("_FENCE") + .endsWith("_FENCE")
+ .not(Material.NETHER_BRICK_FENCE) + .not(Material.NETHER_BRICK_FENCE)
+ .ensureSize("WOODEN_FENCES", 9).lock(); + .ensureSize("WOODEN_FENCES", 10).lock();
+ +
+ /** + /**
+ * Covers all wood variants of trapdoors. + * Covers all wood variants of trapdoors.
@ -482,14 +482,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors")) + public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors"))
+ .endsWith("_TRAPDOOR") + .endsWith("_TRAPDOOR")
+ .not(Material.IRON_TRAPDOOR) + .not(Material.IRON_TRAPDOOR)
+ .ensureSize("WOODEN_TRAPDOORS", 9).lock(); + .ensureSize("WOODEN_TRAPDOORS", 10).lock();
+ +
+ /** + /**
+ * Covers the wood variants of gates. + * Covers the wood variants of gates.
+ */ + */
+ public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates")) + public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates"))
+ .endsWith("_GATE") + .endsWith("_GATE")
+ .ensureSize("WOODEN_GATES", 9).lock(); + .ensureSize("WOODEN_GATES", 10).lock();
+ +
+ /** + /**
+ * Covers the variants of purpur. + * Covers the variants of purpur.
@ -503,7 +503,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs")) + public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs"))
+ .endsWith("_SIGN") + .endsWith("_SIGN")
+ .ensureSize("SIGNS", 18).lock(); + .ensureSize("SIGNS", 40).lock();
+ +
+ /** + /**
+ * Covers the variants of a regular torch. + * Covers the variants of a regular torch.
@ -596,7 +596,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .endsWith("_HELMET") + .endsWith("_HELMET")
+ .add(SKULLS) + .add(SKULLS)
+ .add(Material.CARVED_PUMPKIN) + .add(Material.CARVED_PUMPKIN)
+ .ensureSize("HEAD_EQUIPPABLE", 20).lock(); + .ensureSize("HEAD_EQUIPPABLE", 22).lock();
+ +
+ /** + /**
+ * Covers the variants of chestplate. + * Covers the variants of chestplate.
@ -831,6 +831,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package io.papermc.paper.tag; +package io.papermc.paper.tag;
+ +
+import com.google.common.collect.Lists; +import com.google.common.collect.Lists;
+import java.util.Collections;
+import org.bukkit.Keyed; +import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey; +import org.bukkit.NamespacedKey;
+import org.bukkit.Tag; +import org.bukkit.Tag;
@ -900,7 +901,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @NotNull + @NotNull
+ @Override + @Override
+ public Set<T> getValues() { + public Set<T> getValues() {
+ return tagged; + return Collections.unmodifiableSet(tagged);
+ } + }
+ +
+ @Override + @Override

Datei anzeigen

@ -4,6 +4,37 @@ Date: Sat, 15 May 2021 20:30:45 -0700
Subject: [PATCH] Add PlayerKickEvent causes Subject: [PATCH] Add PlayerKickEvent causes
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
@@ -0,0 +0,0 @@ public class SignedMessageChain {
} else {
PlayerChatMessage playerChatMessage = new PlayerChatMessage(signedMessageLink, signature, body, (Component)null, FilterMask.PASS_THROUGH);
if (!playerChatMessage.verify(signatureValidator)) {
- throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true);
+ throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event causes
} else {
if (playerChatMessage.hasExpiredServer(Instant.now())) {
LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", (Object)body.content());
@@ -0,0 +0,0 @@ public class SignedMessageChain {
public static class DecodeException extends ThrowingComponent {
private final boolean shouldDisconnect;
+ public final org.bukkit.event.player.PlayerKickEvent.Cause kickCause; // Paper
public DecodeException(Component message, boolean shouldDisconnect) {
+ // Paper start
+ this(message, shouldDisconnect, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
+ }
+ public DecodeException(Component message, boolean shouldDisconnect, org.bukkit.event.player.PlayerKickEvent.Cause kickCause) {
+ // Paper end
super(message);
this.shouldDisconnect = shouldDisconnect;
+ this.kickCause = kickCause; // Paper
}
public boolean shouldDisconnect() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
@ -267,6 +298,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else { } else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages()); Optional<LastSeenMessages> optional = this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages());
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
if (exception.shouldDisconnect()) {
- this.disconnect(exception.getComponent());
+ this.disconnect(exception.getComponent(), exception.kickCause); // Paper - kick event causes
} else {
this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED));
}
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) { private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
if (!this.updateChatOrder(timestamp)) { if (!this.updateChatOrder(timestamp)) {
@ -277,6 +317,15 @@ 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
if (optional.isEmpty()) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
- this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED);
+ this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
}
return optional;
@@ -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())) {
// CraftBukkit end // CraftBukkit end
@ -284,6 +333,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause + this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
} }
}
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
synchronized (this.lastSeenMessages) {
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
- this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED);
+ this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
}
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
@ -357,6 +415,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) {
if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) {
- this.disconnect(ProfilePublicKey.EXPIRED_PROFILE_PUBLIC_KEY);
+ this.disconnect(ProfilePublicKey.EXPIRED_PROFILE_PUBLIC_KEY, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes
} else {
try {
SignatureValidator signaturevalidator = this.server.getServiceSignatureValidator();
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator, Duration.ZERO));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
- this.disconnect(profilepublickey_b.getComponent());
+ this.disconnect(profilepublickey_b.getComponent(), profilepublickey_b.kickCause); // Paper - kick event causes
}
}
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
@ -381,6 +457,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
+++ b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
@@ -0,0 +0,0 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) {
public static ProfilePublicKey createValidated(SignatureValidator servicesSignatureVerifier, UUID playerUuid, ProfilePublicKey.Data publicKeyData, Duration gracePeriod) throws ProfilePublicKey.ValidationException {
if (publicKeyData.hasExpired(gracePeriod)) {
- throw new ProfilePublicKey.ValidationException(EXPIRED_PROFILE_PUBLIC_KEY);
+ throw new ProfilePublicKey.ValidationException(EXPIRED_PROFILE_PUBLIC_KEY, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes
} else if (!publicKeyData.validateSignature(servicesSignatureVerifier, playerUuid)) {
- throw new ProfilePublicKey.ValidationException(INVALID_SIGNATURE);
+ throw new ProfilePublicKey.ValidationException(INVALID_SIGNATURE, org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PUBLIC_KEY_SIGNATURE); // Paper - kick event causes
} else {
return new ProfilePublicKey(publicKeyData);
}
@@ -0,0 +0,0 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) {
}
public static class ValidationException extends ThrowingComponent {
+ public final org.bukkit.event.player.PlayerKickEvent.Cause kickCause; // Paper
+ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper
public ValidationException(Component messageText) {
+ // Paper start
+ this(messageText, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
+ }
+ public ValidationException(Component messageText, org.bukkit.event.player.PlayerKickEvent.Cause kickCause) {
+ // Paper end
super(messageText);
+ this.kickCause = kickCause; // Paper
}
}
}
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java

Datei anzeigen

@ -1451,6 +1451,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) { public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
this(output, pos, rot, world, level, name, displayName, server, entity, false, (commandcontext, flag, j) -> { this(output, pos, rot, world, level, name, displayName, server, entity, false, (commandcontext, flag, j) -> {
diff --git a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
+++ b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
@@ -0,0 +0,0 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message>
private static void resolveSignedMessage(Consumer<PlayerChatMessage> callback, CommandSourceStack source, PlayerChatMessage message) {
MinecraftServer minecraftServer = source.getServer();
CompletableFuture<FilteredText> completableFuture = filterPlainText(source, message);
- CompletableFuture<Component> completableFuture2 = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent());
+ CompletableFuture<net.minecraft.network.chat.ChatDecorator.Result> completableFuture2 = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent()); // Paper
source.getChatMessageChainer().append((executor) -> {
return CompletableFuture.allOf(completableFuture, completableFuture2).thenAcceptAsync((void_) -> {
- PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(completableFuture2.join()).filter(completableFuture.join().mask());
+ PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(completableFuture2.join().component()).filter(completableFuture.join().mask()); // Paper
callback.accept(playerChatMessage2);
}, executor);
});
@@ -0,0 +0,0 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message>
private static void resolveDisguisedMessage(Consumer<PlayerChatMessage> callback, CommandSourceStack source, PlayerChatMessage message) {
MinecraftServer minecraftServer = source.getServer();
- CompletableFuture<Component> completableFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent());
+ CompletableFuture<net.minecraft.network.chat.ChatDecorator.Result> completableFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent()); // Paper
source.getChatMessageChainer().append((executor) -> {
return completableFuture.thenAcceptAsync((content) -> {
- callback.accept(message.withUnsignedContent(content));
+ callback.accept(message.withUnsignedContent(content.component())); // Paper
}, executor);
});
}
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java --- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
@ -1529,7 +1559,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return CompletableFuture.completedFuture(message); return CompletableFuture.completedFuture(message);
}; };
+ @io.papermc.paper.annotation.DoNotUse // Paper + @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper
CompletableFuture<Component> decorate(@Nullable ServerPlayer sender, Component message); CompletableFuture<Component> decorate(@Nullable ServerPlayer sender, Component message);
+ +
+ // Paper start + // Paper start
@ -1577,25 +1607,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ } + }
+ +
+ record ModernResult(Component maybeAdventureComponent, boolean hasNoFormatting, boolean modernized) implements Result { + record ModernResult(Component component, boolean hasNoFormatting, boolean modernized) implements Result {
+ public ModernResult(net.kyori.adventure.text.Component component, boolean hasNoFormatting, boolean modernized) { + public ModernResult(net.kyori.adventure.text.Component component, boolean hasNoFormatting, boolean modernized) {
+ this(io.papermc.paper.adventure.PaperAdventure.asVanilla(component), hasNoFormatting, modernized); + this(io.papermc.paper.adventure.PaperAdventure.asVanilla(component), hasNoFormatting, modernized);
+ } + }
+ +
+ @Override + @Override
+ public Component component() {
+ return this.maybeAdventureComponent instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent ? adventureComponent.deepConverted() : this.maybeAdventureComponent;
+ }
+
+ @Override
+ public MessagePair message() { + public MessagePair message() {
+ final net.kyori.adventure.text.Component adventureComponent = io.papermc.paper.adventure.PaperAdventure.WRAPPER_AWARE_SERIALIZER.deserialize(this.maybeAdventureComponent); + final net.kyori.adventure.text.Component adventureComponent = io.papermc.paper.adventure.PaperAdventure.WRAPPER_AWARE_SERIALIZER.deserialize(this.component);
+ return new MessagePair(adventureComponent, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(adventureComponent)); + return new MessagePair(adventureComponent, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(adventureComponent));
+ } + }
+ } + }
+ default CompletableFuture<PlayerChatMessage> decorate(@Nullable ServerPlayer serverPlayer, @Nullable net.minecraft.commands.CommandSourceStack commandSourceStack, PlayerChatMessage playerChatMessage) {
+ return this.decorate(serverPlayer, commandSourceStack, playerChatMessage.decoratedContent()).thenApply(result -> playerChatMessage.withUnsignedContent(result.component()));
+ }
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
@ -1712,6 +1734,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static final MapCodec<PlayerChatMessage> MAP_CODEC = RecordCodecBuilder.mapCodec((instance) -> { public static final MapCodec<PlayerChatMessage> MAP_CODEC = RecordCodecBuilder.mapCodec((instance) -> {
return instance.group(SignedMessageLink.CODEC.fieldOf("link").forGetter(PlayerChatMessage::link), MessageSignature.CODEC.optionalFieldOf("signature").forGetter((message) -> { return instance.group(SignedMessageLink.CODEC.fieldOf("link").forGetter(PlayerChatMessage::link), MessageSignature.CODEC.optionalFieldOf("signature").forGetter((message) -> {
return Optional.ofNullable(message.signature); return Optional.ofNullable(message.signature);
@@ -0,0 +0,0 @@ public record PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignatu
}
public PlayerChatMessage withUnsignedContent(Component unsignedContent) {
- Component component = !unsignedContent.equals(Component.literal(this.signedContent())) ? unsignedContent : null;
+ Component component = !(unsignedContent instanceof io.papermc.paper.adventure.AdventureComponent advComponent ? advComponent.deepConverted() : unsignedContent).equals(Component.literal(this.signedContent())) ? unsignedContent : null; // Paper
return new PlayerChatMessage(this.link, this.signature, this.signedBody, component, this.filterMask);
}
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

Datei anzeigen

@ -1058,6 +1058,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (newWithinViewDistance && !oldWithinViewDistance) { if (newWithinViewDistance && !oldWithinViewDistance) {
ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos.toLong()); ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos.toLong());
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
for (Iterator iterator = this.getPlayers(chunkcoordintpair, false).iterator(); iterator.hasNext(); entityplayer.trackChunk(chunkcoordintpair, (Packet) mutableobject.getValue())) {
entityplayer = (ServerPlayer) iterator.next();
if (mutableobject.getValue() == null) {
- mutableobject.setValue(new ClientboundLevelChunkWithLightPacket(chunk1, this.lightEngine, (BitSet) null, (BitSet) null, true));
+ mutableobject.setValue(new ClientboundLevelChunkWithLightPacket(chunk1, this.lightEngine, (BitSet) null, (BitSet) null, true, true)); // Paper - Anti-Xray
}
}
} }

Datei anzeigen

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator, Duration.ZERO)); this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator, Duration.ZERO));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) { } catch (ProfilePublicKey.ValidationException profilepublickey_b) {
- ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); - ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
+ //ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); // Paper - unnecessary log + // ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); // Paper - unnecessary log
this.disconnect(profilepublickey_b.getComponent()); this.disconnect(profilepublickey_b.getComponent(), profilepublickey_b.kickCause); // Paper - kick event causes
} }