Files
src
build.gradle
Code
28 1,974
src/main/java/com/axboosters/AxBoosters.java
package com.axboosters;
import com.axboosters.command.AdminBoosterCommand;
import com.axboosters.command.BoosterCommand;
import com.axboosters.config.ConfigManager;
import com.axboosters.inventory.gui.GUIListener;
import com.axboosters.inventory.gui.GUIManager;
import com.axboosters.listener.BoosterListener;
import com.axboosters.listener.PlayerListener;
import com.axboosters.manager.BoosterManager;
import com.axboosters.manager.CooldownManager;
import com.axboosters.manager.QueueManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class AxBoosters extends JavaPlugin {
private static AxBoosters instance;
private ConfigManager configManager;
private BoosterManager boosterManager;
private QueueManager queueManager;
private CooldownManager cooldownManager;
private GUIManager guiManager;
@Override
public void onEnable() {
instance = this;
this.configManager = new ConfigManager(this);
this.configManager.loadConfigs();
this.boosterManager = new BoosterManager(this);
this.queueManager = new QueueManager(this);
this.cooldownManager = new CooldownManager(this);
this.boosterManager.loadData();
this.guiManager = new GUIManager();
Bukkit.getPluginManager().registerEvents(new GUIListener(this.guiManager), this);
Bukkit.getPluginManager().registerEvents(new BoosterListener(this), this);
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
getCommand("booster").setExecutor(new BoosterCommand(this));
getCommand("boosteradmin").setExecutor(new AdminBoosterCommand(this));
startExpiryTask();
getLogger().info("AxBoosters v" + getDescription().getVersion() + " enabled!");
}
@Override
public void onDisable() {
if (this.boosterManager != null) {
this.boosterManager.saveData();
}
getLogger().info("AxBoosters disabled!");
}
private void startExpiryTask() {
Bukkit.getScheduler().runTaskTimer(this, () -> {
this.boosterManager.checkExpired();
}, 200L, 200L);
}
public static AxBoosters getInstance() {
return instance;
}
public ConfigManager getConfigManager() {
return this.configManager;
}
public BoosterManager getBoosterManager() {
return this.boosterManager;
}
public QueueManager getQueueManager() {
return this.queueManager;
}
public CooldownManager getCooldownManager() {
return this.cooldownManager;
}
public GUIManager getGuiManager() {
return this.guiManager;
}
}