PaperMC/paper-server/patches/sources/net/minecraft/network/chat/SignedMessageChain.java.patch

38 lines
2.5 KiB
Diff
Raw Normal View History

2021-05-16 05:30:45 +02:00
--- a/net/minecraft/network/chat/SignedMessageChain.java
+++ b/net/minecraft/network/chat/SignedMessageChain.java
2024-12-14 18:44:07 +01:00
@@ -40,14 +_,14 @@
2021-05-16 05:30:45 +02:00
if (signature == null) {
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.MISSING_PROFILE_KEY);
2024-12-14 18:44:07 +01:00
} else if (publicKey.data().hasExpired()) {
2021-05-16 05:30:45 +02:00
- throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.EXPIRED_PROFILE_KEY);
+ throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.EXPIRED_PROFILE_KEY, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes
} else {
SignedMessageLink signedMessageLink = SignedMessageChain.this.nextLink;
if (signedMessageLink == null) {
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.CHAIN_BROKEN);
} else if (body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp)) {
this.setChainBroken();
- throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT);
+ throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes
} else {
SignedMessageChain.this.lastTimeStamp = body.timeStamp();
PlayerChatMessage playerChatMessage = new PlayerChatMessage(signedMessageLink, signature, body, null, FilterMask.PASS_THROUGH);
2024-12-14 18:44:07 +01:00
@@ -80,8 +_,15 @@
2021-05-16 05:30:45 +02:00
static final Component INVALID_SIGNATURE = Component.translatable("chat.disabled.invalid_signature");
static final Component OUT_OF_ORDER_CHAT = Component.translatable("chat.disabled.out_of_order_chat");
2024-12-14 18:44:07 +01:00
- public DecodeException(Component component) {
- super(component);
2021-05-16 05:30:45 +02:00
+ // Paper start
+ public final org.bukkit.event.player.PlayerKickEvent.Cause kickCause;
+ public DecodeException(Component message, org.bukkit.event.player.PlayerKickEvent.Cause event) {
2024-12-14 18:44:07 +01:00
+ super(message);
2021-05-16 05:30:45 +02:00
+ this.kickCause = event;
2024-12-14 18:44:07 +01:00
+ }
2021-05-16 05:30:45 +02:00
+ // Paper end
+ public DecodeException(Component message) {
+ this(message, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); // Paper
2024-12-14 18:44:07 +01:00
}
2021-05-16 05:30:45 +02:00
}