Skip to content

Commit

Permalink
Reset the scoreboard in the configuration stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim203 committed Nov 2, 2024
1 parent 67a1805 commit d61ad7b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public WorldCache(GeyserSession session) {
resetTitleTimes(false);
}

public void removeScoreboard() {
public void resetScoreboard() {
scoreboard.removeScoreboard();
scoreboard = new Scoreboard(session);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,11 @@ public void translate(GeyserSession session, ClientboundFinishConfigurationPacke
}
session.sendUpstreamPacket(playerListPacket);
session.getEntityCache().removeAllPlayerEntities();

// while ClientboundLoginPacket holds the level, it doesn't hold the scoreboard.
// The ClientboundStartConfigurationPacket indirectly removes the old scoreboard,
// and this packet indirectly creates the new one.
// This makes this packet a good place to reset the scoreboard.
session.getWorldCache().resetScoreboard();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ public void translate(GeyserSession session, ClientboundLoginPacket packet) {
DimensionUtils.fastSwitchDimension(session, fakeDim);
}

session.getWorldCache().removeScoreboard();

// Remove all bossbars
session.getEntityCache().removeAllBossBars();
// Remove extra hearts, hunger, etc.
Expand Down

0 comments on commit d61ad7b

Please sign in to comment.