Add API for quit reason
This commit is contained in:
@@ -153,7 +153,7 @@
|
||||
+ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
+ ResourceLocation identifier = packet.payload().type().id();
|
||||
+ ByteBuf payload = ((DiscardedPayload)packet.payload()).data();
|
||||
|
||||
+
|
||||
+ if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_REGISTER)) {
|
||||
+ try {
|
||||
+ String channels = payload.toString(com.google.common.base.Charsets.UTF_8);
|
||||
@@ -193,7 +193,7 @@
|
||||
+ this.disconnect(Component.literal("Invalid custom payload!"));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
+ }
|
||||
+
|
||||
+ public final boolean isDisconnected() {
|
||||
@@ -281,7 +281,7 @@
|
||||
if (packet.isTerminal()) {
|
||||
this.close();
|
||||
}
|
||||
@@ -175,20 +328,72 @@
|
||||
@@ -175,20 +328,73 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,6 +342,7 @@
|
||||
+
|
||||
+ private void disconnect0(DisconnectionDetails disconnectiondetails) {
|
||||
+ // CraftBukkit end
|
||||
+ this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper - Add API for quit reason
|
||||
+ this.connection.send(new ClientboundDisconnectPacket(disconnectiondetails.reason()), PacketSendListener.thenRun(() -> {
|
||||
+ this.connection.disconnect(disconnectiondetails);
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user