Improve the CommandServer tooltip

Includes the grammar fix from #953
This commit is contained in:
Thinkofdeath 2014-04-25 20:53:10 +01:00
parent 8fe72383a1
commit 9e46739343

View File

@ -48,7 +48,11 @@ public class CommandServer extends Command implements TabExecutor
if ( server.canAccess( player ) )
{
TextComponent serverTextComponent = new TextComponent( first ? server.getName() : ", " + server.getName() );
serverTextComponent.setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( server.getPlayers().size() + " players" ).create() ) );
int count = server.getPlayers().size();
serverTextComponent.setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder( count + (count == 1 ? " player" : " players") + "\n")
.append( "Click to connect to the server" ).italic( true )
.create() ) );
serverTextComponent.setClickEvent( new ClickEvent( ClickEvent.Action.RUN_COMMAND, "/server " + server.getName() ) );
serverList.addExtra( serverTextComponent );
first = false;