Skip to content

Commit

Permalink
Fix tab entries dirty set leaking views, players & worlds (#1384)
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Herrera <[email protected]>
  • Loading branch information
Pablete1234 committed Nov 30, 2024
1 parent 4e147c4 commit 8487608
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions util/src/main/java/tc/oc/pgm/util/tablist/TabView.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package tc.oc.pgm.util.tablist;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import net.kyori.adventure.text.Component;
Expand Down Expand Up @@ -338,8 +337,10 @@ private void tearDown() {
if (this.manager == null) return;

if (this.display != null) {
Arrays.fill(this.slots, null);
Arrays.fill(this.rendered, null);
for (int index = 0; index < this.size; index++) {
this.slots[index].removeFromView(this);
this.slots[index] = this.rendered[index] = null;
}
display.tearDown();

return;
Expand All @@ -352,6 +353,7 @@ private void tearDown() {
this.manager.getBlankEntry(this.footerSlot).getContent(this));

for (int index = 0; index < this.size; index++) {
this.slots[index].removeFromView(this);
render.destroySlot(this.rendered[index], index);
this.slots[index] = this.rendered[index] = null;
}
Expand Down Expand Up @@ -383,21 +385,13 @@ protected void updateFakeEntity(TabEntry entry) {
private void respawnFakeEntities() {
if (this.manager == null || this.display != null) return;

this.viewer
.getServer()
.getScheduler()
.runTask(
this.manager.getPlugin(),
new Runnable() {
@Override
public void run() {
TabRender render = new TabRender(TabView.this);
for (TabEntry entry : TabView.this.rendered) {
render.updateFakeEntity(entry, true);
}
render.finish();
}
});
this.viewer.getServer().getScheduler().runTask(this.manager.getPlugin(), () -> {
TabRender render = new TabRender(TabView.this);
for (TabEntry entry : TabView.this.rendered) {
render.updateFakeEntity(entry, true);
}
render.finish();
});
}

protected void onRespawn(PlayerRespawnEvent event) {
Expand Down

0 comments on commit 8487608

Please sign in to comment.