code changed to current web socket client version
parent
4d5baafb74
commit
ff123f3ea7
|
@ -52,7 +52,7 @@ public class ProxySystem extends Plugin {
|
|||
KraSocketClientConfig kraSocketClientConfig = new KraSocketClientConfig(
|
||||
this.configHandler.getWebSocketProtocol(), this.configHandler.getWebSocketHost(),
|
||||
this.configHandler.getWebSocketPort(), this.configHandler.getWebSocketAccessKey(),
|
||||
"proxy-1");
|
||||
"proxy-1", this.configHandler.getWebSocketAckTimeouts());
|
||||
|
||||
this.kraSocketClientEventInitiater = new KraSocketClientEventInitiater();
|
||||
this.kraSocketClientEventInterface = new SocketClientMessageListener();
|
||||
|
|
|
@ -34,7 +34,7 @@ public class SendTestMessageCommand extends Command {
|
|||
|
||||
KraSocketClientProtocolMessage kraSocketClientProtocolMessage = new KraSocketClientProtocolMessage(
|
||||
status, (byte) cmdID, Integer.parseInt(args[2]),
|
||||
proxiedPlayer.getUniqueId().toString(), Short.parseShort(args[3]), args[4]);
|
||||
proxiedPlayer.getUniqueId().toString(), Short.parseShort(args[3]), args[4], null);
|
||||
|
||||
ProxySystem.getInstance().getKraSocketClient().getSocketClient()
|
||||
.SendMessage(kraSocketClientProtocolMessage);
|
||||
|
|
|
@ -3,7 +3,9 @@ package net.krakatoa.proxy.listener;
|
|||
import com.mongodb.client.model.Filters;
|
||||
import com.mongodb.client.model.UpdateOptions;
|
||||
import com.mongodb.client.model.Updates;
|
||||
import earth.krakatao.protocol.KraSocketClientProtocolDest;
|
||||
import earth.krakatao.protocol.KraSocketClientProtocolMessage;
|
||||
import earth.krakatao.protocol.KraSocketClientProtocolStatus;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
|
@ -51,10 +53,6 @@ public class PostLoginListener implements Listener {
|
|||
// check if both sockets connected
|
||||
int cmdID = ProxySystem.getInstance().getKraSocketClientProtocol().generateCmdID();
|
||||
|
||||
ProxySystem.getInstance().getKraSocketClient().getSocketClient()
|
||||
.SendMessage(new KraSocketClientProtocolMessage((byte) 11, cmdID, 1, uuid,
|
||||
(short) 10, ""));
|
||||
|
||||
Document finalDocument = document;
|
||||
Consumer<KraSocketClientProtocolMessage> consumer = value -> {
|
||||
if (value.getArgs().equals("1")) {
|
||||
|
@ -91,8 +89,12 @@ public class PostLoginListener implements Listener {
|
|||
System.out.println(
|
||||
"consumer response value " + value.getUuid() + " " + value.getCmdID());
|
||||
};
|
||||
ProxySystem.getInstance().getKraSocketClientProtocol().getConsumerHashMap()
|
||||
.put(cmdID, consumer);
|
||||
|
||||
ProxySystem.getInstance().getKraSocketClient().getSocketClient()
|
||||
.SendMessage(new KraSocketClientProtocolMessage(
|
||||
KraSocketClientProtocolStatus.GET.getStatus(), cmdID,
|
||||
KraSocketClientProtocolDest.BACKEND.getStatus(), uuid,
|
||||
(short) 10, "", consumer));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import earth.krakatao.protocol.KraSocketClientProtocolStatus;
|
|||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
import net.krakatoa.proxy.ProxySystem;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
@ -40,18 +39,21 @@ public class SocketClientMessageListener implements KraSocketClientEventInterfac
|
|||
System.out.println(
|
||||
"kraProtocolMessage " + kraProtocolMessage.getCmdID() + " " + kraProtocolMessage.getArgs());
|
||||
|
||||
System.out.println("consumer ids " + ProxySystem.getInstance().getKraSocketClientProtocol()
|
||||
.getConsumerHashMap().keySet());
|
||||
System.out.println(
|
||||
"sendMessagesQueue size: " + ProxySystem.getInstance().getKraSocketClientProtocol()
|
||||
.getSendQueueMessages().size());
|
||||
|
||||
if (kraProtocolMessage.getStatus() == KraSocketClientProtocolStatus.REPLY.getStatus()
|
||||
&& ProxySystem.getInstance().getKraSocketClientProtocol().getConsumerHashMap()
|
||||
&& ProxySystem.getInstance().getKraSocketClientProtocol().getSendQueueMessages()
|
||||
.containsKey(kraProtocolMessage.getCmdID())) {
|
||||
Consumer<KraSocketClientProtocolMessage> consumer = ProxySystem.getInstance()
|
||||
.getKraSocketClientProtocol().getConsumerHashMap().get(kraProtocolMessage.getCmdID());
|
||||
if (consumer != null) {
|
||||
|
||||
KraSocketClientProtocolMessage kraSocketClientProtocolMessage = ProxySystem.getInstance()
|
||||
.getKraSocketClientProtocol().getSendQueueMessages().get(kraProtocolMessage.getCmdID());
|
||||
|
||||
if (kraSocketClientProtocolMessage.getMessageConsumer() != null) {
|
||||
ProxySystem.getInstance().getLogger()
|
||||
.info("accept " + kraProtocolMessage.getCmdID());
|
||||
consumer.accept(kraProtocolMessage);
|
||||
kraSocketClientProtocolMessage.getMessageConsumer().accept(kraProtocolMessage);
|
||||
|
||||
ProxySystem.getInstance().getKraSocketClientProtocol()
|
||||
.removeData(kraProtocolMessage.getCmdID());
|
||||
|
@ -162,7 +164,7 @@ public class SocketClientMessageListener implements KraSocketClientEventInterfac
|
|||
KraSocketClientProtocolStatus.REPLY.getStatus(),
|
||||
kraProtocolMessage.getCmdID(), KraSocketClientProtocolDest.BACKEND.getStatus(),
|
||||
kraProtocolMessage.getUuid(),
|
||||
(short) 53874, "");
|
||||
(short) 53874, "", null);
|
||||
|
||||
ProxySystem.getInstance().getKraSocketClient().getSocketClient()
|
||||
.SendMessage(kraSocketClientProtocolMessage);
|
||||
|
|
Loading…
Reference in New Issue