Files
src
build.gradle
manifest.kod
Code
8 674
src/main/java/com/kodari/economy/VaultEconomyPlugin.java
package com.kodari.economy;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
import java.sql.SQLException;
public final class VaultEconomyPlugin extends JavaPlugin {
private DatabaseManager database;
private EconomyService economy;
@Override
public void onEnable() {
saveDefaultConfig();
database = new DatabaseManager(this);
try {
database.initialize();
} catch (SQLException exception) {
getLogger().severe("Could not initialize the economy database: " + exception.getMessage());
getServer().getPluginManager().disablePlugin(this);
return;
}
economy = new EconomyService(this, database);
getServer().getServicesManager().register(Economy.class, economy, this, ServicePriority.Highest);
EconomyCommand command = new EconomyCommand(economy);
getCommand("balance").setExecutor(command);
getCommand("balance").setTabCompleter(command);
getCommand("pay").setExecutor(command);
getCommand("pay").setTabCompleter(command);
getCommand("baltop").setExecutor(command);
getCommand("baltop").setTabCompleter(command);
}
@Override
public void onDisable() {
getServer().getServicesManager().unregisterAll(this);
if (database != null) {
database.close();
}
}
}