Files
src
build.gradle
README.md
Code
26 2,298
src/main/java/com/bigdream/shopgui/DreamShopGUI.java
package com.bigdream.shopgui;
import com.bigdream.shopgui.commands.SellCommand;
import com.bigdream.shopgui.commands.ShopCommand;
import com.bigdream.shopgui.inventory.gui.GUIListener;
import com.bigdream.shopgui.inventory.gui.GUIManager;
import com.bigdream.shopgui.managers.ConfigManager;
import com.bigdream.shopgui.managers.CooldownManager;
import com.bigdream.shopgui.managers.EconomyManager;
import com.bigdream.shopgui.managers.MessageManager;
import com.bigdream.shopgui.managers.ShopManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class DreamShopGUI extends JavaPlugin {
private ConfigManager configManager;
private MessageManager messageManager;
private ShopManager shopManager;
private CooldownManager cooldownManager;
private EconomyManager economyManager;
private GUIManager guiManager;
@Override
public void onEnable() {
this.configManager = new ConfigManager(this);
this.messageManager = new MessageManager(this);
this.shopManager = new ShopManager(this);
this.cooldownManager = new CooldownManager(this);
this.economyManager = new EconomyManager(this);
this.guiManager = new GUIManager();
if (!this.economyManager.setupEconomy()) {
this.messageManager.log("&cVault not found! Disabling plugin...");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
this.configManager.load();
this.messageManager.load();
this.shopManager.loadShop();
this.cooldownManager.load();
this.getCommand("shop").setExecutor(new ShopCommand(this));
this.getCommand("sell").setExecutor(new SellCommand(this));
Bukkit.getPluginManager().registerEvents(new GUIListener(this.guiManager), this);
this.messageManager.log("&aDreamShopGUI v" + getDescription().getVersion() + " enabled!");
}
@Override
public void onDisable() {
if (this.cooldownManager != null) {
this.cooldownManager.save();
}
this.messageManager.log("&cDreamShopGUI disabled!");
}
public void reload() {
this.configManager.load();
this.messageManager.load();
this.shopManager.loadShop();
this.cooldownManager.load();
}
}