Formatter imported again, as this is needed for the player uuids
parent
8704026299
commit
86673c36b3
|
@ -16,6 +16,7 @@ import net.krakatoa.proxy.listener.PlayerDisconnectListener;
|
|||
import net.krakatoa.proxy.listener.PostLoginListener;
|
||||
import net.krakatoa.proxy.listener.SocketClientMessageListener;
|
||||
import net.krakatoa.proxy.mongo.MongoManager;
|
||||
import net.krakatoa.proxy.util.Formatter;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.api.plugin.PluginManager;
|
||||
import org.bson.Document;
|
||||
|
@ -27,11 +28,12 @@ public class ProxySystem extends Plugin {
|
|||
private static ProxySystem instance;
|
||||
|
||||
private ConfigHandler configHandler;
|
||||
private MongoManager mongoManager;
|
||||
private Formatter formatter;
|
||||
private KraSocketClientProtocol kraSocketClientProtocol;
|
||||
private KraSocketClient kraSocketClient;
|
||||
private KraSocketClientEventInitiater kraSocketClientEventInitiater;
|
||||
private KraSocketClientEventInterface kraSocketClientEventInterface;
|
||||
private MongoManager mongoManager;
|
||||
|
||||
private MongoCollection<Document> players;
|
||||
|
||||
|
@ -43,6 +45,8 @@ public class ProxySystem extends Plugin {
|
|||
this.configHandler = new ConfigHandler();
|
||||
this.configHandler.load();
|
||||
|
||||
this.formatter = new Formatter();
|
||||
|
||||
this.kraSocketClientProtocol = new KraSocketClientProtocol();
|
||||
|
||||
KraSocketClientConfig kraSocketClientConfig = new KraSocketClientConfig(
|
||||
|
|
|
@ -29,7 +29,8 @@ public class PostLoginListener implements Listener {
|
|||
public void onPostLogin(PostLoginEvent event) {
|
||||
ProxiedPlayer proxiedPlayer = event.getPlayer();
|
||||
|
||||
String uuid = proxiedPlayer.getUniqueId().toString();
|
||||
String uuid = ProxySystem.getInstance().getFormatter()
|
||||
.formatUuid(proxiedPlayer.getUniqueId().toString());
|
||||
|
||||
ProxySystem.getInstance().getPlayers()
|
||||
.find(Filters.eq("uuid", uuid))
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.java_websocket.handshake.ServerHandshake;
|
|||
|
||||
public class SocketClientMessageListener implements KraSocketClientEventInterface {
|
||||
|
||||
private HashMap<String, Collection<ServicePlayer>> playersAutoRestartServerSystem = new HashMap<>();
|
||||
private final HashMap<String, Collection<ServicePlayer>> playersAutoRestartServerSystem = new HashMap<>();
|
||||
private final IPlayerManager playerManager = CloudNetDriver.getInstance().getServicesRegistry()
|
||||
.getFirstService(IPlayerManager.class);
|
||||
|
||||
|
@ -41,9 +41,8 @@ public class SocketClientMessageListener implements KraSocketClientEventInterfac
|
|||
ProxySystem.getInstance().getKraSocketClientProtocol().getCmdIDs()
|
||||
.removeIf(cmdID -> cmdID == kraProtocolMessage.getCmdID());
|
||||
|
||||
System.out.println(
|
||||
"consumer ids " + ProxySystem.getInstance().getKraSocketClientProtocol()
|
||||
.getConsumerHashMap().keySet());
|
||||
System.out.println("consumer ids " + ProxySystem.getInstance().getKraSocketClientProtocol()
|
||||
.getConsumerHashMap().keySet());
|
||||
|
||||
switch (kraProtocolMessage.getCmdNumber()) {
|
||||
case 15: // @Deprecated: test - mobile or voice socket connected
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package net.krakatoa.proxy.util;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Formatter {
|
||||
|
||||
public String formatUuid(String uuid) {
|
||||
return uuid.replaceAll("-", "");
|
||||
}
|
||||
|
||||
public UUID stringToUuid(String s) {
|
||||
BigInteger bigInteger = new BigInteger(s.substring(0, 16), 16);
|
||||
BigInteger bigInteger1 = new BigInteger(s.substring(16, 32), 16);
|
||||
|
||||
return new UUID(bigInteger.longValue(), bigInteger1.longValue());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue