Fix formatting

This commit is contained in:
md_5 2016-04-24 22:31:04 +10:00
parent 1cd3e42182
commit 80b3135a93
24 changed files with 356 additions and 347 deletions

View File

@ -104,13 +104,13 @@ public class ServerPing
@Deprecated
public ServerPing(Protocol version, Players players, String description, String favicon)
{
this( version, players, new TextComponent( TextComponent.fromLegacyText(description) ), favicon == null ? null : Favicon.create( favicon ) );
this( version, players, new TextComponent( TextComponent.fromLegacyText( description ) ), favicon == null ? null : Favicon.create( favicon ) );
}
@Deprecated
public ServerPing(Protocol version, Players players, String description, Favicon favicon)
{
this( version, players, new TextComponent( TextComponent.fromLegacyText(description) ), favicon );
this( version, players, new TextComponent( TextComponent.fromLegacyText( description ) ), favicon );
}
@Deprecated
@ -136,20 +136,24 @@ public class ServerPing
}
@Deprecated
public void setDescription(String description) {
public void setDescription(String description)
{
this.description = new TextComponent( TextComponent.fromLegacyText( description ) );
}
@Deprecated
public String getDescription() {
public String getDescription()
{
return BaseComponent.toLegacyText( description );
}
public void setDescriptionComponent(BaseComponent description) {
public void setDescriptionComponent(BaseComponent description)
{
this.description = description;
}
public BaseComponent getDescriptionComponent() {
public BaseComponent getDescriptionComponent()
{
return description;
}
}

View File

@ -73,7 +73,8 @@ public class AsyncEvent<T> extends Event
{
done.done( (T) this, null );
}
} else {
} else
{
latch.decrementAndGet();
}
}

View File

@ -250,11 +250,13 @@ public class ComponentBuilder
{
/**
* Specify that we do not want to retain anything from the previous component.
* Specify that we do not want to retain anything from the previous
* component.
*/
NONE,
/**
* Specify that we want the formatting retained from the previous component.
* Specify that we want the formatting retained from the previous
* component.
*/
FORMATTING,
/**
@ -262,7 +264,8 @@ public class ComponentBuilder
*/
EVENTS,
/**
* Specify that we want to retain everything from the previous component.
* Specify that we want to retain everything from the previous
* component.
*/
ALL
}

View File

@ -140,7 +140,8 @@ public class TranslatableComponent extends BaseComponent
try
{
trans = locales.getString( translate );
} catch ( MissingResourceException e ) {
} catch ( MissingResourceException ex )
{
trans = translate;
}
@ -184,7 +185,8 @@ public class TranslatableComponent extends BaseComponent
try
{
trans = locales.getString( translate );
} catch ( MissingResourceException e ) {
} catch ( MissingResourceException e )
{
trans = translate;
}

View File

@ -5,7 +5,9 @@ import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class TranslatableComponentTest {
public class TranslatableComponentTest
{
@Test
public void testMissingPlaceholdersAdded()
{

View File

@ -22,8 +22,8 @@ public abstract class ConfigurationProvider
{
return providers.get( provider );
}
/*------------------------------------------------------------------------*/
/*------------------------------------------------------------------------*/
public abstract void save(Configuration config, File file) throws IOException;
public abstract void save(Configuration config, Writer writer);

View File

@ -170,8 +170,8 @@
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
</execute >
</action>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>

View File

@ -44,66 +44,66 @@ public enum Protocol
// Undef
HANDSHAKE
{
{
{
TO_SERVER.registerPacket( 0x00, Handshake.class );
}
},
{
TO_SERVER.registerPacket( 0x00, Handshake.class );
}
},
// 0
GAME
{
{
{
TO_CLIENT.registerPacket( 0x00, 0x1F, KeepAlive.class );
TO_CLIENT.registerPacket( 0x01, 0x23, Login.class );
TO_CLIENT.registerPacket( 0x02, 0x0F, Chat.class );
TO_CLIENT.registerPacket( 0x07, 0x33, Respawn.class );
TO_CLIENT.registerPacket( 0x0C, 0x0C, BossBar.class, true );
TO_CLIENT.registerPacket( 0x38, 0x2D, PlayerListItem.class ); // PlayerInfo
TO_CLIENT.registerPacket( 0x3A, 0x0E, TabCompleteResponse.class );
TO_CLIENT.registerPacket( 0x3B, 0x3F, ScoreboardObjective.class );
TO_CLIENT.registerPacket( 0x3C, 0x42, ScoreboardScore.class );
TO_CLIENT.registerPacket( 0x3D, 0x38, ScoreboardDisplay.class );
TO_CLIENT.registerPacket( 0x3E, 0x41, Team.class );
TO_CLIENT.registerPacket( 0x3F, 0x18, PluginMessage.class );
TO_CLIENT.registerPacket( 0x40, 0x1A, Kick.class );
TO_CLIENT.registerPacket( 0x45, 0x45, Title.class );
TO_CLIENT.registerPacket( 0x47, 0x48, PlayerListHeaderFooter.class );
{
TO_CLIENT.registerPacket( 0x00, 0x1F, KeepAlive.class );
TO_CLIENT.registerPacket( 0x01, 0x23, Login.class );
TO_CLIENT.registerPacket( 0x02, 0x0F, Chat.class );
TO_CLIENT.registerPacket( 0x07, 0x33, Respawn.class );
TO_CLIENT.registerPacket( 0x0C, 0x0C, BossBar.class, true );
TO_CLIENT.registerPacket( 0x38, 0x2D, PlayerListItem.class ); // PlayerInfo
TO_CLIENT.registerPacket( 0x3A, 0x0E, TabCompleteResponse.class );
TO_CLIENT.registerPacket( 0x3B, 0x3F, ScoreboardObjective.class );
TO_CLIENT.registerPacket( 0x3C, 0x42, ScoreboardScore.class );
TO_CLIENT.registerPacket( 0x3D, 0x38, ScoreboardDisplay.class );
TO_CLIENT.registerPacket( 0x3E, 0x41, Team.class );
TO_CLIENT.registerPacket( 0x3F, 0x18, PluginMessage.class );
TO_CLIENT.registerPacket( 0x40, 0x1A, Kick.class );
TO_CLIENT.registerPacket( 0x45, 0x45, Title.class );
TO_CLIENT.registerPacket( 0x47, 0x48, PlayerListHeaderFooter.class );
TO_SERVER.registerPacket( 0x00, 0x0B, KeepAlive.class );
TO_SERVER.registerPacket( 0x01, 0x02, Chat.class );
TO_SERVER.registerPacket( 0x14, 0x01, TabCompleteRequest.class );
TO_SERVER.registerPacket( 0x15, 0x04, ClientSettings.class );
TO_SERVER.registerPacket( 0x17, 0x09, PluginMessage.class );
}
},
TO_SERVER.registerPacket( 0x00, 0x0B, KeepAlive.class );
TO_SERVER.registerPacket( 0x01, 0x02, Chat.class );
TO_SERVER.registerPacket( 0x14, 0x01, TabCompleteRequest.class );
TO_SERVER.registerPacket( 0x15, 0x04, ClientSettings.class );
TO_SERVER.registerPacket( 0x17, 0x09, PluginMessage.class );
}
},
// 1
STATUS
{
{
{
TO_CLIENT.registerPacket( 0x00, StatusResponse.class );
TO_CLIENT.registerPacket( 0x01, PingPacket.class );
{
TO_CLIENT.registerPacket( 0x00, StatusResponse.class );
TO_CLIENT.registerPacket( 0x01, PingPacket.class );
TO_SERVER.registerPacket( 0x00, StatusRequest.class );
TO_SERVER.registerPacket( 0x01, PingPacket.class );
}
},
TO_SERVER.registerPacket( 0x00, StatusRequest.class );
TO_SERVER.registerPacket( 0x01, PingPacket.class );
}
},
//2
LOGIN
{
{
{
TO_CLIENT.registerPacket( 0x00, Kick.class );
TO_CLIENT.registerPacket( 0x01, EncryptionRequest.class );
TO_CLIENT.registerPacket( 0x02, LoginSuccess.class );
TO_CLIENT.registerPacket( 0x03, SetCompression.class );
{
TO_CLIENT.registerPacket( 0x00, Kick.class );
TO_CLIENT.registerPacket( 0x01, EncryptionRequest.class );
TO_CLIENT.registerPacket( 0x02, LoginSuccess.class );
TO_CLIENT.registerPacket( 0x03, SetCompression.class );
TO_SERVER.registerPacket( 0x00, LoginRequest.class );
TO_SERVER.registerPacket( 0x01, EncryptionResponse.class );
}
};
TO_SERVER.registerPacket( 0x00, LoginRequest.class );
TO_SERVER.registerPacket( 0x01, EncryptionResponse.class );
}
};
/*========================================================================*/
public static final int MAX_PACKET_ID = 0xFF;
public static List<Integer> supportedVersions = Arrays.asList(
@ -129,7 +129,6 @@ public enum Protocol
private final TIntObjectMap<TIntIntMap> packetRemap = new TIntObjectHashMap<>();
private final TIntObjectMap<TIntIntMap> packetRemapInv = new TIntObjectHashMap<>();
{
packetRemap.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );

View File

@ -54,7 +54,7 @@ public class ClientSettings extends DefinedPacket
buf.writeByte( skinParts );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
{
DefinedPacket.writeVarInt(mainHand, buf);
DefinedPacket.writeVarInt( mainHand, buf );
}
}

View File

@ -22,11 +22,11 @@ public class PlayerListItem extends DefinedPacket
@Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
action = Action.values()[ DefinedPacket.readVarInt( buf )];
action = Action.values()[DefinedPacket.readVarInt( buf )];
items = new Item[ DefinedPacket.readVarInt( buf ) ];
for ( int i = 0; i < items.length; i++ )
{
Item item = items[ i ] = new Item();
Item item = items[i] = new Item();
item.setUuid( DefinedPacket.readUUID( buf ) );
switch ( action )
{
@ -39,13 +39,13 @@ public class PlayerListItem extends DefinedPacket
String value = DefinedPacket.readString( buf );
if ( buf.readBoolean() )
{
item.properties[ j] = new String[]
item.properties[j] = new String[]
{
name, value, DefinedPacket.readString( buf )
};
} else
{
item.properties[ j ] = new String[]
item.properties[j] = new String[]
{
name, value
};
@ -88,12 +88,12 @@ public class PlayerListItem extends DefinedPacket
DefinedPacket.writeVarInt( item.properties.length, buf );
for ( String[] prop : item.properties )
{
DefinedPacket.writeString( prop[ 0], buf );
DefinedPacket.writeString( prop[ 1], buf );
DefinedPacket.writeString( prop[0], buf );
DefinedPacket.writeString( prop[1], buf );
if ( prop.length >= 3 )
{
buf.writeBoolean( true );
DefinedPacket.writeString( prop[ 2], buf );
DefinedPacket.writeString( prop[2], buf );
} else
{
buf.writeBoolean( false );

View File

@ -33,7 +33,7 @@ public class PluginMessage extends DefinedPacket
{
tag = readString( buf );
int maxSize = direction == ProtocolConstants.Direction.TO_SERVER ? Short.MAX_VALUE : 0x100000;
Preconditions.checkArgument(buf.readableBytes() < maxSize);
Preconditions.checkArgument( buf.readableBytes() < maxSize );
data = new byte[ buf.readableBytes() ];
buf.readBytes( data );
}

View File

@ -53,7 +53,7 @@ public class Team extends DefinedPacket
nameTagVisibility = readString( buf );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
{
collisionRule = readString(buf);
collisionRule = readString( buf );
}
color = buf.readByte();
}
@ -82,7 +82,7 @@ public class Team extends DefinedPacket
writeString( nameTagVisibility, buf );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
{
writeString( collisionRule, buf);
writeString( collisionRule, buf );
}
buf.writeByte( color );
}

View File

@ -13,7 +13,7 @@ public class ConnectionThrottle
public ConnectionThrottle(int throttleTime)
{
this.throttleTime = throttleTime;
this.throttleTime = throttleTime;
this.throttle = CacheBuilder.newBuilder()
.concurrencyLevel( Runtime.getRuntime().availableProcessors() )
.initialCapacity( 100 )

View File

@ -14,6 +14,7 @@ import java.util.UUID;
public class PlayerInfoSerializer implements JsonSerializer<ServerPing.PlayerInfo>, JsonDeserializer<ServerPing.PlayerInfo>
{
@Override
public ServerPing.PlayerInfo deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{

View File

@ -41,20 +41,17 @@ public abstract class EntityMap
{
if ( varint )
{
clientboundVarInts[ id ] = true;
clientboundVarInts[id] = true;
} else
{
clientboundInts[ id ] = true;
clientboundInts[id] = true;
}
} else if ( varint )
{
serverboundVarInts[id] = true;
} else
{
if ( varint )
{
serverboundVarInts[ id ] = true;
} else
{
serverboundInts[ id ] = true;
}
serverboundInts[id] = true;
}
}
@ -104,10 +101,10 @@ public abstract class EntityMap
int packetId = DefinedPacket.readVarInt( packet );
int packetIdLength = packet.readerIndex() - readerIndex;
if ( ints[ packetId ] )
if ( ints[packetId] )
{
rewriteInt( packet, oldId, newId, readerIndex + packetIdLength );
} else if ( varints[ packetId ] )
} else if ( varints[packetId] )
{
rewriteVarInt( packet, oldId, newId, readerIndex + packetIdLength );
}

View File

@ -12,6 +12,7 @@ import java.util.UUID;
class EntityMap_1_9 extends EntityMap
{
static final EntityMap_1_9 INSTANCE = new EntityMap_1_9();
EntityMap_1_9()

View File

@ -4,7 +4,6 @@ import java.util.Map;
import net.md_5.bungee.ServerConnector;
import net.md_5.bungee.UserConnection;
import net.md_5.bungee.forge.ForgeLogger.LogDirection;
import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.packet.PluginMessage;
/**
@ -25,22 +24,22 @@ enum ForgeClientHandshakeState implements IForgeClientPacketHandler<ForgeClientH
* Requires: {@link UserConnection}.
*/
START
{
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
ForgeLogger.logClient( LogDirection.RECEIVED, this.name(), message );
con.unsafe().sendPacket( message );
con.getForgeClientHandler().setState( HELLO );
return HELLO;
}
{
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
ForgeLogger.logClient( LogDirection.RECEIVED, this.name(), message );
con.unsafe().sendPacket( message );
con.getForgeClientHandler().setState( HELLO );
return HELLO;
}
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
return HELLO;
}
},
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
return HELLO;
}
},
/**
* Waiting to receive a client HELLO and the mod list. Upon receiving the
* mod list, return the mod list of the server.
@ -54,157 +53,157 @@ enum ForgeClientHandshakeState implements IForgeClientPacketHandler<ForgeClientH
* {@link PluginMessage}, {@link UserConnection}, {@link ServerConnector}
*/
HELLO
{
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
ForgeLogger.logClient( LogDirection.RECEIVED, this.name(), message );
// Server Hello.
if ( message.getData()[0] == 0 )
{
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
ForgeLogger.logClient( LogDirection.RECEIVED, this.name(), message );
// Server Hello.
if ( message.getData()[0] == 0 )
{
con.unsafe().sendPacket( message );
}
con.unsafe().sendPacket( message );
}
return this;
return this;
}
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
// Client Hello.
if ( message.getData()[0] == 1 )
{
return this;
}
// Mod list.
if ( message.getData()[0] == 2 )
{
if ( con.getForgeClientHandler().getClientModList() == null )
{
// This is the first Forge connection - so get the mods now.
// Once we've done it, no point doing it again.
Map<String, String> clientModList = ForgeUtils.readModList( message );
con.getForgeClientHandler().setClientModList( clientModList );
}
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
// Client Hello.
if ( message.getData()[0] == 1 )
{
return this;
}
return WAITINGSERVERDATA;
}
// Mod list.
if ( message.getData()[0] == 2 )
{
if ( con.getForgeClientHandler().getClientModList() == null )
{
// This is the first Forge connection - so get the mods now.
// Once we've done it, no point doing it again.
Map<String, String> clientModList = ForgeUtils.readModList( message );
con.getForgeClientHandler().setClientModList( clientModList );
}
return this;
}
return WAITINGSERVERDATA;
}
return this;
}
},
},
WAITINGSERVERDATA
{
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
// Mod list.
if ( message.getData()[0] == 2 )
{
con.unsafe().sendPacket( message );
}
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
// Mod list.
if ( message.getData()[0] == 2 )
{
con.unsafe().sendPacket( message );
}
return this;
}
return this;
}
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
// ACK
return WAITINGSERVERCOMPLETE;
}
},
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
// ACK
return WAITINGSERVERCOMPLETE;
}
},
WAITINGSERVERCOMPLETE
{
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
// Mod ID's.
if ( message.getData()[0] == 3 )
{
con.unsafe().sendPacket( message );
return this;
}
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
// Mod ID's.
if ( message.getData()[0] == 3 )
{
con.unsafe().sendPacket( message );
return this;
}
con.unsafe().sendPacket( message ); // pass everything else
return this;
}
con.unsafe().sendPacket( message ); // pass everything else
return this;
}
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
// Send ACK.
return PENDINGCOMPLETE;
}
},
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
// Send ACK.
return PENDINGCOMPLETE;
}
},
PENDINGCOMPLETE
{
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
// Ack.
if ( message.getData()[0] == -1 )
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
con.unsafe().sendPacket( message );
}
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
// Ack.
if ( message.getData()[0] == -1 )
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
con.unsafe().sendPacket( message );
}
return this;
}
return this;
}
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
// Send an ACK
return COMPLETE;
}
},
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
// Send an ACK
return COMPLETE;
}
},
COMPLETE
{
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
// Ack.
if ( message.getData()[0] == -1 )
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
con.unsafe().sendPacket( message );
}
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
// Ack.
if ( message.getData()[0] == -1 )
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
con.unsafe().sendPacket( message );
}
return this;
}
return this;
}
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
return DONE;
}
},
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
return DONE;
}
},
/**
* Handshake has been completed. Ignores any future handshake packets.
*/
DONE
{
{
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
return this;
}
@Override
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
return this;
}
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
return this;
}
}
@Override
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
{
return this;
}
}
}

View File

@ -17,122 +17,122 @@ public enum ForgeServerHandshakeState implements IForgeServerPacketHandler<Forge
*
*/
START
{
@Override
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
{
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
ch.write( message );
return this;
}
{
@Override
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
{
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
ch.write( message );
return this;
}
@Override
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
{
// Send custom channel registration. Send Hello.
return HELLO;
}
},
@Override
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
{
// Send custom channel registration. Send Hello.
return HELLO;
}
},
HELLO
{
@Override
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
{
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
if ( message.getData()[0] == 1 ) // Client Hello
{
ch.write( message );
}
@Override
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
{
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
if ( message.getData()[0] == 1 ) // Client Hello
{
ch.write( message );
}
if ( message.getData()[0] == 2 ) // Client ModList
{
ch.write( message );
}
if ( message.getData()[0] == 2 ) // Client ModList
{
ch.write( message );
}
return this;
}
return this;
}
@Override
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
{
// Send Server Mod List.
return WAITINGCACK;
}
},
@Override
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
{
// Send Server Mod List.
return WAITINGCACK;
}
},
WAITINGCACK
{
@Override
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
{
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
ch.write( message );
return this;
}
@Override
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
{
if ( message.getData()[0] == 3 && message.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) )
{
con.getForgeClientHandler().setServerIdList( message );
return this;
}
@Override
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
{
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
ch.write( message );
return this;
}
if ( message.getData()[0] == -1 && message.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) ) // transition to COMPLETE after sending ACK
{
return this;
}
@Override
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
{
if ( message.getData()[0] == 3 && message.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) )
{
con.getForgeClientHandler().setServerIdList( message );
return this;
}
if ( message.getTag().equals( ForgeConstants.FORGE_REGISTER ) ) // wait for Forge channel registration
{
return COMPLETE;
}
if ( message.getData()[0] == -1 && message.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) ) // transition to COMPLETE after sending ACK
{
return this;
}
if ( message.getTag().equals( ForgeConstants.FORGE_REGISTER ) ) // wait for Forge channel registration
{
return COMPLETE;
}
return this;
}
},
return this;
}
},
COMPLETE
{
{
@Override
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
{
// Wait for ACK
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
ch.write( message );
return this;
}
@Override
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
{
// Wait for ACK
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
ch.write( message );
return this;
}
@Override
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
{
// Send ACK
return DONE;
}
@Override
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
{
// Send ACK
return DONE;
}
},
},
/**
* Handshake has been completed. Do not respond to any more handshake
* packets.
*/
DONE
{
{
@Override
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
{
// RECEIVE 2 ACKS
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
ch.write( message );
return this;
}
@Override
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
{
// RECEIVE 2 ACKS
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
ch.write( message );
return this;
}
@Override
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
{
return this;
}
}
@Override
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
{
return this;
}
}
}

View File

@ -61,8 +61,8 @@ public class ForgeUtils
{
if ( modList.containsKey( "FML" ) )
{
String fmlVersion = modList.get( "FML" );
String fmlVersion = modList.get( "FML" );
// FML's version is hardcoded to this for builds beyond 1405 for 1.7.10 - if we see this, return Forge's build number.
if ( fmlVersion.equals( "7.10.99.99" ) )
{
@ -72,8 +72,7 @@ public class ForgeUtils
// We know from the regex that we have an int.
return Integer.parseInt( matcher.group( 4 ) );
}
}
else
} else
{
Matcher matcher = ForgeConstants.FML_HANDSHAKE_VERSION_REGEX.matcher( fmlVersion );
if ( matcher.find() )

View File

@ -53,7 +53,7 @@ public class ColouredWriter extends Handler
}
try
{
console.print( Ansi.ansi().eraseLine(Erase.ALL).toString() + ConsoleReader.RESET_LINE + s + Ansi.ansi().reset().toString() );
console.print( Ansi.ansi().eraseLine( Erase.ALL ).toString() + ConsoleReader.RESET_LINE + s + Ansi.ansi().reset().toString() );
console.drawLine();
console.flush();
} catch ( IOException ex )

View File

@ -75,11 +75,11 @@ public class Global extends TabList
String[][] props = new String[ loginResult.getProperties().length ][];
for ( int j = 0; j < props.length; j++ )
{
props[ j ] = new String[]
props[j] = new String[]
{
loginResult.getProperties()[ j ].getName(),
loginResult.getProperties()[ j ].getValue(),
loginResult.getProperties()[ j ].getSignature()
loginResult.getProperties()[j].getName(),
loginResult.getProperties()[j].getValue(),
loginResult.getProperties()[j].getSignature()
};
}
item.setProperties( props );
@ -103,11 +103,11 @@ public class Global extends TabList
String[][] props = new String[ loginResult.getProperties().length ][];
for ( int j = 0; j < props.length; j++ )
{
props[ j ] = new String[]
props[j] = new String[]
{
loginResult.getProperties()[ j ].getName(),
loginResult.getProperties()[ j ].getValue(),
loginResult.getProperties()[ j ].getSignature()
loginResult.getProperties()[j].getName(),
loginResult.getProperties()[j].getValue(),
loginResult.getProperties()[j].getSignature()
};
}
item.setProperties( props );

