Code format.

This commit is contained in:
md_5 2013-08-20 19:25:40 +10:00
parent ad0da59267
commit 738ed99d54
5 changed files with 18 additions and 26 deletions

View File

@ -35,7 +35,7 @@ public class ServerKickEvent extends Event implements Cancellable
private ServerInfo cancelServer; private ServerInfo cancelServer;
/** /**
* State in which the kick occured. * State in which the kick occured.
*/ */
private State state; private State state;
public enum State public enum State
@ -46,7 +46,7 @@ public class ServerKickEvent extends Event implements Cancellable
public ServerKickEvent(ProxiedPlayer player, String kickReason, ServerInfo cancelServer) 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) public ServerKickEvent(ProxiedPlayer player, String kickReason, ServerInfo cancelServer, State state)

View File

@ -21,7 +21,6 @@ import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;

View File

@ -156,7 +156,7 @@ public class ServerConnector extends PacketHandler
user.unsafe().sendPacket( modLogin ); user.unsafe().sendPacket( modLogin );
MinecraftOutput out = new MinecraftOutput(); 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() ) ); user.unsafe().sendPacket( new PacketFAPluginMessage( "MC|Brand", out.toArray() ) );
} else } else
{ {

View File

@ -1,6 +1,5 @@
package net.md_5.bungee.connection; package net.md_5.bungee.connection;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import java.io.DataInput; 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.ServerConnection;
import net.md_5.bungee.UserConnection; import net.md_5.bungee.UserConnection;
import net.md_5.bungee.Util; 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.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer; 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.PacketFAPluginMessage;
import net.md_5.bungee.protocol.packet.PacketFFKick; import net.md_5.bungee.protocol.packet.PacketFFKick;
@RequiredArgsConstructor @RequiredArgsConstructor
public class DownstreamBridge extends PacketHandler public class DownstreamBridge extends PacketHandler
{ {
@ -61,7 +58,7 @@ public class DownstreamBridge extends PacketHandler
{ {
// We lost connection to the server // We lost connection to the server
server.getInfo().removePlayer( con ); server.getInfo().removePlayer( con );
if (bungee.getReconnectHandler() != null) if ( bungee.getReconnectHandler() != null )
{ {
bungee.getReconnectHandler().setServer( con ); bungee.getReconnectHandler().setServer( con );
} }

View File

@ -5,9 +5,7 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.timeout.ReadTimeoutException; import io.netty.handler.timeout.ReadTimeoutException;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.logging.Level; import java.util.logging.Level;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.connection.CancelSendSignal; import net.md_5.bungee.connection.CancelSendSignal;
import net.md_5.bungee.connection.InitialHandler; import net.md_5.bungee.connection.InitialHandler;
@ -62,27 +60,25 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
@Override @Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception 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; ( (PacketWrapper) msg ).packet.handle( handler );
try } catch ( CancelSendSignal ex )
{
( (PacketWrapper) msg ).packet.handle( handler );
} catch ( CancelSendSignal ex )
{
sendPacket = false;
}
if ( sendPacket )
{
handler.handle( ( (PacketWrapper) msg ).buf );
}
} else
{ {
handler.handle( (byte[]) msg ); sendPacket = false;
} }
if ( sendPacket )
{
handler.handle( ( (PacketWrapper) msg ).buf );
}
} else
{
handler.handle( (byte[]) msg );
} }
} }
} }