Files
src
build.gradle
Code
27 1,788
src/main/java/com/townsellhub/TownSellHub.java
package com.townsellhub;
import com.townsellhub.command.TownSellCommand;
import com.townsellhub.inventory.gui.GUIListener;
import com.townsellhub.inventory.gui.GUIManager;
import com.townsellhub.listener.NPCInteractListener;
import com.townsellhub.listener.ProtectionListener;
import com.townsellhub.manager.ConfigManager;
import com.townsellhub.manager.DiamondEconomy;
import com.townsellhub.manager.HubManager;
import com.townsellhub.manager.NPCManager;
import com.townsellhub.manager.RegionProtection;
import com.townsellhub.manager.ShopManager;
import com.townsellhub.manager.StructureBuilder;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class TownSellHub extends JavaPlugin {
private ConfigManager configManager;
private DiamondEconomy diamondEconomy;
private StructureBuilder structureBuilder;
private RegionProtection regionProtection;
private NPCManager npcManager;
private ShopManager shopManager;
private HubManager hubManager;
private GUIManager guiManager;
@Override
public void onEnable() {
this.saveDefaultConfig();
this.configManager = new ConfigManager(this);
this.diamondEconomy = new DiamondEconomy(this);
this.structureBuilder = new StructureBuilder(this);
this.regionProtection = new RegionProtection(this);
this.npcManager = new NPCManager(this);
this.shopManager = new ShopManager(this);
this.guiManager = new GUIManager();
this.hubManager = new HubManager(this);
this.getCommand("townsell").setExecutor(new TownSellCommand(this));
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
Bukkit.getPluginManager().registerEvents(new ProtectionListener(this), this);
Bukkit.getPluginManager().registerEvents(new NPCInteractListener(this), this);
this.hubManager.loadHub();
this.getLogger().info("TownSellHub enabled successfully!");
}
@Override
public void onDisable() {
if (this.hubManager != null) {
this.hubManager.saveHub();
}
if (this.npcManager != null) {
this.npcManager.removeAllNPCs();
}
this.getLogger().info("TownSellHub disabled successfully!");
}
}