implemented KraSocketClient

master
Alex 2021-12-27 15:01:55 +01:00
parent e9683bc9a7
commit 44112e5e32
2 changed files with 8 additions and 8 deletions

View File

@ -24,7 +24,6 @@ public class ConfigHandler {
private String mongodbPassword;
public void load() throws IOException {
// TODO change file to yaml
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class)
.load(new File("/home/kra-minecraft/kraConfigs", "kraSettings.yaml"));

View File

@ -3,11 +3,11 @@ 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.KraSocketClientProtocolMessage;
import java.security.SecureRandom;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import net.krakatoa.proxy.ProxySystem;
import net.krakatoa.proxy.protocol.KraProtocolMessage;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
@ -49,12 +49,14 @@ public class PostLoginListener implements Listener {
sendVoiceWebCodeUrl(proxiedPlayer, voiceWebCode);
} else {
// check if both sockets connected
int cmdID = ProxySystem.getInstance().getKraProtocol().getCmdID();
int cmdID = ProxySystem.getInstance().getKraSocketClientProtocol().getCmdID();
ProxySystem.getInstance().getKraProtocol().SendMessage(11, cmdID, 1, uuid, 10, "");
ProxySystem.getInstance().getKraSocketClient().getSocketClient()
.SendMessage(new KraSocketClientProtocolMessage((byte) 11, cmdID, 1, uuid,
(short) 10, ""));
Document finalDocument = document;
Consumer<KraProtocolMessage> consumer = value -> {
Consumer<KraSocketClientProtocolMessage> consumer = value -> {
if (value.getArgs().equals("1")) {
// connected! Send player to game server
System.out.println(
@ -89,11 +91,10 @@ public class PostLoginListener implements Listener {
System.out.println(
"consumer response value " + value.getUuid() + " " + value.getCmdID());
};
ProxySystem.getInstance().getKraProtocol().getConsumerHashMap().put(cmdID, consumer);
ProxySystem.getInstance().getKraSocketClientProtocol().getConsumerHashMap()
.put(cmdID, consumer);
}
});
}
public void sendVoiceWebCodeUrl(ProxiedPlayer proxiedPlayer, String voiceWebCode) {