Search in sources :

Example 1 with V1_12_R1

use of xyz.derkades.ublisk.utils.version_helper.V1_12_R1 in project Ublisk by Derkades.

the class Main method onEnable.

@Override
public void onEnable() {
    instance = this;
    Ublisk.RESTART_ERROR = false;
    PacketListener.RUNNING = true;
    Listeners.register();
    Command.registerAll();
    Mobs.clearMobs();
    MobSpawn.startMobSpawning();
    for (Task task : Task.values()) task.start();
    Logger.startSiteLogger();
    TodoList.initialize(DataFile.MYSQL.getConfig().getString("todo.ip"), DataFile.MYSQL.getConfig().getInt("todo.port"), DataFile.MYSQL.getConfig().getString("todo.database"), DataFile.MYSQL.getConfig().getString("todo.user"), DataFile.MYSQL.getConfig().getString("todo.password"));
    for (UModule module : UModule.ALL_MODULES) {
        try {
            module.initialize();
        } catch (Exception e) {
            Logger.log(LogLevel.SEVERE, "Modules", "An error occured while initializing " + module.getClass().getSimpleName() + ": " + e.getMessage());
            e.printStackTrace();
        }
    }
    Bukkit.clearRecipes();
    Ublisk.NMS = new V1_12_R1();
    new SidebarAPI().onEnable();
    new URunnable() {

        public void run() {
            Logger.log(LogLevel.INFO, "Cache", "Building up cache, expect some lag..");
            for (Guild guild : Guild.getGuildsList()) {
                guild.getDescription();
                guild.getMembers();
                guild.getOwner();
                guild.getPoints();
            }
            for (UPlayer player : Ublisk.getOnlinePlayers()) {
                player.getXP();
            }
            Logger.log(LogLevel.INFO, "Cache", "Complete! Now containing " + Cache.size() + " objects.");
            Logger.log(LogLevel.INFO, "Guilds", "Deleting empty guilds...");
            for (Guild guild : Guild.getGuildsList()) {
                if (guild.getMembers().size() == 0) {
                    Logger.log(LogLevel.WARNING, "Guilds", "Automatically deleted " + guild.getName() + ", because it does not have any members.");
                    guild.remove();
                }
            }
        }
    }.runLater(10 * 20);
    for (UPlayer player : Ublisk.getOnlinePlayers()) {
        PlayerInfo.resetHashMaps(player);
    }
    Ublisk.openDatabaseConnection();
}
Also used : URunnable(xyz.derkades.ublisk.utils.URunnable) Task(xyz.derkades.ublisk.task.Task) UModule(xyz.derkades.ublisk.modules.UModule) UPlayer(xyz.derkades.ublisk.utils.UPlayer) V1_12_R1(xyz.derkades.ublisk.utils.version_helper.V1_12_R1) SidebarAPI(xyz.derkades.ublisk.ext.com.coloredcarrot.api.sidebar.SidebarAPI) Guild(xyz.derkades.ublisk.utils.Guild)

Aggregations

SidebarAPI (xyz.derkades.ublisk.ext.com.coloredcarrot.api.sidebar.SidebarAPI)1 UModule (xyz.derkades.ublisk.modules.UModule)1 Task (xyz.derkades.ublisk.task.Task)1 Guild (xyz.derkades.ublisk.utils.Guild)1 UPlayer (xyz.derkades.ublisk.utils.UPlayer)1 URunnable (xyz.derkades.ublisk.utils.URunnable)1 V1_12_R1 (xyz.derkades.ublisk.utils.version_helper.V1_12_R1)1