Skip to content

Commit

Permalink
Fix previous server information discarding on 1.20.2+
Browse files Browse the repository at this point in the history
  • Loading branch information
UserNugget committed Jan 28, 2024
1 parent b7eb225 commit a4fc37f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions plugin/src/main/java/net/elytrium/limboapi/server/LimboImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,13 @@ public void spawnPlayer(Player apiPlayer, LimboSessionHandler handler) {
boolean shouldSpawnPlayerImmediately = true;

// Discard information from previous server
if (this.plugin.isLimboJoined(player)) {
if (player.getConnection().getActiveSessionHandler() instanceof ClientPlaySessionHandler sessionHandler) {
connection.eventLoop().execute(() -> {
player.getTabList().clearAll();
if (player.getConnection().getActiveSessionHandler() instanceof ClientPlaySessionHandler sessionHandler) {
for (UUID serverBossBar : sessionHandler.getServerBossBars()) {
player.getConnection().delayedWrite(BossBarPacket.createRemovePacket(serverBossBar, null));
}
sessionHandler.getServerBossBars().clear();
for (UUID serverBossBar : sessionHandler.getServerBossBars()) {
player.getConnection().delayedWrite(BossBarPacket.createRemovePacket(serverBossBar, null));
}
sessionHandler.getServerBossBars().clear();

if (player.getProtocolVersion().noLessThan(ProtocolVersion.MINECRAFT_1_8)) {
player.getConnection().delayedWrite(GenericTitlePacket.constructTitlePacket(
Expand Down

0 comments on commit a4fc37f

Please sign in to comment.