More formatting fixes

This commit is contained in:
Thinkofdeath
2013-12-06 21:53:11 +00:00
parent 35c1b26a20
commit 890fac27c5
11 changed files with 64 additions and 64 deletions

View File

@@ -49,7 +49,7 @@ public class ServerConnection implements Server
@Override
public void disconnect(BaseComponent[] reason)
{
if (!ch.isClosed())
if ( !ch.isClosed() )
{
// TODO: Can we just use a future here?
unsafe().sendPacket( new Kick( ComponentSerializer.toString( reason ) ) );

View File

@@ -276,12 +276,12 @@ public final class UserConnection implements ProxiedPlayer
public synchronized void disconnect0(BaseComponent[] reason)
{
if (ch.getHandle().isActive())
if ( ch.getHandle().isActive() )
{
bungee.getLogger().log( Level.INFO, "[" + getName() + "] disconnected with: " + BaseComponent.toLegacyText( reason ) );
unsafe().sendPacket( new Kick( ComponentSerializer.toString( reason ) ) );
ch.close();
if (server != null)
if ( server != null )
{
server.disconnect( "Quitting" );
}
@@ -304,7 +304,7 @@ public final class UserConnection implements ProxiedPlayer
@Override
public void sendMessages(String... messages)
{
for (String message : messages)
for ( String message : messages )
{
sendMessage( message );
}

View File

@@ -15,50 +15,50 @@ public class BaseComponentSerializer
protected void deserialize(JsonObject object, BaseComponent component, JsonDeserializationContext context)
{
if (object.has( "color" ))
if ( object.has( "color" ) )
{
component.setColor( ChatColor.valueOf( object.get( "color" ).getAsString().toUpperCase() ) );
}
if (object.has( "bold" ))
if ( object.has( "bold" ) )
{
component.setBold( object.get( "bold" ).getAsBoolean() );
}
if (object.has( "italic" ))
if ( object.has( "italic" ) )
{
component.setItalic( object.get( "italic" ).getAsBoolean() );
}
if (object.has( "underlined" ))
if ( object.has( "underlined" ) )
{
component.setUnderlined( object.get( "underlined" ).getAsBoolean() );
}
if (object.has( "strikethrough" ))
if ( object.has( "strikethrough" ) )
{
component.setUnderlined( object.get( "strikethrough" ).getAsBoolean() );
}
if (object.has( "obfuscated" ))
if ( object.has( "obfuscated" ) )
{
component.setUnderlined( object.get( "obfuscated" ).getAsBoolean() );
}
if (object.has( "extra" ))
if ( object.has( "extra" ) )
{
component.setExtra( Arrays.asList( (BaseComponent[]) context.deserialize( object.get( "extra" ), BaseComponent[].class ) ) );
}
//Events
if (object.has( "clickEvent" ))
if ( object.has( "clickEvent" ) )
{
JsonObject event = object.getAsJsonObject( "clickEvent" );
component.setClickEvent( new ClickEvent(
ClickEvent.Action.valueOf( event.get( "action" ).getAsString().toUpperCase() ),
event.get( "value" ).getAsString() ) );
}
if (object.has( "hoverEvent" ))
if ( object.has( "hoverEvent" ) )
{
JsonObject event = object.getAsJsonObject( "hoverEvent" );
HoverEvent hoverEvent = new HoverEvent();
hoverEvent.setAction( HoverEvent.Action.valueOf( event.get( "action" ).getAsString().toUpperCase() ) );
Object res = context.deserialize( event.get( "value" ), BaseComponent.class );
if (res instanceof String)
if ( res instanceof String )
{
hoverEvent.setValue( (String) res );
} else
@@ -71,44 +71,44 @@ public class BaseComponentSerializer
protected void serialize(JsonObject object, BaseComponent component, JsonSerializationContext context)
{
if (component.getColorRaw() != null)
if ( component.getColorRaw() != null )
{
object.addProperty( "color", component.getColorRaw().getName() );
}
if (component.isBoldRaw() != null)
if ( component.isBoldRaw() != null )
{
object.addProperty( "bold", component.isBoldRaw() );
}
if (component.isItalicRaw() != null)
if ( component.isItalicRaw() != null )
{
object.addProperty( "italic", component.isItalicRaw() );
}
if (component.isUnderlinedRaw() != null)
if ( component.isUnderlinedRaw() != null )
{
object.addProperty( "underlined", component.isUnderlinedRaw() );
}
if (component.isStrikethroughRaw() != null)
if ( component.isStrikethroughRaw() != null )
{
object.addProperty( "strikethrough", component.isStrikethroughRaw() );
}
if (component.isObfuscatedRaw() != null)
if ( component.isObfuscatedRaw() != null )
{
object.addProperty( "obfuscated", component.isObfuscatedRaw() );
}
if (component.getExtra() != null)
if ( component.getExtra() != null )
{
object.add( "extra", context.serialize( component.getExtra() ) );
}
//Events
if (component.getClickEvent() != null)
if ( component.getClickEvent() != null )
{
JsonObject clickEvent = new JsonObject();
clickEvent.addProperty( "action", component.getClickEvent().getAction().toString().toLowerCase() );
clickEvent.addProperty( "value", component.getClickEvent().getValue() );
}
if (component.getHoverEvent() != null)
if ( component.getHoverEvent() != null )
{
JsonObject clickEvent = new JsonObject();
clickEvent.addProperty( "action", component.getHoverEvent().getAction().toString().toLowerCase() );

View File

@@ -26,7 +26,7 @@ public class ComponentSerializer implements JsonSerializer<BaseComponent>, JsonD
public static BaseComponent[] parse(String json)
{
if (json.startsWith( "[" ))
if ( json.startsWith( "[" ) )
{ //Array
return gson.fromJson( json, BaseComponent[].class );
}
@@ -46,12 +46,12 @@ public class ComponentSerializer implements JsonSerializer<BaseComponent>, JsonD
@Override
public BaseComponent deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
if (json.isJsonPrimitive())
if ( json.isJsonPrimitive() )
{
return new TextComponent( json.getAsString() );
}
JsonObject object = json.getAsJsonObject();
if (object.has( "translate" ))
if ( object.has( "translate" ) )
{
return context.deserialize( json, TranslatableComponent.class );
}

View File

@@ -27,7 +27,7 @@ public class TextComponentSerializer extends BaseComponentSerializer implements
@Override
public JsonElement serialize(TextComponent src, Type typeOfSrc, JsonSerializationContext context)
{
if (!src.hasFormatting())
if ( !src.hasFormatting() )
{
return new JsonPrimitive( src.getText() );
}

View File

@@ -22,7 +22,7 @@ public class TranslatableComponentSerializer extends BaseComponentSerializer imp
JsonObject object = json.getAsJsonObject();
deserialize( object, component, context );
component.setTranslate( object.get( "translate" ).getAsString() );
if (object.has( "with" ))
if ( object.has( "with" ) )
{
component.setWith( Arrays.asList( (BaseComponent[]) context.deserialize( object.get( "with" ), BaseComponent[].class ) ) );
}
@@ -35,7 +35,7 @@ public class TranslatableComponentSerializer extends BaseComponentSerializer imp
JsonObject object = new JsonObject();
serialize( object, src, context );
object.addProperty( "translate", src.getTranslate() );
if (src.getWith() != null)
if ( src.getWith() != null )
{
object.add( "with", context.serialize( src.getWith() ) );
}

View File

@@ -29,7 +29,7 @@ public class ConsoleCommandSender implements CommandSender
@Override
public void sendMessages(String... messages)
{
for (String message : messages)
for ( String message : messages )
{
sendMessage( message );
}

View File

@@ -408,7 +408,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@Override
public void disconnect(BaseComponent[] reason)
{
if (!ch.isClosed())
if ( !ch.isClosed() )
{
unsafe().sendPacket( new Kick( ComponentSerializer.toString( reason ) ) );
ch.close();