Search in sources :

Example 1 with MigrationManager

use of me.semx11.autotip.core.MigrationManager in project Hyperium by HyperiumClient.

the class Autotip method setup.

private void setup() {
    try {
        fileUtil = new FileUtil(this);
        gson = new GsonBuilder().registerTypeAdapter(Config.class, new ConfigCreator(this)).registerTypeAdapter(StatsDaily.class, new StatsDailyCreator(this)).setExclusionStrategies(new AnnotationExclusionStrategy()).setPrettyPrinting().create();
        config = new Config(this);
        reloadGlobalSettings();
        reloadLocale();
        sessionManager = new SessionManager(this);
        statsManager = new StatsManager(this);
        migrationManager = new MigrationManager(this);
        fileUtil.createDirectories();
        config.load();
        taskManager.getExecutor().execute(() -> migrationManager.migrateLegacyFiles());
        registerEvents(new EventClientConnection(this), new EventChatReceived(this));
        registerCommands(new CommandAutotip(this), new CommandLimbo(this));
        Runtime.getRuntime().addShutdownHook(new Thread(sessionManager::logout));
        initialized = true;
    } catch (IOException e) {
        messageUtil.send("Autotip is disabled because it couldn't create the required files.");
        ErrorReport.reportException(e);
    } catch (IllegalStateException e) {
        messageUtil.send("Autotip is disabled because it couldn't connect to the API.");
        ErrorReport.reportException(e);
    }
}
Also used : ConfigCreator(me.semx11.autotip.gson.creator.ConfigCreator) CommandAutotip(me.semx11.autotip.command.impl.CommandAutotip) GsonBuilder(com.google.gson.GsonBuilder) EventClientConnection(me.semx11.autotip.event.impl.EventClientConnection) Config(me.semx11.autotip.config.Config) SessionManager(me.semx11.autotip.core.SessionManager) CommandLimbo(me.semx11.autotip.command.impl.CommandLimbo) StatsDailyCreator(me.semx11.autotip.gson.creator.StatsDailyCreator) IOException(java.io.IOException) MigrationManager(me.semx11.autotip.core.MigrationManager) AnnotationExclusionStrategy(me.semx11.autotip.gson.exclusion.AnnotationExclusionStrategy) StatsManager(me.semx11.autotip.core.StatsManager) EventChatReceived(me.semx11.autotip.event.impl.EventChatReceived) FileUtil(me.semx11.autotip.util.FileUtil)

Aggregations

GsonBuilder (com.google.gson.GsonBuilder)1 IOException (java.io.IOException)1 CommandAutotip (me.semx11.autotip.command.impl.CommandAutotip)1 CommandLimbo (me.semx11.autotip.command.impl.CommandLimbo)1 Config (me.semx11.autotip.config.Config)1 MigrationManager (me.semx11.autotip.core.MigrationManager)1 SessionManager (me.semx11.autotip.core.SessionManager)1 StatsManager (me.semx11.autotip.core.StatsManager)1 EventChatReceived (me.semx11.autotip.event.impl.EventChatReceived)1 EventClientConnection (me.semx11.autotip.event.impl.EventClientConnection)1 ConfigCreator (me.semx11.autotip.gson.creator.ConfigCreator)1 StatsDailyCreator (me.semx11.autotip.gson.creator.StatsDailyCreator)1 AnnotationExclusionStrategy (me.semx11.autotip.gson.exclusion.AnnotationExclusionStrategy)1 FileUtil (me.semx11.autotip.util.FileUtil)1