diff --git a/api/src/main/java/net/md_5/bungee/Util.java b/api/src/main/java/net/md_5/bungee/Util.java index 1457d4c8a..6352951c5 100644 --- a/api/src/main/java/net/md_5/bungee/Util.java +++ b/api/src/main/java/net/md_5/bungee/Util.java @@ -113,6 +113,16 @@ public class Util 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) { return Joiner.on( separators ).join( objects ); diff --git a/module/cmd-list/src/main/java/net/md_5/bungee/module/cmd/list/CommandList.java b/module/cmd-list/src/main/java/net/md_5/bungee/module/cmd/list/CommandList.java index c4ac9173f..79d0bb216 100644 --- a/module/cmd-list/src/main/java/net/md_5/bungee/module/cmd/list/CommandList.java +++ b/module/cmd-list/src/main/java/net/md_5/bungee/module/cmd/list/CommandList.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; -import net.md_5.bungee.Util; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; 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 ); - 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() ) ); diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index c2fe9a407..061ff1751 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -687,10 +687,10 @@ public class BungeeCord extends ProxyServer { 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