use of biz.princeps.landlord.persistent.Requests in project LandLord by SpatiumPrinceps.
the class Landlord method onEnable.
@Override
public void onEnable() {
// Dependency stuff
if (getWorldGuard() == null) {
getLogger().warning("WorldGuard not found! Please ensure you have the correct version of WorldGuard in order to use LandLord");
getPluginLoader().disablePlugin(this);
return;
} else
wgHandler = new WorldGuardHandler(getWorldGuard());
if (getVault() == null) {
getLogger().warning("Vault not found! Not all features of landlord are working.");
} else
vaultHandler = new VaultHandler(getVault());
if (!getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
getLogger().warning("ProtocolLib not found! Please ensure you have the correct version of ProtocolLib in order to use LandLord");
getPluginLoader().disablePlugin(this);
return;
}
instance = this;
PrincepsLib.setPluginInstance(this);
checkWorldNames();
saveDefaultConfig();
ConfigUtil.handleConfigUpdate(this.getDataFolder() + "/config.yml", "/config.yml");
saveDefaultConfig();
langManager = new LangManager(this, getConfig().getString("Language", "en"));
databaseAPI = new DatabaseAPI(DatabaseType.valueOf(getConfig().getString("DatabaseType")), getConfig(), new Requests(), "biz.princeps.landlord.persistent");
handleDatabase();
manageCommands();
manageListeners();
managePlaceholders();
manageItems();
lPlayerManager = new LPlayerManager(databaseAPI);
lPlayerManager.onStartup();
mapManager = new MapManager();
ScoreboardLib.setPluginInstance(this);
costManager = new CostManager();
executorService = Executors.newCachedThreadPool();
// Retrieve the LPlayer objects for all online players (in case of reload)
Bukkit.getOnlinePlayers().forEach(p -> {
List<Object> lPlayer = this.getDatabaseAPI().retrieveObjects(LPlayer.class, new Conditions.Builder().addCondition("uuid", p.getUniqueId().toString()).create());
LPlayer lp;
if (lPlayer.size() > 0)
lp = (LPlayer) lPlayer.get(0);
else
lp = new LPlayer(p.getUniqueId());
this.getPlayerManager().add(p.getUniqueId(), lp);
});
if (getConfig().getBoolean("EnableMetrics")) {
Metrics metrics = new Metrics(this);
// TODO maybe add some interesting statistics
}
}
Aggregations