Search in sources :

Example 1 with Metrics

use of com.palmergames.bukkit.metrics.Metrics in project Towny by ElgarL.

the class Towny method onEnable.

@Override
public void onEnable() {
    System.out.println("====================      Towny      ========================");
    /*
		 * Register Metrics
		 */
    try {
        Metrics metrics = new Metrics(this);
        metrics.start();
    } catch (IOException e) {
        System.err.println("[Towny] Error setting up metrics");
    }
    version = this.getDescription().getVersion();
    townyUniverse = new TownyUniverse(this);
    // Setup classes
    BukkitTools.initialize(this);
    TownyTimerHandler.initialize(this);
    TownyEconomyHandler.initialize(this);
    TownyFormatter.initialize(this);
    TownyRegenAPI.initialize(this);
    PlayerCacheUtil.initialize(this);
    TownyPerms.initialize(this);
    if (load()) {
        // Setup bukkit command interfaces
        getCommand("townyadmin").setExecutor(new TownyAdminCommand(this));
        getCommand("townyworld").setExecutor(new TownyWorldCommand(this));
        getCommand("resident").setExecutor(new ResidentCommand(this));
        getCommand("towny").setExecutor(new TownyCommand(this));
        getCommand("town").setExecutor(new TownCommand(this));
        getCommand("nation").setExecutor(new NationCommand(this));
        getCommand("plot").setExecutor(new PlotCommand(this));
        TownyWar.onEnable();
        if (TownySettings.isTownyUpdating(getVersion()))
            update();
        // Register all child permissions for ranks
        TownyPerms.registerPermissionNodes();
    }
    registerEvents();
    TownyLogger.log.info("=============================================================");
    if (isError())
        TownyLogger.log.info("[WARNING] - ***** SAFE MODE ***** " + version);
    else
        TownyLogger.log.info("[Towny] Version: " + version + " - Mod Enabled");
    TownyLogger.log.info("=============================================================");
    if (!isError()) {
        // Re login anyone online. (In case of plugin reloading)
        for (Player player : BukkitTools.getOnlinePlayers()) if (player != null)
            try {
                getTownyUniverse().onLogin(player);
            } catch (TownyException x) {
                TownyMessaging.sendErrorMsg(player, x.getMessage());
            }
    }
}
Also used : Metrics(com.palmergames.bukkit.metrics.Metrics) Player(org.bukkit.entity.Player) IOException(java.io.IOException) TownyException(com.palmergames.bukkit.towny.exceptions.TownyException)

Aggregations

Metrics (com.palmergames.bukkit.metrics.Metrics)1 TownyException (com.palmergames.bukkit.towny.exceptions.TownyException)1 IOException (java.io.IOException)1 Player (org.bukkit.entity.Player)1