From eb288a80c37c4239ffb0ebd6fde3bb02e7fd99a0 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 1 Dec 2017 12:25:54 +1100 Subject: [PATCH] Remove obsolete tab lists --- .../java/net/md_5/bungee/UserConnection.java | 14 -- .../main/java/net/md_5/bungee/tab/Global.java | 140 ------------------ .../java/net/md_5/bungee/tab/GlobalPing.java | 41 ----- 3 files changed, 195 deletions(-) delete mode 100644 proxy/src/main/java/net/md_5/bungee/tab/Global.java delete mode 100644 proxy/src/main/java/net/md_5/bungee/tab/GlobalPing.java diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 93df9747..4c828815 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -153,20 +153,6 @@ public final class UserConnection implements ProxiedPlayer this.displayName = name; - /* - switch ( getPendingConnection().getListener().getTabListType() ) - { - case "GLOBAL": - tabListHandler = new Global( this ); - break; - case "SERVER": - tabListHandler = new ServerUnique( this ); - break; - default: - tabListHandler = new GlobalPing( this ); - break; - } - */ tabListHandler = new ServerUnique( this ); Collection g = bungee.getConfigurationAdapter().getGroups( name ); diff --git a/proxy/src/main/java/net/md_5/bungee/tab/Global.java b/proxy/src/main/java/net/md_5/bungee/tab/Global.java deleted file mode 100644 index 0cf1d218..00000000 --- a/proxy/src/main/java/net/md_5/bungee/tab/Global.java +++ /dev/null @@ -1,140 +0,0 @@ -package net.md_5.bungee.tab; - -import net.md_5.bungee.BungeeCord; -import net.md_5.bungee.UserConnection; -import net.md_5.bungee.api.chat.TextComponent; -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.chat.ComponentSerializer; -import net.md_5.bungee.connection.LoginResult; -import net.md_5.bungee.protocol.packet.PlayerListItem; - -import java.util.Collection; - -public class Global extends TabList -{ - - private boolean sentPing; - - public Global(ProxiedPlayer player) - { - super( player ); - } - - @Override - public void onUpdate(PlayerListItem playerListItem) - { - - } - - @Override - public void onPingChange(int ping) - { - if ( !sentPing ) - { - sentPing = true; - PlayerListItem packet = new PlayerListItem(); - packet.setAction( PlayerListItem.Action.UPDATE_LATENCY ); - PlayerListItem.Item item = new PlayerListItem.Item(); - item.setUuid( player.getUniqueId() ); - item.setUsername( player.getName() ); - item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( player.getDisplayName() ) ) ); - item.setPing( player.getPing() ); - packet.setItems( new PlayerListItem.Item[] - { - item - } ); - BungeeCord.getInstance().broadcast( packet ); - } - } - - @Override - public void onServerChange() - { - - } - - @Override - public void onConnect() - { - PlayerListItem playerListItem = new PlayerListItem(); - playerListItem.setAction( PlayerListItem.Action.ADD_PLAYER ); - Collection players = BungeeCord.getInstance().getPlayers(); - PlayerListItem.Item[] items = new PlayerListItem.Item[ players.size() ]; - playerListItem.setItems( items ); - int i = 0; - for ( ProxiedPlayer p : players ) - { - PlayerListItem.Item item = items[i++] = new PlayerListItem.Item(); - item.setUuid( p.getUniqueId() ); - item.setUsername( p.getName() ); - item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( p.getDisplayName() ) ) ); - LoginResult loginResult = ( (UserConnection) p ).getPendingConnection().getLoginProfile(); - if ( loginResult != null ) - { - String[][] props = new String[ loginResult.getProperties().length ][]; - for ( int j = 0; j < props.length; j++ ) - { - props[j] = new String[] - { - loginResult.getProperties()[j].getName(), - loginResult.getProperties()[j].getValue(), - loginResult.getProperties()[j].getSignature() - }; - } - item.setProperties( props ); - } else - { - item.setProperties( new String[ 0 ][ 0 ] ); - } - item.setGamemode( ( (UserConnection) p ).getGamemode() ); - item.setPing( p.getPing() ); - } - player.unsafe().sendPacket( playerListItem ); - PlayerListItem packet = new PlayerListItem(); - packet.setAction( PlayerListItem.Action.ADD_PLAYER ); - PlayerListItem.Item item = new PlayerListItem.Item(); - item.setUuid( player.getUniqueId() ); - item.setUsername( player.getName() ); - item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( player.getDisplayName() ) ) ); - LoginResult loginResult = ( (UserConnection) player ).getPendingConnection().getLoginProfile(); - if ( loginResult != null ) - { - String[][] props = new String[ loginResult.getProperties().length ][]; - for ( int j = 0; j < props.length; j++ ) - { - props[j] = new String[] - { - loginResult.getProperties()[j].getName(), - loginResult.getProperties()[j].getValue(), - loginResult.getProperties()[j].getSignature() - }; - } - item.setProperties( props ); - } else - { - item.setProperties( new String[ 0 ][ 0 ] ); - } - item.setGamemode( ( (UserConnection) player ).getGamemode() ); - item.setPing( player.getPing() ); - packet.setItems( new PlayerListItem.Item[] - { - item - } ); - BungeeCord.getInstance().broadcast( packet ); - } - - @Override - public void onDisconnect() - { - PlayerListItem packet = new PlayerListItem(); - packet.setAction( PlayerListItem.Action.REMOVE_PLAYER ); - PlayerListItem.Item item = new PlayerListItem.Item(); - item.setUuid( player.getUniqueId() ); - item.setUsername( player.getName() ); - packet.setItems( new PlayerListItem.Item[] - { - item - } ); - BungeeCord.getInstance().broadcast( packet ); - } -} diff --git a/proxy/src/main/java/net/md_5/bungee/tab/GlobalPing.java b/proxy/src/main/java/net/md_5/bungee/tab/GlobalPing.java deleted file mode 100644 index fb4991c1..00000000 --- a/proxy/src/main/java/net/md_5/bungee/tab/GlobalPing.java +++ /dev/null @@ -1,41 +0,0 @@ -package net.md_5.bungee.tab; - -import net.md_5.bungee.BungeeCord; -import net.md_5.bungee.api.chat.TextComponent; -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.chat.ComponentSerializer; -import net.md_5.bungee.protocol.packet.PlayerListItem; - -public class GlobalPing extends Global -{ - - private static final int PING_THRESHOLD = 20; - /*========================================================================*/ - private int lastPing; - - public GlobalPing(ProxiedPlayer player) - { - super( player ); - } - - @Override - public void onPingChange(int ping) - { - if ( ping - PING_THRESHOLD > lastPing && ping + PING_THRESHOLD < lastPing ) - { - lastPing = ping; - PlayerListItem packet = new PlayerListItem(); - packet.setAction( PlayerListItem.Action.UPDATE_LATENCY ); - PlayerListItem.Item item = new PlayerListItem.Item(); - item.setUuid( player.getUniqueId() ); - item.setUsername( player.getName() ); - item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( player.getDisplayName() ) ) ); - item.setPing( player.getPing() ); - packet.setItems( new PlayerListItem.Item[] - { - item - } ); - BungeeCord.getInstance().broadcast( packet ); - } - } -}