mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-30 22:24:18 +01:00
Custom glist formatting
This commit is contained in:
parent
dd06937a3b
commit
b541e7aa76
@ -53,7 +53,7 @@ public abstract class ProxyServer
|
|||||||
*
|
*
|
||||||
* @return the localized string
|
* @return the localized string
|
||||||
*/
|
*/
|
||||||
public abstract String getTranslation(String name);
|
public abstract String getTranslation(String name, Object... args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the main logger which can be used as a suitable replacement for
|
* Gets the main logger which can be used as a suitable replacement for
|
||||||
|
@ -20,6 +20,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.text.MessageFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -368,12 +369,12 @@ public class BungeeCord extends ProxyServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslation(String name)
|
public String getTranslation(String name, Object... args)
|
||||||
{
|
{
|
||||||
String translation = "<translation '" + name + "' missing>";
|
String translation = "<translation '" + name + "' missing>";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
translation = bundle.getString( name );
|
translation = MessageFormat.format( bundle.getString( name ), args );
|
||||||
} catch ( MissingResourceException ex )
|
} catch ( MissingResourceException ex )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.md_5.bungee.command;
|
package net.md_5.bungee.command;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.md_5.bungee.Util;
|
import net.md_5.bungee.Util;
|
||||||
@ -33,31 +32,16 @@ public class CommandList extends Command
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<ProxiedPlayer> serverPlayers = server.getPlayers();
|
|
||||||
|
|
||||||
StringBuilder message = new StringBuilder();
|
|
||||||
message.append( ChatColor.GREEN );
|
|
||||||
message.append( "[" );
|
|
||||||
message.append( server.getName() );
|
|
||||||
message.append( "] " );
|
|
||||||
message.append( ChatColor.YELLOW );
|
|
||||||
message.append( "(" );
|
|
||||||
message.append( serverPlayers.size() );
|
|
||||||
message.append( "): " );
|
|
||||||
message.append( ChatColor.RESET );
|
|
||||||
|
|
||||||
List<String> players = new ArrayList<>();
|
List<String> players = new ArrayList<>();
|
||||||
for ( ProxiedPlayer player : serverPlayers )
|
for ( ProxiedPlayer player : server.getPlayers() )
|
||||||
{
|
{
|
||||||
players.add( player.getDisplayName() );
|
players.add( player.getDisplayName() );
|
||||||
}
|
}
|
||||||
Collections.sort( players, String.CASE_INSENSITIVE_ORDER );
|
Collections.sort( players, String.CASE_INSENSITIVE_ORDER );
|
||||||
|
|
||||||
message.append( Util.format( players, ChatColor.RESET + ", " ) );
|
sender.sendMessage( ProxyServer.getInstance().getTranslation( "command_list", server.getName(), server.getPlayers().size(), Util.format( players, ChatColor.RESET + ", " ) ) );
|
||||||
|
|
||||||
sender.sendMessage( message.toString() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "total_players" ) + ProxyServer.getInstance().getOnlineCount() );
|
sender.sendMessage( ProxyServer.getInstance().getTranslation( "total_players", ProxyServer.getInstance().getOnlineCount() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
alert=\u00a78[\u00a74Alert\u00a78]\u00a7r
|
alert=\u00a78[\u00a74Alert\u00a78]\u00a7r
|
||||||
already_connected=\u00a7cYou are already connected to this server
|
already_connected=\u00a7cYou are already connected to this server
|
||||||
already_connecting=\u00a7cAlready connecting to this server!
|
already_connecting=\u00a7cAlready connecting to this server!
|
||||||
|
command_list=\u00a7a[{0}] \u00a7e({1}): \u00a7r{2}
|
||||||
connect_kick=\u00a7cKicked whilst connecting to
|
connect_kick=\u00a7cKicked whilst connecting to
|
||||||
current_server=\u00a76You are currently connected to
|
current_server=\u00a76You are currently connected to
|
||||||
fallback_kick=\u00a7cCould not connect to default server, please try again later:
|
fallback_kick=\u00a7cCould not connect to default server, please try again later:
|
||||||
@ -17,4 +18,4 @@ restart=[Proxy] Proxy restarting.
|
|||||||
server_kick=[Kicked]
|
server_kick=[Kicked]
|
||||||
server_list=\u00a76You may connect to the following servers at this time:
|
server_list=\u00a76You may connect to the following servers at this time:
|
||||||
server_went_down=\u00a7cThe server you were previously on went down, you have been connected to the lobby
|
server_went_down=\u00a7cThe server you were previously on went down, you have been connected to the lobby
|
||||||
total_players=Total players online:
|
total_players=Total players online: {0}
|
||||||
|
Loading…
Reference in New Issue
Block a user