Files
src
build.gradle
manifest.kod
Code
21 1,801
src/main/java/com/example/grade/Grade.java
package com.example.grade;
import com.example.grade.commands.GradesAdminCommand;
import com.example.grade.commands.GradesCommand;
import com.example.grade.config.ConfigManager;
import com.example.grade.data.PlayerDataManager;
import com.example.grade.inventory.gui.GUIListener;
import com.example.grade.inventory.gui.GUIManager;
import com.example.grade.managers.GradeManager;
import com.example.grade.managers.PrestigeManager;
import com.example.grade.managers.ProgressionManager;
import com.example.grade.utils.MessageUtil;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
public class Grade extends JavaPlugin {
private BukkitAudiences adventure;
private ConfigManager configManager;
private PlayerDataManager playerDataManager;
private GradeManager gradeManager;
private ProgressionManager progressionManager;
private PrestigeManager prestigeManager;
private GUIManager guiManager;
private Economy economy;
@Override
public void onEnable() {
this.adventure = BukkitAudiences.create(this);
MessageUtil.init(this.adventure);
this.configManager = new ConfigManager(this);
this.playerDataManager = new PlayerDataManager(this);
this.gradeManager = new GradeManager(this);
this.progressionManager = new ProgressionManager(this);
this.prestigeManager = new PrestigeManager(this);
this.guiManager = new GUIManager();
if (this.configManager.isEconomyEnabled()) {
this.setupEconomy();
}
this.getCommand("grades").setExecutor(new GradesCommand(this));
this.getCommand("gradesadmin").setExecutor(new GradesAdminCommand(this));
Bukkit.getPluginManager().registerEvents(new GUIListener(this.guiManager), this);
this.getLogger().info("Grade plugin enabled!");
}
@Override
public void onDisable() {
if (this.adventure != null) {
this.adventure.close();
}
this.getLogger().info("Grade plugin disabled!");
}
private void setupEconomy() {
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
this.getLogger().warning("Vault not found! Economy features will be disabled.");
return;
}
RegisteredServiceProvider<Economy> rsp = this.getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
this.getLogger().warning("No economy provider found! Economy features will be disabled.");
return;
}
this.economy = rsp.getProvider();
this.getLogger().info("Economy system hooked successfully!");
}
public ConfigManager getConfigManager() {
return this.configManager;
}
public PlayerDataManager getPlayerDataManager() {
return this.playerDataManager;
}
public GradeManager getGradeManager() {
return this.gradeManager;
}
public ProgressionManager getProgressionManager() {
return this.progressionManager;
}
public PrestigeManager getPrestigeManager() {
return this.prestigeManager;
}
public GUIManager getGuiManager() {
return this.guiManager;
}
public Economy getEconomy() {
return this.economy;
}
}