use of com.winthier.sql.SQLDatabase in project Skills by StarTux.
the class BukkitSkillsPlugin method onEnable.
@Override
public void onEnable() {
// Files
writeDefaultFiles(false);
reloadConfig();
// Economy
if (!setupEconomy()) {
getLogger().warning("Economy setup failed. Disabling skills.");
getServer().getPluginManager().disablePlugin(this);
return;
}
// Database
db = new SQLDatabase(this);
for (Class<?> clazz : SQLDB.getDatabaseClasses()) db.registerTable(clazz);
if (!db.createAllTables()) {
getLogger().warning("Database setup failed. Disabling skills.");
getServer().getPluginManager().disablePlugin(this);
return;
}
// Skills
skills.configure();
for (BukkitSkill skill : skills.getSkills()) {
if (skill instanceof Listener) {
getServer().getPluginManager().registerEvents((Listener) skill, this);
} else {
getLogger().warning("Not an Event Listener: " + skill.getDisplayName());
}
}
// Double check skills
for (BukkitSkillType type : BukkitSkillType.values()) {
BukkitSkill skill = skills.getSkillMap().get(type);
if (skill == null) {
getLogger().warning("Missing skill: " + type.name());
} else {
skill.configureSkill();
skill.onEnable();
}
}
// Commands
getCommand("skillsadmin").setExecutor(adminCommand);
getCommand("skills").setExecutor(skillsCommand);
getCommand("highscore").setExecutor(highscoreCommand);
// Events
getServer().getPluginManager().registerEvents(this, this);
// Tasks
new BukkitRunnable() {
@Override
public void run() {
saveSome();
updateAllPlayers();
}
}.runTaskTimer(this, 20, 20);
//
skills.buildNameMap();
}
Aggregations