Code format.
This commit is contained in:
parent
3b71a2b570
commit
dc2da29c16
@ -85,7 +85,9 @@ public interface CommandSender
|
||||
|
||||
/**
|
||||
* Get all Permissions which this CommandSender has
|
||||
* @return a unmodifiable Collection of Strings which represent their permissions
|
||||
*
|
||||
* @return a unmodifiable Collection of Strings which represent their
|
||||
* permissions
|
||||
*/
|
||||
public Collection<String> getPermissions();
|
||||
}
|
||||
|
@ -47,7 +47,10 @@ public class TextComponent extends BaseComponent
|
||||
c += 32;
|
||||
}
|
||||
ChatColor format = ChatColor.getByChar( c );
|
||||
if ( format == null ) continue;
|
||||
if ( format == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ( builder.length() > 0 )
|
||||
{
|
||||
TextComponent old = component;
|
||||
@ -145,14 +148,15 @@ public class TextComponent extends BaseComponent
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a TextComponent with blank text and the extras set
|
||||
* to the passed array
|
||||
* Creates a TextComponent with blank text and the extras set to the passed
|
||||
* array
|
||||
*
|
||||
* @param extras the extras to set
|
||||
*/
|
||||
public TextComponent(BaseComponent ...extras) {
|
||||
public TextComponent(BaseComponent... extras)
|
||||
{
|
||||
setText( "" );
|
||||
setExtra( Arrays.asList(extras) );
|
||||
setExtra( Arrays.asList( extras ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,9 +75,10 @@ public class BaseComponentSerializer
|
||||
protected void serialize(JsonObject object, BaseComponent component, JsonSerializationContext context)
|
||||
{
|
||||
boolean first = false;
|
||||
if ( ComponentSerializer.serializedComponents.get() == null ) {
|
||||
if ( ComponentSerializer.serializedComponents.get() == null )
|
||||
{
|
||||
first = true;
|
||||
ComponentSerializer.serializedComponents.set( new HashSet<BaseComponent>( ) );
|
||||
ComponentSerializer.serializedComponents.set( new HashSet<BaseComponent>() );
|
||||
}
|
||||
try
|
||||
{
|
||||
@ -131,7 +132,8 @@ public class BaseComponentSerializer
|
||||
} finally
|
||||
{
|
||||
ComponentSerializer.serializedComponents.get().remove( component );
|
||||
if (first) {
|
||||
if ( first )
|
||||
{
|
||||
ComponentSerializer.serializedComponents.set( null );
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class TextComponentSerializer extends BaseComponentSerializer implements
|
||||
public JsonElement serialize(TextComponent src, Type typeOfSrc, JsonSerializationContext context)
|
||||
{
|
||||
List<BaseComponent> extra = src.getExtra();
|
||||
if ( !src.hasFormatting() && (extra == null || extra.size() == 0) )
|
||||
if ( !src.hasFormatting() && ( extra == null || extra.size() == 0 ) )
|
||||
{
|
||||
return new JsonPrimitive( src.getText() );
|
||||
}
|
||||
|
@ -56,20 +56,20 @@ public class YamlConfiguration extends ConfigurationProvider
|
||||
@SuppressWarnings("unchecked")
|
||||
public Configuration load(Reader reader)
|
||||
{
|
||||
Map<String,Object> map = yaml.get().loadAs( reader, LinkedHashMap.class );
|
||||
if( map == null )
|
||||
Map<String, Object> map = yaml.get().loadAs( reader, LinkedHashMap.class );
|
||||
if ( map == null )
|
||||
{
|
||||
map = new LinkedHashMap<>();
|
||||
}
|
||||
return new Configuration( map , null );
|
||||
return new Configuration( map, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Configuration load(String string)
|
||||
{
|
||||
Map<String,Object> map = yaml.get().loadAs( string, LinkedHashMap.class );
|
||||
if( map == null )
|
||||
Map<String, Object> map = yaml.get().loadAs( string, LinkedHashMap.class );
|
||||
if ( map == null )
|
||||
{
|
||||
map = new LinkedHashMap<>();
|
||||
}
|
||||
|
@ -2,11 +2,13 @@ package net.md_5.bungee.module.cmd.alert;
|
||||
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
public class PluginAlert extends Plugin {
|
||||
public class PluginAlert extends Plugin
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
getProxy().getPluginManager().registerCommand(this, new CommandAlert());
|
||||
getProxy().getPluginManager().registerCommand(this, new CommandAlertRaw());
|
||||
public void onEnable()
|
||||
{
|
||||
getProxy().getPluginManager().registerCommand( this, new CommandAlert() );
|
||||
getProxy().getPluginManager().registerCommand( this, new CommandAlertRaw() );
|
||||
}
|
||||
}
|
||||
|
@ -95,8 +95,14 @@ public class CommandSend extends Command implements TabExecutor
|
||||
matches.add( player.getName() );
|
||||
}
|
||||
}
|
||||
if ( "all".startsWith( search ) ) matches.add( "all" );
|
||||
if ( "current".startsWith( search ) ) matches.add( "current" );
|
||||
if ( "all".startsWith( search ) )
|
||||
{
|
||||
matches.add( "all" );
|
||||
}
|
||||
if ( "current".startsWith( search ) )
|
||||
{
|
||||
matches.add( "current" );
|
||||
}
|
||||
} else
|
||||
{
|
||||
String search = args[1].toLowerCase();
|
||||
|
@ -48,7 +48,7 @@ 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() ) );
|
||||
serverTextComponent.setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( server.getPlayers().size() + " players" ).create() ) );
|
||||
serverTextComponent.setClickEvent( new ClickEvent( ClickEvent.Action.RUN_COMMAND, "/server " + server.getName() ) );
|
||||
serverList.addExtra( serverTextComponent );
|
||||
first = false;
|
||||
|
@ -37,7 +37,6 @@ public enum Protocol
|
||||
HANDSHAKE
|
||||
{
|
||||
|
||||
|
||||
{
|
||||
TO_SERVER.registerPacket( 0x00, Handshake.class );
|
||||
}
|
||||
@ -46,7 +45,6 @@ public enum Protocol
|
||||
GAME
|
||||
{
|
||||
|
||||
|
||||
{
|
||||
TO_CLIENT.registerPacket( 0x00, KeepAlive.class );
|
||||
TO_CLIENT.registerPacket( 0x01, Login.class );
|
||||
@ -72,7 +70,6 @@ public enum Protocol
|
||||
STATUS
|
||||
{
|
||||
|
||||
|
||||
{
|
||||
TO_CLIENT.registerPacket( 0x00, StatusResponse.class );
|
||||
TO_CLIENT.registerPacket( 0x01, PingPacket.class );
|
||||
@ -85,7 +82,6 @@ public enum Protocol
|
||||
LOGIN
|
||||
{
|
||||
|
||||
|
||||
{
|
||||
TO_CLIENT.registerPacket( 0x00, Kick.class );
|
||||
TO_CLIENT.registerPacket( 0x01, EncryptionRequest.class );
|
||||
|
@ -163,7 +163,7 @@ public class EntityMap
|
||||
packet.readerIndex( readerIndex );
|
||||
packet.writerIndex( readerIndex + packetIdLength + idLength );
|
||||
DefinedPacket.writeString( player.getUniqueId().toString(), packet );
|
||||
DefinedPacket.writeString( username, packet);
|
||||
DefinedPacket.writeString( username, packet );
|
||||
DefinedPacket.writeVarInt( profile.getProperties().length, packet );
|
||||
for ( LoginResult.Property property : profile.getProperties() )
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ public class PlayerInfoSerializer implements JsonSerializer<ServerPing.PlayerInf
|
||||
JsonObject js = json.getAsJsonObject();
|
||||
ServerPing.PlayerInfo info = new ServerPing.PlayerInfo( js.get( "name" ).getAsString(), (UUID) null );
|
||||
String id = js.get( "id" ).getAsString();
|
||||
if ( protocol == 4 || !id.contains( "-" ))
|
||||
if ( protocol == 4 || !id.contains( "-" ) )
|
||||
{
|
||||
info.setId( id );
|
||||
} else
|
||||
|
@ -5,7 +5,8 @@ import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
/**
|
||||
* Command to terminate the proxy instance. May only be used by the console by default.
|
||||
* Command to terminate the proxy instance. May only be used by the console by
|
||||
* default.
|
||||
*/
|
||||
public class CommandEnd extends Command
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ public class CommandReload extends Command
|
||||
BungeeCord.getInstance().config.load();
|
||||
BungeeCord.getInstance().stopListeners();
|
||||
BungeeCord.getInstance().startListeners();
|
||||
BungeeCord.getInstance().getPluginManager().callEvent(new ProxyReloadEvent(sender));
|
||||
BungeeCord.getInstance().getPluginManager().callEvent( new ProxyReloadEvent( sender ) );
|
||||
|
||||
sender.sendMessage( ChatColor.BOLD.toString() + ChatColor.RED.toString() + "BungeeCord has been reloaded."
|
||||
+ " This is NOT advisable and you will not be supported with any issues that arise! Please restart BungeeCord ASAP." );
|
||||
|
@ -172,7 +172,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
|
||||
if ( forced != null && listener.isPingPassthrough() )
|
||||
{
|
||||
((BungeeServerInfo) forced).ping( pingBack, handshake.getProtocolVersion() );
|
||||
( (BungeeServerInfo) forced ).ping( pingBack, handshake.getProtocolVersion() );
|
||||
} else
|
||||
{
|
||||
int protocol = ( Protocol.supportedVersions.contains( handshake.getProtocolVersion() ) ) ? handshake.getProtocolVersion() : -1;
|
||||
|
@ -13,7 +13,8 @@ public class LoginResult
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class Property {
|
||||
public static class Property
|
||||
{
|
||||
|
||||
private String name;
|
||||
private String value;
|
||||
|
Loading…
Reference in New Issue
Block a user