View File

@ -41,11 +41,11 @@ public abstract class TabList
String[][] props = new String[ loginResult.getProperties().length ][];
for ( int i = 0; i < props.length; i++ )
{
props[ i ] = new String[]
props[i] = new String[]
{
loginResult.getProperties()[ i ].getName(),
loginResult.getProperties()[ i ].getValue(),
loginResult.getProperties()[ i ].getSignature()
loginResult.getProperties()[i].getName(),
loginResult.getProperties()[i].getValue(),
loginResult.getProperties()[i].getSignature()
};
}
item.setProperties( props );

View File

@ -84,8 +84,8 @@ public class ComponentsTest
@Test
public void testBuilderReset()
{
BaseComponent[] components = new ComponentBuilder( "Hello " ).color(ChatColor.RED)
.append("World").reset().create();
BaseComponent[] components = new ComponentBuilder( "Hello " ).color( ChatColor.RED )
.append( "World" ).reset().create();
Assert.assertEquals( components[0].getColor(), ChatColor.RED );
Assert.assertEquals( components[1].getColor(), ChatColor.WHITE );
@ -113,7 +113,7 @@ public class ComponentsTest
ClickEvent testClickEvent = new ClickEvent( ClickEvent.Action.OPEN_URL, "http://www.example.com" );
BaseComponent[] eventRetention = new ComponentBuilder( "Hello " ).color( ChatColor.RED )
.event( testEvent ).event(testClickEvent).append("World", ComponentBuilder.FormatRetention.EVENTS).create();
.event( testEvent ).event( testClickEvent ).append( "World", ComponentBuilder.FormatRetention.EVENTS ).create();
Assert.assertEquals( eventRetention[0].getColor(), ChatColor.RED );
Assert.assertEquals( eventRetention[0].getHoverEvent(), testEvent );

View File

@ -5,7 +5,8 @@ import org.junit.Test;
import static org.junit.Assert.*;
public class BoundedArrayListTest {
public class BoundedArrayListTest
{
@Test
public void testGoodAdd() throws Exception
@ -63,7 +64,7 @@ public class BoundedArrayListTest {
@Test(expected = IllegalStateException.class)
public void testBadAddAll() throws Exception
{
BoundedArrayList<Object> list = new BoundedArrayList<>(0);
BoundedArrayList<Object> list = new BoundedArrayList<>( 0 );
list.addAll( ImmutableList.of( new Object() ) );
}
@ -74,4 +75,4 @@ public class BoundedArrayListTest {
list.add( new Object() );
list.addAll( ImmutableList.of( new Object() ) );
}
}
}