From e3e551d82586fa6702aef25cda7a23cd0f5f77ae Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Fri, 6 Dec 2013 23:00:32 +0000 Subject: [PATCH] Use varargs instead of arrays --- api/src/main/java/net/md_5/bungee/api/CommandSender.java | 2 +- api/src/main/java/net/md_5/bungee/api/ProxyServer.java | 2 +- .../main/java/net/md_5/bungee/api/chat/BaseComponent.java | 4 ++-- .../java/net/md_5/bungee/api/connection/Connection.java | 2 +- proxy/src/main/java/net/md_5/bungee/BungeeCord.java | 2 +- proxy/src/main/java/net/md_5/bungee/ServerConnection.java | 2 +- proxy/src/main/java/net/md_5/bungee/UserConnection.java | 8 ++++---- .../java/net/md_5/bungee/chat/ComponentSerializer.java | 2 +- .../net/md_5/bungee/command/ConsoleCommandSender.java | 2 +- .../java/net/md_5/bungee/connection/InitialHandler.java | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/api/src/main/java/net/md_5/bungee/api/CommandSender.java b/api/src/main/java/net/md_5/bungee/api/CommandSender.java index 96248935..4a8f6bcd 100644 --- a/api/src/main/java/net/md_5/bungee/api/CommandSender.java +++ b/api/src/main/java/net/md_5/bungee/api/CommandSender.java @@ -36,7 +36,7 @@ public interface CommandSender * * @param message the message to send */ - public void sendMessage(BaseComponent[] message); + public void sendMessage(BaseComponent... message); /** * Send a message to this sender. diff --git a/api/src/main/java/net/md_5/bungee/api/ProxyServer.java b/api/src/main/java/net/md_5/bungee/api/ProxyServer.java index 06155010..f2ef12d0 100644 --- a/api/src/main/java/net/md_5/bungee/api/ProxyServer.java +++ b/api/src/main/java/net/md_5/bungee/api/ProxyServer.java @@ -240,7 +240,7 @@ public abstract class ProxyServer * * @param message the message to broadcast */ - public abstract void broadcast(BaseComponent[] message); + public abstract void broadcast(BaseComponent... message); /** * Send the specified message to the console and all connected players. diff --git a/api/src/main/java/net/md_5/bungee/api/chat/BaseComponent.java b/api/src/main/java/net/md_5/bungee/api/chat/BaseComponent.java index 4162267d..f004a330 100644 --- a/api/src/main/java/net/md_5/bungee/api/chat/BaseComponent.java +++ b/api/src/main/java/net/md_5/bungee/api/chat/BaseComponent.java @@ -50,7 +50,7 @@ public abstract class BaseComponent setObfuscated( old.isObfuscatedRaw() ); } - public static String toLegacyText(BaseComponent[] components) + public static String toLegacyText(BaseComponent... components) { StringBuilder builder = new StringBuilder(); for ( BaseComponent msg : components ) @@ -60,7 +60,7 @@ public abstract class BaseComponent return builder.toString(); } - public static String toPlainText(BaseComponent[] components) + public static String toPlainText(BaseComponent... components) { StringBuilder builder = new StringBuilder(); for ( BaseComponent msg : components ) diff --git a/api/src/main/java/net/md_5/bungee/api/connection/Connection.java b/api/src/main/java/net/md_5/bungee/api/connection/Connection.java index fb146164..4e2068b9 100644 --- a/api/src/main/java/net/md_5/bungee/api/connection/Connection.java +++ b/api/src/main/java/net/md_5/bungee/api/connection/Connection.java @@ -39,7 +39,7 @@ public interface Connection * @param reason the reason shown to the player / sent to the server on * disconnect */ - void disconnect(BaseComponent[] reason); + void disconnect(BaseComponent... reason); /** * Disconnects this end of the connection for the specified reason. If this 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 baf0ee11..4b746c95 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -493,7 +493,7 @@ public class BungeeCord extends ProxyServer } @Override - public void broadcast(BaseComponent[] message) + public void broadcast(BaseComponent... message) { getConsole().sendMessage( BaseComponent.toLegacyText( message ) ); broadcast( new Chat( ComponentSerializer.toString( message ) ) ); diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnection.java b/proxy/src/main/java/net/md_5/bungee/ServerConnection.java index e86240bd..b8e35b12 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnection.java @@ -47,7 +47,7 @@ public class ServerConnection implements Server } @Override - public void disconnect(BaseComponent[] reason) + public void disconnect(BaseComponent... reason) { if ( !ch.isClosed() ) { diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 6045b21f..e51ec343 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -263,7 +263,7 @@ public final class UserConnection implements ProxiedPlayer } @Override - public void disconnect(BaseComponent[] reason) + public void disconnect(BaseComponent... reason) { disconnect0( reason ); } @@ -271,10 +271,10 @@ public final class UserConnection implements ProxiedPlayer @Override public void disconnect(BaseComponent reason) { - disconnect0( new BaseComponent[]{reason} ); + disconnect0( reason ); } - public synchronized void disconnect0(BaseComponent[] reason) + public synchronized void disconnect0(BaseComponent ...reason) { if ( ch.getHandle().isActive() ) { @@ -311,7 +311,7 @@ public final class UserConnection implements ProxiedPlayer } @Override - public void sendMessage(BaseComponent[] message) + public void sendMessage(BaseComponent... message) { unsafe().sendPacket( new Chat( ComponentSerializer.toString( message ) ) ); } diff --git a/proxy/src/main/java/net/md_5/bungee/chat/ComponentSerializer.java b/proxy/src/main/java/net/md_5/bungee/chat/ComponentSerializer.java index 58dbc3f1..c019f7ac 100644 --- a/proxy/src/main/java/net/md_5/bungee/chat/ComponentSerializer.java +++ b/proxy/src/main/java/net/md_5/bungee/chat/ComponentSerializer.java @@ -38,7 +38,7 @@ public class ComponentSerializer implements JsonSerializer, JsonD return gson.toJson( component ); } - public static String toString(BaseComponent[] components) + public static String toString(BaseComponent... components) { return gson.toJson( components ); } diff --git a/proxy/src/main/java/net/md_5/bungee/command/ConsoleCommandSender.java b/proxy/src/main/java/net/md_5/bungee/command/ConsoleCommandSender.java index ba159474..d6e8b79f 100644 --- a/proxy/src/main/java/net/md_5/bungee/command/ConsoleCommandSender.java +++ b/proxy/src/main/java/net/md_5/bungee/command/ConsoleCommandSender.java @@ -36,7 +36,7 @@ public class ConsoleCommandSender implements CommandSender } @Override - public void sendMessage(BaseComponent[] message) + public void sendMessage(BaseComponent... message) { sendMessage( BaseComponent.toLegacyText( message ) ); } diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index 4a326c24..9d33c05e 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -406,7 +406,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection } @Override - public void disconnect(BaseComponent[] reason) + public void disconnect(BaseComponent... reason) { if ( !ch.isClosed() ) {