Allow setting tab list size per listener see #173

This commit is contained in:
md_5 2013-03-04 22:52:53 +11:00
parent efcf4c6a59
commit 5c1d7e1c5b
3 changed files with 11 additions and 3 deletions

View File

@ -24,6 +24,10 @@ public class ListenerInfo
* Max amount of slots displayed on the ping page.
*/
private final int maxPlayers;
/**
* Number of players to be shown on the tab list.
*/
private final int tabListSize;
/**
* Name of the server which users will be taken to by default.
*/

View File

@ -27,7 +27,7 @@ import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.event.ServerConnectEvent;
import net.md_5.bungee.packet.*;
public class UserConnection extends GenericConnection implements ProxiedPlayer
public final class UserConnection extends GenericConnection implements ProxiedPlayer
{
public final Packet2Handshake handshake;
@ -119,7 +119,10 @@ public class UserConnection extends GenericConnection implements ProxiedPlayer
// Once again, first connection
clientEntityId = newServer.loginPacket.entityId;
serverEntityId = newServer.loginPacket.entityId;
stream.write( newServer.loginPacket );
// Set tab list size
Packet1Login s = newServer.loginPacket;
Packet1Login login = new Packet1Login( s.entityId, s.levelType, s.gameMode, (byte) s.dimension, s.difficulty, s.unused, (byte) pendingConnection.getListener().getTabListSize() );
stream.write( login );
stream.write( BungeeCord.getInstance().registerChannels() );
upBridge = new UpstreamBridge();

View File

@ -181,9 +181,10 @@ public class YamlConfig implements ConfigurationAdapter
String defaultServer = get( "default_server", "lobby", val );
boolean forceDefault = get( "force_default_server", false, val );
String host = get( "host", "0.0.0.0:25577", val );
int tabListSize = get( "tab_size", 60, val );
InetSocketAddress address = Util.getAddr( host );
Map<String, String> forced = get( "forced_hosts", forcedDef, val );
ListenerInfo info = new ListenerInfo( address, motd, maxPlayers, defaultServer, forceDefault, forced );
ListenerInfo info = new ListenerInfo( address, motd, maxPlayers, tabListSize, defaultServer, forceDefault, forced );
ret.add( info );
}