From 80b3135a93f0e23489cc19086e31feb12ff51798 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 24 Apr 2016 22:31:04 +1000 Subject: [PATCH] Fix formatting --- .../java/net/md_5/bungee/api/ServerPing.java | 16 +- .../net/md_5/bungee/api/event/AsyncEvent.java | 3 +- .../bungee/api/chat/ComponentBuilder.java | 9 +- .../api/chat/TranslatableComponent.java | 6 +- .../api/chat/TranslatableComponentTest.java | 4 +- .../bungee/config/ConfigurationProvider.java | 2 +- pom.xml | 4 +- .../net/md_5/bungee/protocol/Protocol.java | 95 +++--- .../protocol/packet/ClientSettings.java | 2 +- .../protocol/packet/PlayerListItem.java | 14 +- .../bungee/protocol/packet/PluginMessage.java | 2 +- .../net/md_5/bungee/protocol/packet/Team.java | 4 +- .../net/md_5/bungee/ConnectionThrottle.java | 2 +- .../net/md_5/bungee/PlayerInfoSerializer.java | 1 + .../net/md_5/bungee/entitymap/EntityMap.java | 19 +- .../md_5/bungee/entitymap/EntityMap_1_9.java | 1 + .../forge/ForgeClientHandshakeState.java | 281 +++++++++--------- .../forge/ForgeServerHandshakeState.java | 192 ++++++------ .../net/md_5/bungee/forge/ForgeUtils.java | 7 +- .../net/md_5/bungee/log/ColouredWriter.java | 2 +- .../main/java/net/md_5/bungee/tab/Global.java | 16 +- .../java/net/md_5/bungee/tab/TabList.java | 8 +- .../net/md_5/bungee/chat/ComponentsTest.java | 6 +- .../bungee/util/BoundedArrayListTest.java | 7 +- 24 files changed, 356 insertions(+), 347 deletions(-) diff --git a/api/src/main/java/net/md_5/bungee/api/ServerPing.java b/api/src/main/java/net/md_5/bungee/api/ServerPing.java index 4eb04cd1..314a1d27 100644 --- a/api/src/main/java/net/md_5/bungee/api/ServerPing.java +++ b/api/src/main/java/net/md_5/bungee/api/ServerPing.java @@ -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; } } diff --git a/api/src/main/java/net/md_5/bungee/api/event/AsyncEvent.java b/api/src/main/java/net/md_5/bungee/api/event/AsyncEvent.java index e907fb13..050da403 100644 --- a/api/src/main/java/net/md_5/bungee/api/event/AsyncEvent.java +++ b/api/src/main/java/net/md_5/bungee/api/event/AsyncEvent.java @@ -73,7 +73,8 @@ public class AsyncEvent extends Event { done.done( (T) this, null ); } - } else { + } else + { latch.decrementAndGet(); } } diff --git a/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java b/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java index 9719987b..5769dc32 100644 --- a/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java +++ b/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java @@ -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 } diff --git a/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java b/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java index 7959185f..79c2e32e 100644 --- a/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java +++ b/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java @@ -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; } diff --git a/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java b/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java index 3abb0a35..453d375d 100644 --- a/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java +++ b/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java @@ -5,7 +5,9 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; -public class TranslatableComponentTest { +public class TranslatableComponentTest +{ + @Test public void testMissingPlaceholdersAdded() { diff --git a/config/src/main/java/net/md_5/bungee/config/ConfigurationProvider.java b/config/src/main/java/net/md_5/bungee/config/ConfigurationProvider.java index 2cd28162..eece8870 100644 --- a/config/src/main/java/net/md_5/bungee/config/ConfigurationProvider.java +++ b/config/src/main/java/net/md_5/bungee/config/ConfigurationProvider.java @@ -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); diff --git a/pom.xml b/pom.xml index fe6cf884..d8d7c027 100644 --- a/pom.xml +++ b/pom.xml @@ -170,8 +170,8 @@ false - - + + diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java index 6b68e7f1..907a73ff 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java @@ -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 supportedVersions = Arrays.asList( @@ -129,7 +129,6 @@ public enum Protocol private final TIntObjectMap packetRemap = new TIntObjectHashMap<>(); private final TIntObjectMap packetRemapInv = new TIntObjectHashMap<>(); - { packetRemap.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() ); packetRemapInv.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() ); diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientSettings.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientSettings.java index 0a54ac62..5c79727c 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientSettings.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientSettings.java @@ -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 ); } } diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListItem.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListItem.java index 198f724b..9983ef2e 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListItem.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListItem.java @@ -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 ); diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java index 6e595267..bbaef39a 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java @@ -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 ); } diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java index 846881f5..b4705799 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java @@ -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 ); } diff --git a/proxy/src/main/java/net/md_5/bungee/ConnectionThrottle.java b/proxy/src/main/java/net/md_5/bungee/ConnectionThrottle.java index 8f366724..a2690b77 100644 --- a/proxy/src/main/java/net/md_5/bungee/ConnectionThrottle.java +++ b/proxy/src/main/java/net/md_5/bungee/ConnectionThrottle.java @@ -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 ) diff --git a/proxy/src/main/java/net/md_5/bungee/PlayerInfoSerializer.java b/proxy/src/main/java/net/md_5/bungee/PlayerInfoSerializer.java index c8c4f1b9..dc49bb69 100644 --- a/proxy/src/main/java/net/md_5/bungee/PlayerInfoSerializer.java +++ b/proxy/src/main/java/net/md_5/bungee/PlayerInfoSerializer.java @@ -14,6 +14,7 @@ import java.util.UUID; public class PlayerInfoSerializer implements JsonSerializer, JsonDeserializer { + @Override public ServerPing.PlayerInfo deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java index 51ef928b..d9286535 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java @@ -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 ); } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java index 1f15dcb3..f6eb9723 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java @@ -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() diff --git a/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandshakeState.java b/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandshakeState.java index f1e2376d..d025863c 100644 --- a/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandshakeState.java +++ b/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandshakeState.java @@ -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 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 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; + } + } } diff --git a/proxy/src/main/java/net/md_5/bungee/forge/ForgeServerHandshakeState.java b/proxy/src/main/java/net/md_5/bungee/forge/ForgeServerHandshakeState.java index c04253aa..d58b4945 100644 --- a/proxy/src/main/java/net/md_5/bungee/forge/ForgeServerHandshakeState.java +++ b/proxy/src/main/java/net/md_5/bungee/forge/ForgeServerHandshakeState.java @@ -17,122 +17,122 @@ public enum ForgeServerHandshakeState implements IForgeServerPacketHandler list = new BoundedArrayList<>(0); + BoundedArrayList 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() ) ); } -} \ No newline at end of file +}