Skip to content

Commit

Permalink
[Scoreboard] Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
NEZNAMY committed Feb 3, 2025
1 parent 79e56c6 commit d5a0ae8
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,14 @@ public void addPlayer(@NonNull TabPlayer p) {
public void removePlayer(@NonNull TabPlayer p) {
if (p.scoreboardData.activeScoreboard != this) return; // not registered
p.getScoreboard().unregisterObjective(ScoreboardManagerImpl.OBJECTIVE_NAME);
for (Line line : lines) {
if (((ScoreboardLine)line).isShownTo(p))
p.getScoreboard().unregisterTeam(((ScoreboardLine)line).getTeamName());
for (Line l : lines) {
ScoreboardLine line = (ScoreboardLine) l;
if (line.isShownTo(p)) {
p.getScoreboard().unregisterTeam(line.getTeamName());
line.removePlayerSilently(p);
}
}
players.remove(p);
p.scoreboardData.activeScoreboard = null;
p.scoreboardData.titleProperty = null;
p.scoreboardData.lineProperties.clear();
Expand Down

0 comments on commit d5a0ae8

Please sign in to comment.