Files
src
build.gradle
Code
17 1,101
src/main/java/com/emeraldshops/EmeraldShopsPlugin.java
package com.emeraldshops;
import com.emeraldshops.command.EmeraldShopsCommand;
import com.emeraldshops.inventory.gui.GUIListener;
import com.emeraldshops.inventory.gui.GUIManager;
import com.emeraldshops.listener.VillagerClickListener;
import com.emeraldshops.listener.VillagerProtectionListener;
import com.emeraldshops.manager.ShopManager;
import com.emeraldshops.manager.WalletManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class EmeraldShopsPlugin extends JavaPlugin {
private GUIManager guiManager;
private ShopManager shopManager;
private WalletManager walletManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.guiManager = new GUIManager();
this.shopManager = new ShopManager(this);
this.walletManager = new WalletManager(this);
this.shopManager.loadShops();
this.walletManager.loadWallets();
getCommand("emeraldshops").setExecutor(new EmeraldShopsCommand(this));
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
Bukkit.getPluginManager().registerEvents(new VillagerClickListener(this), this);
Bukkit.getPluginManager().registerEvents(new VillagerProtectionListener(this), this);
getLogger().info("EmeraldShops enabled successfully!");
}
@Override
public void onDisable() {
if (shopManager != null) {
shopManager.saveShops();
}
if (walletManager != null) {
walletManager.saveWallets();
}
getLogger().info("EmeraldShops disabled successfully!");
}
}