Search in sources :

Example 1 with AccountStorage

use of com.nextplugins.economy.model.account.storage.AccountStorage in project NextEconomy by NextPlugins.

the class NextEconomy method onEnable.

@Override
public void onEnable() {
    getLogger().info("Iniciando carregamento do plugin.");
    val loadTime = Stopwatch.createStarted();
    if (updateChecker.canUpdate()) {
        val lastRelease = updateChecker.getLastRelease();
        getLogger().info("");
        getLogger().info("[NextUpdate] ATENÇÃO!");
        getLogger().info("[NextUpdate] Você está usando uma versão antiga do NextEconomy!");
        getLogger().info("[NextUpdate] Nova versão: " + lastRelease.getVersion());
        getLogger().info("[NextUpdate] Baixe aqui: " + lastRelease.getDownloadURL());
        getLogger().info("");
    } else {
        getLogger().info("[NextUpdate] Olá! Vim aqui revisar se a versão do NextEconomy está atualizada, e pelo visto sim! Obrigado por usar nossos plugins!");
    }
    sqlConnector = SQLProvider.of(this).setup(null);
    sqlExecutor = new SQLExecutor(sqlConnector);
    accountRepository = new AccountRepository(sqlExecutor);
    accountStorage = new AccountStorage(accountRepository);
    conversorManager = new ConversorManager(accountRepository);
    rankingStorage = new RankingStorage();
    backupManager = new BackupManager();
    locationManager = new LocationManager();
    groupWrapperManager = new GroupWrapperManager();
    interactionRegistry = new InteractionRegistry();
    discordCommandRegistry = new DiscordCommandRegistry();
    rankingChatBody = new RankingChatBody();
    internalTitleAPI = InternalAPIMapping.create();
    val nickValue = getConfig().getString("plugin.configuration.save-method", "NICK");
    val nickMode = nickValue.equalsIgnoreCase("NICK");
    accountStorage.init(nickMode);
    interactionRegistry.init();
    InventoryManager.enable(this);
    ConfigurationRegistry.of(this).register();
    CommandRegistry.of(this).register();
    VaultHookRegistry.of(this).register();
    MetricProvider.of(this).register();
    InventoryRegistry.of(this).register();
    ConversorRegistry.of(this).register();
    Bukkit.getScheduler().runTaskLater(this, () -> {
        PlaceholderRegistry.of(this).register();
        CustomRankingRegistry.of(this).register();
        ListenerRegistry.of(this).register();
        if (!PurseAPI.init())
            getLogger().info("Sistema de bolsa de valores desativado.");
        else
            // force purse update
            PurseAPI.getInstance();
        groupWrapperManager.init();
        // bump money top one time and add, if enabled, stands/npcs
        rankingStorage.updateRanking(true);
        registerPayDiscordManager();
        discordCommandRegistry.init();
        purgeBackups();
    }, 150L);
    loadTime.stop();
    getLogger().log(Level.INFO, "Plugin inicializado com sucesso. ({0})", loadTime);
}
Also used : lombok.val(lombok.val) LocationManager(com.nextplugins.economy.ranking.manager.LocationManager) RankingStorage(com.nextplugins.economy.ranking.storage.RankingStorage) RankingChatBody(com.nextplugins.economy.ranking.util.RankingChatBody) SQLExecutor(com.henryfabio.sqlprovider.executor.SQLExecutor) AccountRepository(com.nextplugins.economy.dao.repository.AccountRepository) ConversorManager(com.nextplugins.economy.api.conversor.ConversorManager) InteractionRegistry(com.nextplugins.economy.model.interactions.registry.InteractionRegistry) DiscordCommandRegistry(com.nextplugins.economy.command.discord.registry.DiscordCommandRegistry) BackupManager(com.nextplugins.economy.api.backup.BackupManager) GroupWrapperManager(com.nextplugins.economy.api.group.GroupWrapperManager) AccountStorage(com.nextplugins.economy.model.account.storage.AccountStorage)

Aggregations

SQLExecutor (com.henryfabio.sqlprovider.executor.SQLExecutor)1 BackupManager (com.nextplugins.economy.api.backup.BackupManager)1 ConversorManager (com.nextplugins.economy.api.conversor.ConversorManager)1 GroupWrapperManager (com.nextplugins.economy.api.group.GroupWrapperManager)1 DiscordCommandRegistry (com.nextplugins.economy.command.discord.registry.DiscordCommandRegistry)1 AccountRepository (com.nextplugins.economy.dao.repository.AccountRepository)1 AccountStorage (com.nextplugins.economy.model.account.storage.AccountStorage)1 InteractionRegistry (com.nextplugins.economy.model.interactions.registry.InteractionRegistry)1 LocationManager (com.nextplugins.economy.ranking.manager.LocationManager)1 RankingStorage (com.nextplugins.economy.ranking.storage.RankingStorage)1 RankingChatBody (com.nextplugins.economy.ranking.util.RankingChatBody)1 lombok.val (lombok.val)1