use of me.william278.husksync.velocity.listener.VelocityRedisListener in project HuskSync by WiIIiam278.
the class HuskSyncVelocity method onProxyInitialization.
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
// Set instance
instance = this;
// Load dependencies
fetchDependencies();
// Setup logger
velocityLogger = new VelocityLogger(logger);
// Prepare synchronised servers tracker
synchronisedServers = new HashSet<>();
// Load config
ConfigManager.loadConfig();
// Load settings from config
ConfigLoader.loadSettings(Objects.requireNonNull(ConfigManager.getConfig()));
// Load messages
ConfigManager.loadMessages();
// Load locales from messages
ConfigLoader.loadMessageStrings(Objects.requireNonNull(ConfigManager.getMessages()));
// Do update checker
if (Settings.automaticUpdateChecks) {
new VelocityUpdateChecker(VERSION).logToConsole();
}
// Setup data manager
dataManager = new DataManager(getVelocityLogger(), getDataFolder());
// Ensure the data manager initialized correctly
if (dataManager.hasFailedInitialization) {
getVelocityLogger().severe("Failed to initialize the HuskSync database(s).\n" + "HuskSync will now abort loading itself (Velocity) v" + VERSION);
}
// Setup player data cache
for (Settings.SynchronisationCluster cluster : Settings.clusters) {
dataManager.playerDataCache.put(cluster, new DataManager.PlayerDataCache());
}
// Initialize the redis listener
redisListener = new VelocityRedisListener();
// Register listener
server.getEventManager().register(this, new VelocityEventListener());
// Register command
CommandManager commandManager = getProxyServer().getCommandManager();
CommandMeta meta = commandManager.metaBuilder("husksync").aliases("hs").build();
commandManager.register(meta, new VelocityCommand());
// Prepare the migrator for use if needed
mpdbMigrator = new MPDBMigrator(getVelocityLogger());
// Initialize bStats metrics
try {
metricsFactory.make(this, METRICS_ID);
} catch (Exception e) {
getVelocityLogger().info("Skipped metrics initialization");
}
// Log to console
getVelocityLogger().info("Enabled HuskSync (Velocity) v" + VERSION);
// Mark as ready for redis message processing
readyForRedis = true;
}
Aggregations