|
36 | 36 | import lombok.Getter; |
37 | 37 | import lombok.Setter; |
38 | 38 | import lombok.SneakyThrows; |
| 39 | +import net.kyori.adventure.key.Key; |
39 | 40 | import net.raphimc.minecraftauth.bedrock.exception.MinecraftRequestException; |
40 | 41 | import org.geysermc.mcprotocollib.auth.GameProfile; |
41 | 42 | import org.geysermc.mcprotocollib.network.ProxyInfo; |
42 | 43 | import org.geysermc.mcprotocollib.network.tcp.TcpConnectionManager; |
43 | 44 | import org.geysermc.mcprotocollib.network.tcp.TcpServer; |
44 | 45 | import org.geysermc.mcprotocollib.protocol.MinecraftConstants; |
45 | 46 | import org.geysermc.mcprotocollib.protocol.MinecraftProtocol; |
| 47 | +import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ServerboundCookieResponsePacket; |
46 | 48 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundTabListPacket; |
47 | | -import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundChatPacket; |
48 | 49 | import org.jspecify.annotations.NonNull; |
49 | 50 | import org.jspecify.annotations.Nullable; |
50 | 51 | import org.slf4j.LoggerFactory; |
@@ -431,10 +432,8 @@ public void disconnect(final String reason) { |
431 | 432 | public void kickDisconnect(final String reason, final Throwable cause) { |
432 | 433 | if (!isConnected()) return; |
433 | 434 | var client = this.client; |
434 | | - |
435 | 435 | try { |
436 | | - // todo: find an alternative method other than chat |
437 | | - client.send(new ServerboundChatPacket("§")).get(); |
| 436 | + client.send(new ServerboundCookieResponsePacket(Key.key("minecraft", "pls_kick"), null)).get(); |
438 | 437 | } catch (final Exception e) { |
439 | 438 | CLIENT_LOG.error("Error performing kick disconnect", e); |
440 | 439 | } |
|
0 commit comments