Skip to content

Commit

Permalink
fixed /layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanguygab committed Mar 24, 2021
1 parent 1118c04 commit 8cae0cb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public class Layout {
private final Map<Object, List<Integer>> lists = new HashMap<>();
private final Map<Object,Sorting> sorting = new HashMap<>();

Map<TabPlayer, Map<Integer, String>> skinsp = new HashMap<>();
Map<TabPlayer, Map<Integer, String>> skinss = new HashMap<>();
Map<TabPlayer, Map<Integer, String>> skinsl = new HashMap<>();
protected final Map<TabPlayer, Map<Integer, String>> skinsp = new HashMap<>();
protected final Map<TabPlayer, Map<Integer, String>> skinss = new HashMap<>();
protected final Map<TabPlayer, Map<Integer, String>> skinsl = new HashMap<>();


public Layout(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -104,11 +105,15 @@ public void removeLayout() {
List<TabPlayer> 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<PacketPlayOutPlayerInfo.PlayerInfoData> 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);
}
}
Expand Down Expand Up @@ -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);
}
}

0 comments on commit 8cae0cb

Please sign in to comment.