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