mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-24 11:15:47 +01:00
Use varargs instead of arrays
This commit is contained in:
parent
854b6faf0e
commit
e3e551d825
@ -36,7 +36,7 @@ public interface CommandSender
|
|||||||
*
|
*
|
||||||
* @param message the message to send
|
* @param message the message to send
|
||||||
*/
|
*/
|
||||||
public void sendMessage(BaseComponent[] message);
|
public void sendMessage(BaseComponent... message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a message to this sender.
|
* Send a message to this sender.
|
||||||
|
@ -240,7 +240,7 @@ public abstract class ProxyServer
|
|||||||
*
|
*
|
||||||
* @param message the message to broadcast
|
* @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.
|
* Send the specified message to the console and all connected players.
|
||||||
|
@ -50,7 +50,7 @@ public abstract class BaseComponent
|
|||||||
setObfuscated( old.isObfuscatedRaw() );
|
setObfuscated( old.isObfuscatedRaw() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toLegacyText(BaseComponent[] components)
|
public static String toLegacyText(BaseComponent... components)
|
||||||
{
|
{
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
for ( BaseComponent msg : components )
|
for ( BaseComponent msg : components )
|
||||||
@ -60,7 +60,7 @@ public abstract class BaseComponent
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toPlainText(BaseComponent[] components)
|
public static String toPlainText(BaseComponent... components)
|
||||||
{
|
{
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
for ( BaseComponent msg : components )
|
for ( BaseComponent msg : components )
|
||||||
|
@ -39,7 +39,7 @@ public interface Connection
|
|||||||
* @param reason the reason shown to the player / sent to the server on
|
* @param reason the reason shown to the player / sent to the server on
|
||||||
* disconnect
|
* disconnect
|
||||||
*/
|
*/
|
||||||
void disconnect(BaseComponent[] reason);
|
void disconnect(BaseComponent... reason);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disconnects this end of the connection for the specified reason. If this
|
* Disconnects this end of the connection for the specified reason. If this
|
||||||
|
@ -493,7 +493,7 @@ public class BungeeCord extends ProxyServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void broadcast(BaseComponent[] message)
|
public void broadcast(BaseComponent... message)
|
||||||
{
|
{
|
||||||
getConsole().sendMessage( BaseComponent.toLegacyText( message ) );
|
getConsole().sendMessage( BaseComponent.toLegacyText( message ) );
|
||||||
broadcast( new Chat( ComponentSerializer.toString( message ) ) );
|
broadcast( new Chat( ComponentSerializer.toString( message ) ) );
|
||||||
|
@ -47,7 +47,7 @@ public class ServerConnection implements Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnect(BaseComponent[] reason)
|
public void disconnect(BaseComponent... reason)
|
||||||
{
|
{
|
||||||
if ( !ch.isClosed() )
|
if ( !ch.isClosed() )
|
||||||
{
|
{
|
||||||
|
@ -263,7 +263,7 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnect(BaseComponent[] reason)
|
public void disconnect(BaseComponent... reason)
|
||||||
{
|
{
|
||||||
disconnect0( reason );
|
disconnect0( reason );
|
||||||
}
|
}
|
||||||
@ -271,10 +271,10 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
@Override
|
@Override
|
||||||
public void disconnect(BaseComponent reason)
|
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() )
|
if ( ch.getHandle().isActive() )
|
||||||
{
|
{
|
||||||
@ -311,7 +311,7 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(BaseComponent[] message)
|
public void sendMessage(BaseComponent... message)
|
||||||
{
|
{
|
||||||
unsafe().sendPacket( new Chat( ComponentSerializer.toString( message ) ) );
|
unsafe().sendPacket( new Chat( ComponentSerializer.toString( message ) ) );
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class ComponentSerializer implements JsonSerializer<BaseComponent>, JsonD
|
|||||||
return gson.toJson( component );
|
return gson.toJson( component );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toString(BaseComponent[] components)
|
public static String toString(BaseComponent... components)
|
||||||
{
|
{
|
||||||
return gson.toJson( components );
|
return gson.toJson( components );
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class ConsoleCommandSender implements CommandSender
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(BaseComponent[] message)
|
public void sendMessage(BaseComponent... message)
|
||||||
{
|
{
|
||||||
sendMessage( BaseComponent.toLegacyText( message ) );
|
sendMessage( BaseComponent.toLegacyText( message ) );
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnect(BaseComponent[] reason)
|
public void disconnect(BaseComponent... reason)
|
||||||
{
|
{
|
||||||
if ( !ch.isClosed() )
|
if ( !ch.isClosed() )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user