mirror of
https://github.com/PaperMC/Velocity.git
synced 2026-02-17 14:37:43 +01:00
Fix TabList population
Bug reported by JakubBien on Discord
This commit is contained in:
@@ -215,7 +215,8 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(PlayerListItem packet) {
|
public boolean handle(PlayerListItem packet) {
|
||||||
return !serverConn.getPlayer().getTabList().processBackendPacket(packet);
|
serverConn.getPlayer().getTabList().processBackendPacket(packet);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -142,9 +142,8 @@ public class VelocityTabList implements TabList {
|
|||||||
* Processes a tab list entry packet from the backend.
|
* Processes a tab list entry packet from the backend.
|
||||||
*
|
*
|
||||||
* @param packet the packet to process
|
* @param packet the packet to process
|
||||||
* @return {@code true} to forward the packet on, {@code false} otherwise
|
|
||||||
*/
|
*/
|
||||||
public boolean processBackendPacket(PlayerListItem packet) {
|
public void processBackendPacket(PlayerListItem packet) {
|
||||||
// Packets are already forwarded on, so no need to do that here
|
// Packets are already forwarded on, so no need to do that here
|
||||||
for (PlayerListItem.Item item : packet.getItems()) {
|
for (PlayerListItem.Item item : packet.getItems()) {
|
||||||
UUID uuid = item.getUuid();
|
UUID uuid = item.getUuid();
|
||||||
@@ -163,13 +162,14 @@ public class VelocityTabList implements TabList {
|
|||||||
if (name == null || properties == null) {
|
if (name == null || properties == null) {
|
||||||
throw new IllegalStateException("Got null game profile for ADD_PLAYER");
|
throw new IllegalStateException("Got null game profile for ADD_PLAYER");
|
||||||
}
|
}
|
||||||
return entries.putIfAbsent(item.getUuid(), (VelocityTabListEntry) TabListEntry.builder()
|
entries.putIfAbsent(item.getUuid(), (VelocityTabListEntry) TabListEntry.builder()
|
||||||
.tabList(this)
|
.tabList(this)
|
||||||
.profile(new GameProfile(uuid, name, properties))
|
.profile(new GameProfile(uuid, name, properties))
|
||||||
.displayName(item.getDisplayName())
|
.displayName(item.getDisplayName())
|
||||||
.latency(item.getLatency())
|
.latency(item.getLatency())
|
||||||
.gameMode(item.getGameMode())
|
.gameMode(item.getGameMode())
|
||||||
.build()) == null;
|
.build());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case PlayerListItem.REMOVE_PLAYER:
|
case PlayerListItem.REMOVE_PLAYER:
|
||||||
entries.remove(uuid);
|
entries.remove(uuid);
|
||||||
@@ -200,7 +200,6 @@ public class VelocityTabList implements TabList {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateEntry(int action, TabListEntry entry) {
|
void updateEntry(int action, TabListEntry entry) {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class VelocityTabListLegacy extends VelocityTabList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean processBackendPacket(PlayerListItem packet) {
|
public void processBackendPacket(PlayerListItem packet) {
|
||||||
Item item = packet.getItems().get(0); // Only one item per packet in 1.7
|
Item item = packet.getItems().get(0); // Only one item per packet in 1.7
|
||||||
|
|
||||||
switch (packet.getAction()) {
|
switch (packet.getAction()) {
|
||||||
@@ -107,8 +107,6 @@ public class VelocityTabListLegacy extends VelocityTabList {
|
|||||||
// For 1.7 there is only add and remove
|
// For 1.7 there is only add and remove
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user