diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/Layout.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/Layout.java index cdc1daa..d46de5d 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/Layout.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/Layout.java @@ -28,9 +28,9 @@ public class Layout { private final Map> lists = new HashMap<>(); private final Map sorting = new HashMap<>(); - Map> skinsp = new HashMap<>(); - Map> skinss = new HashMap<>(); - Map> skinsl = new HashMap<>(); + protected final Map> skinsp = new HashMap<>(); + protected final Map> skinss = new HashMap<>(); + protected final Map> skinsl = new HashMap<>(); public Layout(String name) { diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/LayoutManager.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/LayoutManager.java index 5bf3ad1..002b120 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/LayoutManager.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/LayoutManager.java @@ -9,11 +9,12 @@ import me.neznamy.tab.shared.features.types.Loadable; import me.neznamy.tab.shared.features.types.event.CommandListener; import me.neznamy.tab.shared.features.types.event.JoinEventListener; +import me.neznamy.tab.shared.features.types.event.QuitEventListener; import me.neznamy.tab.shared.packets.PacketPlayOutPlayerInfo; import java.util.*; -public class LayoutManager implements Loadable, JoinEventListener, CommandListener { +public class LayoutManager implements Loadable, JoinEventListener, CommandListener, QuitEventListener { private static LayoutManager instance; private final TabFeature feature; @@ -104,11 +105,15 @@ public void removeLayout() { List list = new ArrayList<>(toRemove.keySet()); for (TabPlayer p : list) { Layout layout = layouts.get(toRemove.get(p)); - if (layout != null && !toggledOff.contains(p)) { + if (layout != null) { List fps = new ArrayList<>(layout.fakeplayers.values()); p.sendCustomPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, fps)); players.remove(p); layout.players.remove(p); + layout.placeholdersToRefresh.remove(p); + layout.skinsl.remove(p); + layout.skinsp.remove(p); + layout.skinss.remove(p); toRemove.remove(p); } } @@ -166,4 +171,11 @@ public void onJoin(TabPlayer p) { toAdd.put(p,getLayout(p)); } + @Override + public void onQuit(TabPlayer p) { + toAdd.remove(p); + toggledOff.remove(p); + toRemove.remove(p); + players.remove(p); + } }