Search in sources :

Example 1 with VaultHandler

use of biz.princeps.landlord.handler.VaultHandler 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
    }
}
Also used : LPlayerManager(biz.princeps.landlord.manager.LPlayerManager) LangManager(biz.princeps.landlord.manager.LangManager) WorldGuardHandler(biz.princeps.landlord.handler.WorldGuardHandler) VaultHandler(biz.princeps.landlord.handler.VaultHandler) DatabaseAPI(biz.princeps.lib.storage.DatabaseAPI) Requests(biz.princeps.landlord.persistent.Requests) Conditions(biz.princeps.lib.storage.requests.Conditions) LPlayer(biz.princeps.landlord.persistent.LPlayer) Metrics(biz.princeps.landlord.util.Metrics) CostManager(biz.princeps.landlord.manager.CostManager) MapManager(biz.princeps.landlord.manager.map.MapManager)

Aggregations

VaultHandler (biz.princeps.landlord.handler.VaultHandler)1 WorldGuardHandler (biz.princeps.landlord.handler.WorldGuardHandler)1 CostManager (biz.princeps.landlord.manager.CostManager)1 LPlayerManager (biz.princeps.landlord.manager.LPlayerManager)1 LangManager (biz.princeps.landlord.manager.LangManager)1 MapManager (biz.princeps.landlord.manager.map.MapManager)1 LPlayer (biz.princeps.landlord.persistent.LPlayer)1 Requests (biz.princeps.landlord.persistent.Requests)1 Metrics (biz.princeps.landlord.util.Metrics)1 DatabaseAPI (biz.princeps.lib.storage.DatabaseAPI)1 Conditions (biz.princeps.lib.storage.requests.Conditions)1