Search in sources :

Example 1 with ButtonManager

use of me.gameisntover.kbffa.gui.ButtonManager in project KnockbackFFA by GaMeIsNtOvEr.

the class KnockbackFFA method onEnable.

@SneakyThrows
@Override
public void onEnable() {
    long time = System.currentTimeMillis();
    instance = this;
    getLogger().info("Loading config files...");
    if (!getDataFolder().exists())
        getDataFolder().mkdir();
    loadConfig();
    loadMessages();
    loadSounds();
    getLogger().info("Connecting to the database...");
    databaseManager = new DatabaseManager("SQLITE");
    arenaManager = new ArenaManager();
    kitManager = new KitManager();
    blockDataManager = new BlockDataManager();
    botManager = new BotManager();
    scoreboardManager = new BoardManager();
    buttonManager = new ButtonManager();
    Field f = getServer().getClass().getDeclaredField("commandMap");
    f.setAccessible(true);
    commandMap = (CommandMap) f.get(getServer());
    getLogger().info("Loading Commands");
    commandManager = new CommandManager();
    getLogger().info("Loading Listeners");
    loadListeners();
    getLogger().info("Loading Tasks");
    loadTasks();
    long takenTime = (System.currentTimeMillis() - time);
    getLogger().info("Plugin loaded successfully in " + takenTime + "ms");
    registerPlaceholders();
    if (!Bukkit.getOnlinePlayers().isEmpty()) {
        for (Player player : Bukkit.getOnlinePlayers()) {
            Knocker knocker = getKnocker(player);
            knocker.setInGame(BungeeMode());
        }
    }
    for (Knocker p : getInGamePlayers()) {
        if (p.getPlayer().getInventory().contains(Material.BOW) && !p.getPlayer().getInventory().contains(Material.ARROW))
            p.getInventory().addItem(Items.ARROW.getItem());
    }
}
Also used : ArenaManager(me.gameisntover.kbffa.arena.ArenaManager) Field(java.lang.reflect.Field) Player(org.bukkit.entity.Player) Knocker(me.gameisntover.kbffa.api.Knocker) BotManager(me.gameisntover.kbffa.bots.BotManager) CommandManager(me.gameisntover.kbffa.command.CommandManager) DatabaseManager(me.gameisntover.kbffa.database.DatabaseManager) ButtonManager(me.gameisntover.kbffa.gui.ButtonManager) KitManager(me.gameisntover.kbffa.kit.KitManager) BlockDataManager(me.gameisntover.kbffa.arena.regions.BlockDataManager) BoardManager(me.gameisntover.kbffa.scoreboard.BoardManager) SneakyThrows(lombok.SneakyThrows)

Aggregations

Field (java.lang.reflect.Field)1 SneakyThrows (lombok.SneakyThrows)1 Knocker (me.gameisntover.kbffa.api.Knocker)1 ArenaManager (me.gameisntover.kbffa.arena.ArenaManager)1 BlockDataManager (me.gameisntover.kbffa.arena.regions.BlockDataManager)1 BotManager (me.gameisntover.kbffa.bots.BotManager)1 CommandManager (me.gameisntover.kbffa.command.CommandManager)1 DatabaseManager (me.gameisntover.kbffa.database.DatabaseManager)1 ButtonManager (me.gameisntover.kbffa.gui.ButtonManager)1 KitManager (me.gameisntover.kbffa.kit.KitManager)1 BoardManager (me.gameisntover.kbffa.scoreboard.BoardManager)1 Player (org.bukkit.entity.Player)1