geforkt von Mirrors/Velocity
Do tab list clearing into one packet
Dieser Commit ist enthalten in:
Ursprung
49b09713f8
Commit
b6a9299f9f
@ -240,11 +240,8 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
player.getConnection().setCanSendLegacyFMLResetPacket(true);
|
||||
} else {
|
||||
// Clear tab list to avoid duplicate entries
|
||||
TabList tabList = player.getTabList();
|
||||
tabList.getEntries().forEach(entry -> tabList.removeEntry(entry.getProfile().idAsUuid()));
|
||||
player.getTabList().clearAll();
|
||||
|
||||
// Ah, this is the meat and potatoes of the whole venture!
|
||||
//
|
||||
// In order to handle switching to another server, you will need to send three packets:
|
||||
//
|
||||
// - The join game packet from the backend server
|
||||
@ -271,7 +268,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
}
|
||||
serverBossBars.clear();
|
||||
|
||||
// Tell the server about this client's plugin messages. Velocity will forward them on to the client.
|
||||
// Tell the server about this client's plugin message channels.
|
||||
Collection<String> toRegister = new HashSet<>(clientPluginMsgChannels);
|
||||
if (player.getProtocolVersion() >= ProtocolConstants.MINECRAFT_1_13) {
|
||||
toRegister.addAll(server.getChannelRegistrar().getModernChannelIds());
|
||||
|
@ -10,12 +10,7 @@ import com.velocitypowered.proxy.protocol.packet.HeaderAndFooter;
|
||||
import com.velocitypowered.proxy.protocol.packet.PlayerListItem;
|
||||
import net.kyori.text.Component;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class VelocityTabList implements TabList {
|
||||
@ -60,6 +55,15 @@ public class VelocityTabList implements TabList {
|
||||
return Optional.ofNullable(entry);
|
||||
}
|
||||
|
||||
public void clearAll() { // Note: this method is called upon server switch
|
||||
List<PlayerListItem.Item> items = new ArrayList<>();
|
||||
for (TabListEntry value : entries.values()) {
|
||||
items.add(PlayerListItem.Item.from(value));
|
||||
}
|
||||
entries.clear();
|
||||
connection.delayedWrite(new PlayerListItem(PlayerListItem.Action.REMOVE_PLAYER, items));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<TabListEntry> getEntries() {
|
||||
return Collections.unmodifiableCollection(this.entries.values());
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren