Add PlayerKickEvent causes

This commit is contained in:
Jake Potrebic
2021-05-15 20:30:45 -07:00
parent e8cb0ac761
commit 75225eb102
12 changed files with 267 additions and 65 deletions

View File

@@ -0,0 +1,28 @@
--- a/net/minecraft/world/entity/player/ProfilePublicKey.java
+++ b/net/minecraft/world/entity/player/ProfilePublicKey.java
@@ -24,7 +24,7 @@
public static ProfilePublicKey createValidated(SignatureValidator servicesSignatureVerifier, UUID playerUuid, ProfilePublicKey.Data publicKeyData) throws ProfilePublicKey.ValidationException {
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);
}
@@ -88,8 +88,16 @@
}
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
}
}
}