Files
src
build.gradle
manifest.kod
Code
20 1,082
src/main/java/com/nexoshop/NexoShop.java
package com.nexoshop;
import com.nexoshop.command.MainCommand;
import com.nexoshop.command.ShopCommand;
import com.nexoshop.economy.EconomyManager;
import com.nexoshop.inventory.gui.GUIListener;
import com.nexoshop.inventory.gui.GUIManager;
import com.nexoshop.manager.ConfigManager;
import com.nexoshop.manager.ShopManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class NexoShop extends JavaPlugin {
private ConfigManager configManager;
private ShopManager shopManager;
private EconomyManager economyManager;
private GUIManager guiManager;
@Override
public void onEnable() {
if (!setupDependencies()) {
getLogger().severe("Missing required dependencies!");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
this.configManager = new ConfigManager(this);
configManager.loadAll();
this.economyManager = new EconomyManager(this);
if (!economyManager.setupEconomy()) {
getLogger().severe("Failed to setup economy!");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
this.guiManager = new GUIManager();
this.shopManager = new ShopManager(this);
shopManager.loadShops();
registerCommands();
registerListeners();
getLogger().info("NexoShop enabled successfully!");
}
@Override
public void onDisable() {
if (shopManager != null) {
shopManager.saveShops();
}
getLogger().info("NexoShop disabled!");
}
private boolean setupDependencies() {
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
getLogger().severe("Vault not found!");
return false;
}
if (Bukkit.getPluginManager().getPlugin("Nexo") == null) {
getLogger().severe("Nexo not found!");
return false;
}
return true;
}
private void registerCommands() {
getCommand("shop").setExecutor(new ShopCommand(this));
getCommand("nexoshop").setExecutor(new MainCommand(this));
}
private void registerListeners() {
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
}
public void reload() {
configManager.loadAll();
shopManager.loadShops();
}
}