Search in sources :

Example 1 with AccountManager

use of com.erigitic.config.AccountManager in project TotalEconomy by Erigitic.

the class TotalEconomy method preInit.

@Listener
public void preInit(GamePreInitializationEvent event) {
    setupConfig();
    defaultCurrency = new TECurrency(Text.of(config.getNode("currency", "currency-singular").getValue()), Text.of(config.getNode("currency", "currency-plural").getValue()), Text.of(config.getNode("currency", "symbol").getValue()), 2, true, config.getNode("currency", "prefix-symbol").getBoolean());
    loadJobs = config.getNode("features", "jobs", "enable").getBoolean();
    loadSalary = config.getNode("features", "jobs", "salary").getBoolean();
    databaseActive = config.getNode("database", "enable").getBoolean();
    jobPermissions = config.getNode("features", "jobs", "permissions").getBoolean();
    jobNotifications = config.getNode("features", "jobs", "notifications").getBoolean();
    loadMoneyCap = config.getNode("features", "moneycap", "enable").getBoolean();
    if (databaseActive) {
        databaseUrl = config.getNode("database", "url").getString();
        databaseUser = config.getNode("database", "user").getString();
        databasePassword = config.getNode("database", "password").getString();
        sqlHandler = new SQLHandler(this);
    }
    saveInterval = config.getNode("save-interval").getInt(30);
    accountManager = new AccountManager(this);
    game.getServiceManager().setProvider(this, EconomyService.class, accountManager);
    //Only setup job stuff if config is set to load jobs
    if (loadJobs) {
        teJobManager = new TEJobManager(this);
    }
    if (loadMoneyCap == true) {
        moneyCap = BigDecimal.valueOf(config.getNode("features", "moneycap", "amount").getFloat()).setScale(2, BigDecimal.ROUND_DOWN);
    }
}
Also used : TECurrency(com.erigitic.config.TECurrency) SQLHandler(com.erigitic.sql.SQLHandler) AccountManager(com.erigitic.config.AccountManager) TEJobManager(com.erigitic.jobs.TEJobManager) Listener(org.spongepowered.api.event.Listener)

Aggregations

AccountManager (com.erigitic.config.AccountManager)1 TECurrency (com.erigitic.config.TECurrency)1 TEJobManager (com.erigitic.jobs.TEJobManager)1 SQLHandler (com.erigitic.sql.SQLHandler)1 Listener (org.spongepowered.api.event.Listener)1