mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-28 05:05:21 +01:00
Why can no one ever provide helpful information to attempt to diagnose a bug, it is ridiculous that you can expect my help when you don't even provide a version number.
I am seriously just tired of this and need a break.
This commit is contained in:
parent
7a79bd0816
commit
f9c9517958
@ -1,6 +1,5 @@
|
|||||||
package net.md_5.bungee.connection;
|
package net.md_5.bungee.connection;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import net.md_5.bungee.BungeeCord;
|
import net.md_5.bungee.BungeeCord;
|
||||||
import net.md_5.bungee.EntityMap;
|
import net.md_5.bungee.EntityMap;
|
||||||
import net.md_5.bungee.UserConnection;
|
import net.md_5.bungee.UserConnection;
|
||||||
@ -17,16 +16,17 @@ import net.md_5.bungee.protocol.packet.Packet3Chat;
|
|||||||
import net.md_5.bungee.protocol.packet.PacketCCSettings;
|
import net.md_5.bungee.protocol.packet.PacketCCSettings;
|
||||||
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
|
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class UpstreamBridge extends PacketHandler
|
public class UpstreamBridge extends PacketHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
private final ProxyServer bungee;
|
private final ProxyServer bungee;
|
||||||
private final UserConnection con;
|
private final UserConnection con;
|
||||||
|
|
||||||
@Override
|
public UpstreamBridge(ProxyServer bungee, UserConnection con)
|
||||||
public void added()
|
|
||||||
{
|
{
|
||||||
|
this.bungee = bungee;
|
||||||
|
this.con = con;
|
||||||
|
|
||||||
BungeeCord.getInstance().addConnection( con );
|
BungeeCord.getInstance().addConnection( con );
|
||||||
con.getTabList().onConnect();
|
con.getTabList().onConnect();
|
||||||
con.unsafe().sendPacket( BungeeCord.getInstance().registerChannels() );
|
con.unsafe().sendPacket( BungeeCord.getInstance().registerChannels() );
|
||||||
|
@ -27,11 +27,12 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
|||||||
{
|
{
|
||||||
Preconditions.checkArgument( handler != null, "handler" );
|
Preconditions.checkArgument( handler != null, "handler" );
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
this.handler.added();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception
|
public void channelActive(ChannelHandlerContext ctx) throws Exception
|
||||||
|
{
|
||||||
|
if ( handler != null )
|
||||||
{
|
{
|
||||||
channel = new ChannelWrapper( ctx );
|
channel = new ChannelWrapper( ctx );
|
||||||
handler.connected( channel );
|
handler.connected( channel );
|
||||||
@ -41,9 +42,12 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
|||||||
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has connected", handler );
|
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has connected", handler );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception
|
||||||
|
{
|
||||||
|
if ( handler != null )
|
||||||
{
|
{
|
||||||
handler.disconnected( channel );
|
handler.disconnected( channel );
|
||||||
|
|
||||||
@ -52,13 +56,14 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
|||||||
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has disconnected", handler );
|
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has disconnected", handler );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageReceived(ChannelHandlerContext ctx, MessageList<Object> msgs) throws Exception
|
public void messageReceived(ChannelHandlerContext ctx, MessageList<Object> msgs) throws Exception
|
||||||
{
|
{
|
||||||
for ( Object msg : msgs )
|
for ( Object msg : msgs )
|
||||||
{
|
{
|
||||||
if ( ctx.channel().isActive() )
|
if ( handler != null && ctx.channel().isActive() )
|
||||||
{
|
{
|
||||||
if ( msg instanceof PacketWrapper )
|
if ( msg instanceof PacketWrapper )
|
||||||
{
|
{
|
||||||
@ -98,6 +103,8 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
|||||||
ProxyServer.getInstance().getLogger().log( Level.SEVERE, handler + " - encountered exception", cause );
|
ProxyServer.getInstance().getLogger().log( Level.SEVERE, handler + " - encountered exception", cause );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( handler != null )
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
handler.exception( cause );
|
handler.exception( cause );
|
||||||
@ -105,6 +112,7 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
|||||||
{
|
{
|
||||||
ProxyServer.getInstance().getLogger().log( Level.SEVERE, handler + " - exception processing exception", ex );
|
ProxyServer.getInstance().getLogger().log( Level.SEVERE, handler + " - exception processing exception", ex );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,6 @@ public abstract class PacketHandler extends net.md_5.bungee.protocol.packet.Abst
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void added()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void connected(ChannelWrapper channel) throws Exception
|
public void connected(ChannelWrapper channel) throws Exception
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user