diff --git a/src/main/java/com/alttd/fishingevent/FishingEvent.java b/src/main/java/com/alttd/fishingevent/FishingEvent.java index deccac2..79e3a03 100644 --- a/src/main/java/com/alttd/fishingevent/FishingEvent.java +++ b/src/main/java/com/alttd/fishingevent/FishingEvent.java @@ -4,11 +4,14 @@ import com.alttd.fishingevent.commands.FishCommand; import com.alttd.fishingevent.config.Config; import com.alttd.fishingevent.config.Fishes; import com.alttd.fishingevent.config.Messages; +import com.alttd.fishingevent.config.NPCLocationConfig; import com.alttd.fishingevent.fish_generator.WaterFishGenerator; import com.alttd.fishingevent.listeners.CatchFish; import com.alttd.fishingevent.npc.NPCManager; import com.alttd.fishingevent.points.PointsManagement; import com.alttd.fishingevent.util.Logger; +import dev.sergiferry.playernpc.api.NPCLib; +import org.bukkit.Bukkit; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; @@ -20,6 +23,11 @@ public final class FishingEvent extends JavaPlugin { @Override public void onEnable() { this.logger = new Logger(getLogger()); + if (!loadNPCLib()) { + logger.severe("NPC Lib failed to load, shutting down plugin..."); + Bukkit.getPluginManager().disablePlugin(this); + return; + } registerEvents(getServer().getPluginManager()); //add a way to stop and start the fishing event and a way to stop all fishing (so 3 modes normal, active, disabled) reloadFishConfigs(); @@ -27,6 +35,14 @@ public final class FishingEvent extends JavaPlugin { NPCManager.spawnNPCs(this, logger); } + private boolean loadNPCLib() { + NPCLib instance = NPCLib.getInstance(); + if (instance == null) + return false; + NPCLib.PluginManager pluginManager = instance.registerPlugin(this); + return pluginManager != null; + } + @Override public void onDisable() { }