More bungeecord shit
This commit is contained in:
parent
58e6e77d84
commit
f2c62cf5c7
|
@ -177,8 +177,10 @@ public class WebSocketListener extends WebSocketServer {
|
|||
|
||||
@Override
|
||||
public void onMessage(WebSocket arg0, ByteBuffer arg1) {
|
||||
System.out.println("[WebsocketListener] - onMessage called");
|
||||
Object o = arg0.getAttachment();
|
||||
if(o == null || (o instanceof PendingSocket)) {
|
||||
System.out.println("o is null");
|
||||
InetAddress realAddr;
|
||||
if(o == null) {
|
||||
realAddr = arg0.getRemoteSocketAddress().getAddress();
|
||||
|
@ -193,6 +195,7 @@ public class WebSocketListener extends WebSocketServer {
|
|||
}else if(l == RateLimit.NOW_LOCKED_OUT) {
|
||||
arg0.send(createRawKickPacket("LOCKED"));
|
||||
}
|
||||
System.out.println("Socket is closed");
|
||||
arg0.close();
|
||||
return;
|
||||
}
|
||||
|
@ -207,9 +210,12 @@ public class WebSocketListener extends WebSocketServer {
|
|||
o = proxyObj;
|
||||
}
|
||||
if(o != null) {
|
||||
System.out.println("o is not null");
|
||||
if(o instanceof WebSocketProxy) {
|
||||
System.out.println("Instance of WebSocketProxy, sending packet");
|
||||
((WebSocketProxy)o).sendPacket(arg1);
|
||||
}else {
|
||||
System.out.println("Closing websocket");
|
||||
arg0.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,9 +63,8 @@ public class WebSocketProxy extends SimpleChannelInboundHandler<ByteBuf> {
|
|||
public boolean connect() {
|
||||
System.out.println("[WebsocketProxy] - connecting (?)");
|
||||
try {
|
||||
System.out.println("trying to connect");
|
||||
if(tcpChannel == null) {
|
||||
System.out.println("tcp channel is null, probly doing websocket shit (I'm too retarded to understand this)");
|
||||
System.out.println("Actually connecting");
|
||||
Bootstrap clientBootstrap = new Bootstrap();
|
||||
clientBootstrap.group(group);
|
||||
clientBootstrap.channel(NioSocketChannel.class);
|
||||
|
|
|
@ -21,29 +21,16 @@ public class ChannelWrapper
|
|||
this.ch = ctx.channel();
|
||||
}
|
||||
|
||||
public synchronized void write(Object packet)
|
||||
{
|
||||
if ( !closed )
|
||||
{
|
||||
if ( packet instanceof PacketWrapper )
|
||||
{
|
||||
( (PacketWrapper) packet ).setReleased( true );
|
||||
ch.write( ( (PacketWrapper) packet ).buf );
|
||||
} else
|
||||
{
|
||||
ch.write( packet );
|
||||
}
|
||||
//ch.flush();
|
||||
public synchronized void write(final Object packet) {
|
||||
if (!this.closed) {
|
||||
this.ch.write(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void close()
|
||||
{
|
||||
if ( !closed )
|
||||
{
|
||||
closed = true;
|
||||
//ch.flush();
|
||||
ch.close();
|
||||
public synchronized void close() {
|
||||
if (!this.closed) {
|
||||
this.closed = true;
|
||||
this.ch.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue