From 738ed99d549b7246539f0b28722ac3381e4c76f8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 20 Aug 2013 19:25:40 +1000 Subject: [PATCH] Code format. --- .../bungee/api/event/ServerKickEvent.java | 4 +-- .../main/java/net/md_5/bungee/BungeeCord.java | 1 - .../java/net/md_5/bungee/ServerConnector.java | 2 +- .../bungee/connection/DownstreamBridge.java | 5 +-- .../net/md_5/bungee/netty/HandlerBoss.java | 32 ++++++++----------- 5 files changed, 18 insertions(+), 26 deletions(-) diff --git a/api/src/main/java/net/md_5/bungee/api/event/ServerKickEvent.java b/api/src/main/java/net/md_5/bungee/api/event/ServerKickEvent.java index bd5b6d5de..50a4cc933 100644 --- a/api/src/main/java/net/md_5/bungee/api/event/ServerKickEvent.java +++ b/api/src/main/java/net/md_5/bungee/api/event/ServerKickEvent.java @@ -35,7 +35,7 @@ public class ServerKickEvent extends Event implements Cancellable private ServerInfo cancelServer; /** * State in which the kick occured. - */ + */ private State state; public enum State @@ -46,7 +46,7 @@ public class ServerKickEvent extends Event implements Cancellable public ServerKickEvent(ProxiedPlayer player, String kickReason, ServerInfo cancelServer) { - this(player, kickReason, cancelServer, State.UNKNOWN); + this( player, kickReason, cancelServer, State.UNKNOWN ); } public ServerKickEvent(ProxiedPlayer player, String kickReason, ServerInfo cancelServer, State state) diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 1f40e9eb7..861c10ee1 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -21,7 +21,6 @@ import java.io.IOException; import java.io.PrintStream; import java.net.InetAddress; import java.net.InetSocketAddress; -import java.net.SocketAddress; import java.util.Calendar; import java.util.Collection; import java.util.Collections; diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java index e7e8bc043..a410ff5f1 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -156,7 +156,7 @@ public class ServerConnector extends PacketHandler user.unsafe().sendPacket( modLogin ); MinecraftOutput out = new MinecraftOutput(); - out.writeStringUTF8WithoutLengthHeaderBecauseDinnerboneStuffedUpTheMCBrandPacket(ProxyServer.getInstance().getName() + " (" + ProxyServer.getInstance().getVersion() + ")" ); + out.writeStringUTF8WithoutLengthHeaderBecauseDinnerboneStuffedUpTheMCBrandPacket( ProxyServer.getInstance().getName() + " (" + ProxyServer.getInstance().getVersion() + ")" ); user.unsafe().sendPacket( new PacketFAPluginMessage( "MC|Brand", out.toArray() ) ); } else { diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java index d01ca9e0e..75a4fd9a7 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java @@ -1,6 +1,5 @@ package net.md_5.bungee.connection; -import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; import java.io.DataInput; @@ -10,7 +9,6 @@ import net.md_5.bungee.EntityMap; import net.md_5.bungee.ServerConnection; import net.md_5.bungee.UserConnection; import net.md_5.bungee.Util; -import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -32,7 +30,6 @@ import net.md_5.bungee.protocol.packet.PacketD1Team; import net.md_5.bungee.protocol.packet.PacketFAPluginMessage; import net.md_5.bungee.protocol.packet.PacketFFKick; - @RequiredArgsConstructor public class DownstreamBridge extends PacketHandler { @@ -61,7 +58,7 @@ public class DownstreamBridge extends PacketHandler { // We lost connection to the server server.getInfo().removePlayer( con ); - if (bungee.getReconnectHandler() != null) + if ( bungee.getReconnectHandler() != null ) { bungee.getReconnectHandler().setServer( con ); } diff --git a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java index e4ea6fc6f..6ddaee3c2 100644 --- a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java +++ b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java @@ -5,9 +5,7 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.handler.timeout.ReadTimeoutException; import java.io.IOException; -import java.net.InetSocketAddress; import java.util.logging.Level; -import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.connection.CancelSendSignal; import net.md_5.bungee.connection.InitialHandler; @@ -62,27 +60,25 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + if ( handler != null ) { - if ( handler != null ) + if ( msg instanceof PacketWrapper ) { - if ( msg instanceof PacketWrapper ) + boolean sendPacket = true; + try { - boolean sendPacket = true; - try - { - ( (PacketWrapper) msg ).packet.handle( handler ); - } catch ( CancelSendSignal ex ) - { - sendPacket = false; - } - if ( sendPacket ) - { - handler.handle( ( (PacketWrapper) msg ).buf ); - } - } else + ( (PacketWrapper) msg ).packet.handle( handler ); + } catch ( CancelSendSignal ex ) { - handler.handle( (byte[]) msg ); + sendPacket = false; } + if ( sendPacket ) + { + handler.handle( ( (PacketWrapper) msg ).buf ); + } + } else + { + handler.handle( (byte[]) msg ); } } }