Deprecate string join
This commit is contained in:
parent
963854f8d5
commit
a1fee720b9
@ -113,6 +113,16 @@ public class Util
|
|||||||
return format( objects, ", " );
|
return format( objects, ", " );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string of objects, each separated by a separator.
|
||||||
|
*
|
||||||
|
* @param objects the objects to join
|
||||||
|
* @param separators the separator
|
||||||
|
* @return joined string
|
||||||
|
* @see String#join(java.lang.CharSequence, java.lang.Iterable)
|
||||||
|
* @deprecated use {@link String} join methods
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static String format(Iterable<?> objects, String separators)
|
public static String format(Iterable<?> objects, String separators)
|
||||||
{
|
{
|
||||||
return Joiner.on( separators ).join( objects );
|
return Joiner.on( separators ).join( objects );
|
||||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
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.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
@ -49,7 +48,7 @@ public class CommandList extends Command implements TabExecutor
|
|||||||
}
|
}
|
||||||
Collections.sort( players, String.CASE_INSENSITIVE_ORDER );
|
Collections.sort( players, String.CASE_INSENSITIVE_ORDER );
|
||||||
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "command_list", server.getName(), players.size(), Util.format( players, ChatColor.RESET + ", " ) ) );
|
sender.sendMessage( ProxyServer.getInstance().getTranslation( "command_list", server.getName(), players.size(), String.join( ChatColor.RESET + ", ", players ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "total_players", ProxyServer.getInstance().getOnlineCount() ) );
|
sender.sendMessage( ProxyServer.getInstance().getTranslation( "total_players", ProxyServer.getInstance().getOnlineCount() ) );
|
||||||
|
@ -687,10 +687,10 @@ public class BungeeCord extends ProxyServer
|
|||||||
{
|
{
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
|
||||||
{
|
{
|
||||||
return new PluginMessage( "minecraft:register", Util.format( Iterables.transform( pluginChannels, PluginMessage.MODERNISE ), "\00" ).getBytes( Charsets.UTF_8 ), false );
|
return new PluginMessage( "minecraft:register", String.join( "\00", Iterables.transform( pluginChannels, PluginMessage.MODERNISE ) ).getBytes( Charsets.UTF_8 ), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PluginMessage( "REGISTER", Util.format( pluginChannels, "\00" ).getBytes( Charsets.UTF_8 ), false );
|
return new PluginMessage( "REGISTER", String.join( "\00", pluginChannels ).getBytes( Charsets.UTF_8 ), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user