debug msg
parent
ea1f9801d8
commit
f02ea6ea5e
|
@ -34,104 +34,104 @@ import java.util.UUID;
|
|||
@Getter
|
||||
public class KrakatoaAPI extends JavaPlugin {
|
||||
|
||||
@Getter
|
||||
private static KrakatoaAPI instance;
|
||||
@Getter
|
||||
private static KrakatoaAPI instance;
|
||||
|
||||
private ConfigHandler configHandler;
|
||||
private KraSocketClientProtocol kraSocketClientProtocol;
|
||||
private KraSocketClient kraSocketClient;
|
||||
private KraSocketClientEventInitiater kraSocketClientEventInitiater;
|
||||
private KraSocketClientEventInterface kraSocketClientEventInterface;
|
||||
private ConfigHandler configHandler;
|
||||
private KraSocketClientProtocol kraSocketClientProtocol;
|
||||
private KraSocketClient kraSocketClient;
|
||||
private KraSocketClientEventInitiater kraSocketClientEventInitiater;
|
||||
private KraSocketClientEventInterface kraSocketClientEventInterface;
|
||||
|
||||
private MongoManager mongoManager;
|
||||
private RedisManager redisManager;
|
||||
private MongoManager mongoManager;
|
||||
private RedisManager redisManager;
|
||||
|
||||
private Formatter formatter;
|
||||
private Formatter formatter;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
super.onEnable();
|
||||
@Override
|
||||
public void onEnable() {
|
||||
super.onEnable();
|
||||
|
||||
instance = this;
|
||||
this.configHandler = new ConfigHandler();
|
||||
instance = this;
|
||||
this.configHandler = new ConfigHandler();
|
||||
|
||||
try {
|
||||
this.configHandler.load();
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
this.configHandler.load();
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.kraSocketClientProtocol = new KraSocketClientProtocol();
|
||||
|
||||
KraSocketClientConfig kraSocketClientConfig = new KraSocketClientConfig(
|
||||
this.configHandler.getWebSocketProtocol(), this.configHandler.getWebSocketHost(),
|
||||
this.configHandler.getWebSocketPort(), this.configHandler.getWebSocketAccessKey(),
|
||||
CloudNetDriver.getInstance().getComponentName(),
|
||||
this.configHandler.getWebSocketAckTimeouts());
|
||||
|
||||
this.kraSocketClientEventInitiater = new KraSocketClientEventInitiater();
|
||||
this.kraSocketClientEventInterface = new SocketClientMessageListener();
|
||||
|
||||
try {
|
||||
this.kraSocketClient = new KraSocketClient(kraSocketClientConfig,
|
||||
this.kraSocketClientEventInterface, this.kraSocketClientProtocol);
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.kraSocketClient.getSocketClient().connect();
|
||||
|
||||
this.getLogger().info("testaa lol");
|
||||
|
||||
this.mongoManager = new MongoManager(new MongoConfig(this.configHandler.getMongodbHost(),
|
||||
this.configHandler.getMongodbPort(), this.configHandler.getMongodbUsername(),
|
||||
this.configHandler.getMongodbPassword(),
|
||||
this.configHandler.getMongodbDatabase()));
|
||||
this.mongoManager.connect();
|
||||
|
||||
this.redisManager = new RedisManager(
|
||||
new RedisConfig(this.configHandler.getRedisHost(), this.getConfigHandler().getRedisPort()));
|
||||
this.redisManager.connect();
|
||||
|
||||
this.formatter = new Formatter();
|
||||
|
||||
loadListeners();
|
||||
loadCommands();
|
||||
|
||||
// call to proxy that the server is only for the auto restart system
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(this, () -> {
|
||||
KraSocketClientProtocolMessage kraSocketClientProtocolMessage = new KraSocketClientProtocolMessage(
|
||||
KraSocketClientProtocolStatus.SEND.getStatus(), 0,
|
||||
KraSocketClientProtocolDest.PROXY.getStatus(),
|
||||
UUID.fromString("c7b023ac-0303-4275-923d-3a1028e887a0"),
|
||||
(short) 59739,
|
||||
CloudNetDriver.getInstance().getComponentName(), null);
|
||||
|
||||
this.kraSocketClient.getSocketClient().SendMessage(kraSocketClientProtocolMessage);
|
||||
}, 3 * 20);
|
||||
}
|
||||
|
||||
this.kraSocketClientProtocol = new KraSocketClientProtocol();
|
||||
@Override
|
||||
public void onDisable() {
|
||||
super.onDisable();
|
||||
|
||||
KraSocketClientConfig kraSocketClientConfig = new KraSocketClientConfig(
|
||||
this.configHandler.getWebSocketProtocol(), this.configHandler.getWebSocketHost(),
|
||||
this.configHandler.getWebSocketPort(), this.configHandler.getWebSocketAccessKey(),
|
||||
CloudNetDriver.getInstance().getComponentName(),
|
||||
this.configHandler.getWebSocketAckTimeouts());
|
||||
this.mongoManager.shutdown();
|
||||
|
||||
this.kraSocketClientEventInitiater = new KraSocketClientEventInitiater();
|
||||
this.kraSocketClientEventInterface = new SocketClientMessageListener();
|
||||
this.kraSocketClient.getSocketClient().getConnection().close();
|
||||
this.kraSocketClient.getSocketClient().getConnection().closeConnection(1, "");
|
||||
|
||||
try {
|
||||
this.kraSocketClient = new KraSocketClient(kraSocketClientConfig,
|
||||
this.kraSocketClientEventInterface, this.kraSocketClientProtocol);
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
instance = null;
|
||||
}
|
||||
|
||||
this.kraSocketClient.getSocketClient().connect();
|
||||
public void loadListeners() {
|
||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
List.of(new PlayerJoinListener(), new PlayerQuitListener()).forEach(listener -> {
|
||||
pluginManager.registerEvents(listener, this);
|
||||
});
|
||||
}
|
||||
|
||||
this.getLogger().info("testaa");
|
||||
|
||||
this.mongoManager = new MongoManager(new MongoConfig(this.configHandler.getMongodbHost(),
|
||||
this.configHandler.getMongodbPort(), this.configHandler.getMongodbUsername(),
|
||||
this.configHandler.getMongodbPassword(),
|
||||
this.configHandler.getMongodbDatabase()));
|
||||
this.mongoManager.connect();
|
||||
|
||||
this.redisManager = new RedisManager(
|
||||
new RedisConfig(this.configHandler.getRedisHost(), this.getConfigHandler().getRedisPort()));
|
||||
this.redisManager.connect();
|
||||
|
||||
this.formatter = new Formatter();
|
||||
|
||||
loadListeners();
|
||||
loadCommands();
|
||||
|
||||
// call to proxy that the server is only for the auto restart system
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(this, () -> {
|
||||
KraSocketClientProtocolMessage kraSocketClientProtocolMessage = new KraSocketClientProtocolMessage(
|
||||
KraSocketClientProtocolStatus.SEND.getStatus(), 0,
|
||||
KraSocketClientProtocolDest.PROXY.getStatus(),
|
||||
UUID.fromString("c7b023ac-0303-4275-923d-3a1028e887a0"),
|
||||
(short) 59739,
|
||||
CloudNetDriver.getInstance().getComponentName(), null);
|
||||
|
||||
this.kraSocketClient.getSocketClient().SendMessage(kraSocketClientProtocolMessage);
|
||||
}, 3 * 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
super.onDisable();
|
||||
|
||||
this.mongoManager.shutdown();
|
||||
|
||||
this.kraSocketClient.getSocketClient().getConnection().close();
|
||||
this.kraSocketClient.getSocketClient().getConnection().closeConnection(1, "");
|
||||
|
||||
instance = null;
|
||||
}
|
||||
|
||||
public void loadListeners() {
|
||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
List.of(new PlayerJoinListener(), new PlayerQuitListener()).forEach(listener -> {
|
||||
pluginManager.registerEvents(listener, this);
|
||||
});
|
||||
}
|
||||
|
||||
public void loadCommands() {
|
||||
Objects.requireNonNull(getCommand("krakatoa")).setExecutor(new KrakataoCommand());
|
||||
}
|
||||
public void loadCommands() {
|
||||
Objects.requireNonNull(getCommand("krakatoa")).setExecutor(new KrakataoCommand());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue