This commit is contained in:
Logan Magnan 2024-09-22 10:45:46 -04:00
parent d87c25fcb2
commit 568fe21af6

View File

@ -17,60 +17,73 @@ import java.util.HashMap;
@Setter @Setter
public class PluginBase extends JavaPlugin { public class PluginBase extends JavaPlugin {
// Main Class Instance // Main class instance
@Getter private static PluginBase instance; @Getter private static PluginBase instance;
// Configuration Files // Configuration files
private Config mainConfig; private Config mainConfig;
private FileConfig messagesConfig; private FileConfig messagesConfig;
// Managers // Managers
// Menu System // Menu system
private HashMap<Player, PlayerMenuUtil> playerMenuUtilMap = new HashMap<>(); private HashMap<Player, PlayerMenuUtil> playerMenuUtilMap = new HashMap<>();
// Command Framework // Command framework
private CommandFramework commandFramework = new CommandFramework(this); private CommandFramework commandFramework = new CommandFramework(this);
// On enable function
@Override @Override
public void onEnable() { public void onEnable() {
// Initialize the main class instance
instance = this; instance = this;
// Initialize all of the configuration files
this.saveDefaultConfig(); this.saveDefaultConfig();
this.mainConfig = new Config("config", this); this.mainConfig = new Config("config", this);
this.messagesConfig = new FileConfig(this, "messages.yml"); this.messagesConfig = new FileConfig(this, "messages.yml");
// Say the plugin's name
this.getServer().getConsoleSender().sendMessage(Utils.chatBar); this.getServer().getConsoleSender().sendMessage(Utils.chatBar);
this.getServer().getConsoleSender().sendMessage(ColorUtils.getMessageType("&dPluginBase &7- &av" + this.getDescription().getVersion())); this.getServer().getConsoleSender().sendMessage(ColorUtils.getMessageType("&dPluginBase &7- &av" + this.getDescription().getVersion()));
this.getServer().getConsoleSender().sendMessage(ColorUtils.getMessageType("&7Made by &eLoganM Development")); this.getServer().getConsoleSender().sendMessage(ColorUtils.getMessageType("&7Made by &eLoganM Development"));
this.getServer().getConsoleSender().sendMessage(Utils.chatBar); this.getServer().getConsoleSender().sendMessage(Utils.chatBar);
// Load all of the functions
this.loadCommands(); this.loadCommands();
this.loadManagers(); this.loadManagers();
this.loadListeners(); this.loadListeners();
this.loadRunnables(); this.loadRunnables();
} }
// On disable function
@Override @Override
public void onDisable() { public void onDisable() {
// Remove the main class instance
instance = null; instance = null;
} }
// Load commands function
private void loadCommands() { private void loadCommands() {
ClassRegistrationUtils.loadCommands("com.loganmagnan.pluginbase.commands"); ClassRegistrationUtils.loadCommands("com.loganmagnan.pluginbase.commands");
} }
// Load managers function
private void loadManagers() { private void loadManagers() {
} }
// Load listeners function
private void loadListeners() { private void loadListeners() {
ClassRegistrationUtils.loadListeners("com.loganmagnan.pluginbase.listeners"); ClassRegistrationUtils.loadListeners("com.loganmagnan.pluginbase.listeners");
} }
// Load runnables function
private void loadRunnables() { private void loadRunnables() {
} }
// Menu system function
public PlayerMenuUtil getPlayerMenuUtil(Player player) { public PlayerMenuUtil getPlayerMenuUtil(Player player) {
PlayerMenuUtil playerMenuUtil; PlayerMenuUtil playerMenuUtil;