From a707f8a991bb5ff8c8fd9ed2ebd3a791a6e130dc Mon Sep 17 00:00:00 2001 From: Zrips Date: Mon, 17 Jun 2024 12:44:13 +0300 Subject: [PATCH] Version up --- .../gamingmesh/jobs/hooks/HookManager.java | 25 ++++++++++++------- .../com/gamingmesh/jobs/hooks/JobsHook.java | 12 +++------ .../pyroFishingPro/PyroFishingProManager.java | 2 ++ .../jobs/listeners/JobsPaymentListener.java | 1 - 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java index f2ab3f15..d0c6ef46 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java @@ -17,6 +17,7 @@ import com.gamingmesh.jobs.hooks.stackMob.StackMobHandler; import com.gamingmesh.jobs.hooks.wildStacker.WildStackerHandler; import net.Zrips.CMILib.Messages.CMIMessages; +import net.Zrips.CMILib.Version.Schedulers.CMIScheduler; public class HookManager { @@ -36,13 +37,15 @@ public class HookManager { public static void loadHooks() { pm = PLUGIN.getServer().getPluginManager(); - setMyPetManager(); - setWorldGuard(); - setMythicManager(); - setStackMobHandler(); - setWildStackerHandler(); - setBlockTrackerManager(); - setPyroFishingProManager(); + CMIScheduler.runTask(() -> { + setMyPetManager(); + setWorldGuard(); + setMythicManager(); + setStackMobHandler(); + setWildStackerHandler(); + setBlockTrackerManager(); + setPyroFishingProManager(); + }); } public static StackMobHandler getStackMobHandler() { @@ -110,7 +113,7 @@ public class HookManager { private static boolean setWorldGuard() { if (JobsHook.WorldGuard.isEnabled()) { worldGuardManager = new WorldGuardManager(); - CMIMessages.consoleMessage("&eWorldGuard detected."); + CMIMessages.consoleMessage("&e" + JobsHook.WorldGuard + " detected."); return true; } @@ -144,31 +147,35 @@ public class HookManager { private static void setMyPetManager() { if (JobsHook.MyPet.isEnabled()) { myPetManager = new MyPetManager(); - CMIMessages.consoleMessage("&eMyPet detected."); + CMIMessages.consoleMessage("&e" + JobsHook.MyPet + " detected."); } } private static void setStackMobHandler() { if (JobsHook.StackMob.isEnabled()) { stackMobHandler = new StackMobHandler(); + CMIMessages.consoleMessage("&e" + JobsHook.StackMob + " detected."); } } private static void setWildStackerHandler() { if (JobsHook.WildStacker.isEnabled()) { wildStackerHandler = new WildStackerHandler(); + CMIMessages.consoleMessage("&e" + JobsHook.WildStacker + " detected."); } } private static void setBlockTrackerManager() { if (JobsHook.BlockTracker.isEnabled()) { blockTrackerManager = new BlockTrackerManager(); + CMIMessages.consoleMessage("&e" + JobsHook.BlockTracker + " detected."); } } private static void setPyroFishingProManager() { if (JobsHook.PyroFishingPro.isEnabled()) { pyroFishingProManager = new PyroFishingProManager(); + CMIMessages.consoleMessage("&e" + JobsHook.PyroFishingPro + " detected."); } } } diff --git a/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java b/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java index 0bb594ea..9f039953 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java @@ -18,18 +18,14 @@ public enum JobsHook { private Boolean present; public boolean isEnabled() { - if (enabled == null) { - enabled = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().isPluginEnabled(name()); - } - + if (enabled == null) + enabled = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().isPluginEnabled(name()); return enabled; } public boolean isPresent() { - if (present == null) { - present = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().getPlugin(name()) != null; - } - + if (present == null) + present = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().getPlugin(name()) != null; return present; } } 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 2f1b3cfa..bb3380df 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/pyroFishingPro/PyroFishingProManager.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/pyroFishingPro/PyroFishingProManager.java @@ -7,6 +7,7 @@ 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; @@ -25,6 +26,7 @@ public class PyroFishingProManager implements Listener { } public static String getFish() { + CMIDebug.d("Get fish", time + 60 < System.currentTimeMillis(), lastFish); if (time + 60 < System.currentTimeMillis()) return null; return lastFish; diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 3227ca76..746c5371 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -557,7 +557,6 @@ public final class JobsPaymentListener implements Listener { // check is mcMMO enabled if (JobsHook.mcMMO.isEnabled()) { McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); - // check is the fishing being exploited. If yes, prevent payment. if (mcMMOPlayer != null && ExperienceConfig.getInstance().isFishingExploitingPrevented() && mcMMOPlayer.getFishingManager().isExploitingFishing(event.getHook().getLocation().toVector())) {