From 7c172ff54d48398131ffae176fae7bf1f81d5700 Mon Sep 17 00:00:00 2001 From: flo0s Date: Fri, 28 Jun 2024 02:06:30 +0200 Subject: [PATCH] add jobs reload compatibility to pyrofishing --- src/main/java/com/gamingmesh/jobs/Jobs.java | 3 +++ src/main/java/com/gamingmesh/jobs/hooks/HookManager.java | 4 ++++ .../jobs/hooks/pyroFishingPro/PyroFishingProManager.java | 7 +++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index e22ce1ca..5aefd64f 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -842,6 +842,9 @@ public final class Jobs extends JavaPlugin { pm.registerEvents(new JobsChatEvent(getInstance()), getInstance()); + if(HookManager.checkPyroFishingPro()) { + HookManager.getPyroFishingProManager().registerListener(); + } if (HookManager.getMcMMOManager().CheckmcMMO()) { HookManager.setMcMMOlistener(); } diff --git a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java index d0c6ef46..323e0376 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java @@ -102,6 +102,10 @@ public class HookManager { return Jobs.getGCManager().MythicMobsEnabled && MythicManager != null && MythicManager.check(); } + public static boolean checkPyroFishingPro() { + return pyroFishingProManager != null; + } + public static BlockTrackerManager getBlockTrackerManager() { if (blockTrackerManager == null) { blockTrackerManager = new BlockTrackerManager(); diff --git a/src/main/java/com/gamingmesh/jobs/hooks/pyroFishingPro/PyroFishingProManager.java b/src/main/java/com/gamingmesh/jobs/hooks/pyroFishingPro/PyroFishingProManager.java index b5b2a96f..300509df 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/pyroFishingPro/PyroFishingProManager.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/pyroFishingPro/PyroFishingProManager.java @@ -7,7 +7,6 @@ import org.bukkit.event.Listener; import com.gamingmesh.jobs.Jobs; import me.arsmagica.API.PyroFishCatchEvent; -import net.Zrips.CMILib.Logs.CMIDebug; public class PyroFishingProManager implements Listener { private static String lastFish; @@ -16,7 +15,7 @@ public class PyroFishingProManager implements Listener { public PyroFishingProManager() { this.jobs = Jobs.getInstance(); - jobs.getServer().getPluginManager().registerEvents(this, jobs); + registerListener(); } @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) @@ -30,4 +29,8 @@ public class PyroFishingProManager implements Listener { return null; return lastFish; } + + public void registerListener() { + jobs.getServer().getPluginManager().registerEvents(this, jobs); + } } \ No newline at end of file