Skip to content

Commit

Permalink
Fix player based memory leak
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Herrera <[email protected]>
  • Loading branch information
Pablete1234 committed Aug 15, 2024
1 parent 3c49997 commit 1b1b10c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/src/main/java/tc/oc/pgm/tablist/MatchTabManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ public PlayerTabEntry getPlayerEntry(MatchPlayer player) {
return (PlayerTabEntry) this.getPlayerEntry(player.getBukkit());
}

public PlayerTabEntry getPlayerEntryOrNull(MatchPlayer player) {
return (PlayerTabEntry) this.getPlayerEntryOrNull(player.getBukkit());
}

public TeamTabEntry getTeamEntry(Team team) {
return this.teamEntries.get(team);
}
Expand All @@ -235,7 +239,8 @@ public MatchFooterTabEntry getFooterEntry(Match match) {
}

protected void invalidate(MatchPlayer player) {
getPlayerEntry(player).invalidate();
var entry = getPlayerEntryOrNull(player);
if (entry != null) entry.invalidate();
for (Contributor author : player.getMatch().getMap().getAuthors()) {
if (author.isPlayer(player.getId())) {
MapTabEntry mapEntry = mapEntries.get(player.getMatch());
Expand Down

0 comments on commit 1b1b10c

Please sign in to comment.