Files
src
build.gradle
manifest.kod
Code
28 2,345
src/main/java/com/example/duelarena/DuelArena.java
package com.example.duelarena;
import com.example.duelarena.arena.ArenaManager;
import com.example.duelarena.command.ArenaCommand;
import com.example.duelarena.command.DuelCommand;
import com.example.duelarena.command.KitCommand;
import com.example.duelarena.command.PointsCommand;
import com.example.duelarena.command.QueueCommand;
import com.example.duelarena.config.ConfigManager;
import com.example.duelarena.data.DataManager;
import com.example.duelarena.duel.DuelManager;
import com.example.duelarena.inventory.gui.GUIListener;
import com.example.duelarena.inventory.gui.GUIManager;
import com.example.duelarena.kit.KitManager;
import com.example.duelarena.queue.QueueManager;
import com.example.duelarena.scoreboard.ScoreboardManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class DuelArena extends JavaPlugin {
private ConfigManager configManager;
private DataManager dataManager;
private KitManager kitManager;
private ArenaManager arenaManager;
private QueueManager queueManager;
private DuelManager duelManager;
private ScoreboardManager scoreboardManager;
private GUIManager guiManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.configManager = new ConfigManager(this);
this.dataManager = new DataManager(this);
this.kitManager = new KitManager(this);
this.arenaManager = new ArenaManager(this);
this.queueManager = new QueueManager(this);
this.duelManager = new DuelManager(this);
this.scoreboardManager = new ScoreboardManager(this);
this.guiManager = new GUIManager();
getCommand("duel").setExecutor(new DuelCommand(this));
QueueCommand queueCommand = new QueueCommand(this);
getCommand("queue").setExecutor(queueCommand);
getCommand("queue").setTabCompleter(queueCommand);
PointsCommand pointsCommand = new PointsCommand(this);
getCommand("points").setExecutor(pointsCommand);
getCommand("points").setTabCompleter(pointsCommand);
ArenaCommand arenaCommand = new ArenaCommand(this);
getCommand("arena").setExecutor(arenaCommand);
getCommand("arena").setTabCompleter(arenaCommand);
KitCommand kitCommand = new KitCommand(this);
getCommand("kit").setExecutor(kitCommand);
getCommand("kit").setTabCompleter(kitCommand);
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
Bukkit.getPluginManager().registerEvents(duelManager, this);
dataManager.loadAllPlayers();
Bukkit.getScheduler().runTaskTimer(this, queueManager::processQueues, 20L, 20L);
getLogger().info("DuelArena has been enabled!");
}
@Override
public void onDisable() {
duelManager.endAllDuels();
queueManager.clearAllQueues();
dataManager.saveAllPlayers();
getLogger().info("DuelArena has been disabled!");
}
}