Remove obsolete tab lists

This commit is contained in:
md_5 2017-12-01 12:25:54 +11:00
parent ed23e3b3d1
commit eb288a80c3
3 changed files with 0 additions and 195 deletions

View File

@ -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<String> g = bungee.getConfigurationAdapter().getGroups( name );

View File

@ -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<ProxiedPlayer> 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 );
}
}

View File

@ -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 );
}
}
}