use of com.velocitypowered.proxy.connection.backend.BackendPlaySessionHandler in project LimboAPI by Elytrium.
the class PlayerListItemHook method handle.
@Override
public boolean handle(MinecraftSessionHandler handler) {
if (handler instanceof BackendPlaySessionHandler) {
try {
List<Item> items = this.getItems();
for (int i = 0; i < items.size(); ++i) {
Item item = items.get(i);
ConnectedPlayer player = ((VelocityServerConnection) serverConnField.get(handler)).getPlayer();
UUID initialID = this.plugin.getInitialID(player);
if (player.getUniqueId().equals(item.getUuid())) {
items.set(i, new Item(initialID).setDisplayName(item.getDisplayName()).setGameMode(item.getGameMode()).setLatency(item.getLatency()).setName(item.getName()).setProperties(item.getProperties()));
}
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
return super.handle(handler);
}
Aggregations