geforkt von SteamWar/BungeeCore
Merge pull request 'Fix tablist failure on softreload' (#424) from fixSoftreload into master
Reviewed-on: SteamWar/BungeeCore#424 Reviewed-by: Chaoscaot <chaoscaot@zohomail.eu>
Dieser Commit ist enthalten in:
Commit
bd86c81e7f
@ -62,7 +62,7 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
|
|||||||
this.player = player;
|
this.player = player;
|
||||||
this.viewer = ChatSender.of(player);
|
this.viewer = ChatSender.of(player);
|
||||||
this.directTabItems = Storage.directTabItems.computeIfAbsent(player, p -> new HashMap<>());
|
this.directTabItems = Storage.directTabItems.computeIfAbsent(player, p -> new HashMap<>());
|
||||||
onServerSwitch();
|
injection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(TablistPart global, int seconds) {
|
public void update(TablistPart global, int seconds) {
|
||||||
@ -145,12 +145,17 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onServerSwitch() {
|
public void onServerSwitch() {
|
||||||
connection = (ServerConnection) player.getServer();
|
injection();
|
||||||
|
|
||||||
synchronized (directTabItems) {
|
synchronized (directTabItems) {
|
||||||
sendNpcPacket(npcs.stream().map(npc -> directTabItems.get(npc).getUsername()).collect(Collectors.toList()), true);
|
sendNpcPacket(npcs.stream().map(npc -> directTabItems.get(npc).getUsername()).collect(Collectors.toList()), true);
|
||||||
directTabItems.clear();
|
directTabItems.clear();
|
||||||
npcs.clear();
|
npcs.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void injection() {
|
||||||
|
connection = (ServerConnection) player.getServer();
|
||||||
|
|
||||||
if(connection != null) {
|
if(connection != null) {
|
||||||
ChannelPipeline pipeline = connection.getCh().getHandle().pipeline();
|
ChannelPipeline pipeline = connection.getCh().getHandle().pipeline();
|
||||||
|
@ -51,8 +51,10 @@ public class TablistManager extends BasicListener {
|
|||||||
|
|
||||||
public TablistManager() {
|
public TablistManager() {
|
||||||
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), this::updateTablist, 1, 1, TimeUnit.SECONDS);
|
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), this::updateTablist, 1, 1, TimeUnit.SECONDS);
|
||||||
|
synchronized (tablists) {
|
||||||
ProxyServer.getInstance().getPlayers().forEach(player -> tablists.put(player, new Tablist(player)));
|
ProxyServer.getInstance().getPlayers().forEach(player -> tablists.put(player, new Tablist(player)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoin(PostLoginEvent event) {
|
public void onJoin(PostLoginEvent event) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren