1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-30 21:07:48 +01:00

Version up

This commit is contained in:
Zrips 2024-06-17 12:44:13 +03:00
parent 42e3043062
commit a707f8a991
4 changed files with 22 additions and 18 deletions

View File

@ -17,6 +17,7 @@ import com.gamingmesh.jobs.hooks.stackMob.StackMobHandler;
import com.gamingmesh.jobs.hooks.wildStacker.WildStackerHandler; import com.gamingmesh.jobs.hooks.wildStacker.WildStackerHandler;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class HookManager { public class HookManager {
@ -36,6 +37,7 @@ public class HookManager {
public static void loadHooks() { public static void loadHooks() {
pm = PLUGIN.getServer().getPluginManager(); pm = PLUGIN.getServer().getPluginManager();
CMIScheduler.runTask(() -> {
setMyPetManager(); setMyPetManager();
setWorldGuard(); setWorldGuard();
setMythicManager(); setMythicManager();
@ -43,6 +45,7 @@ public class HookManager {
setWildStackerHandler(); setWildStackerHandler();
setBlockTrackerManager(); setBlockTrackerManager();
setPyroFishingProManager(); setPyroFishingProManager();
});
} }
public static StackMobHandler getStackMobHandler() { public static StackMobHandler getStackMobHandler() {
@ -110,7 +113,7 @@ public class HookManager {
private static boolean setWorldGuard() { private static boolean setWorldGuard() {
if (JobsHook.WorldGuard.isEnabled()) { if (JobsHook.WorldGuard.isEnabled()) {
worldGuardManager = new WorldGuardManager(); worldGuardManager = new WorldGuardManager();
CMIMessages.consoleMessage("&eWorldGuard detected."); CMIMessages.consoleMessage("&e" + JobsHook.WorldGuard + " detected.");
return true; return true;
} }
@ -144,31 +147,35 @@ public class HookManager {
private static void setMyPetManager() { private static void setMyPetManager() {
if (JobsHook.MyPet.isEnabled()) { if (JobsHook.MyPet.isEnabled()) {
myPetManager = new MyPetManager(); myPetManager = new MyPetManager();
CMIMessages.consoleMessage("&eMyPet detected."); CMIMessages.consoleMessage("&e" + JobsHook.MyPet + " detected.");
} }
} }
private static void setStackMobHandler() { private static void setStackMobHandler() {
if (JobsHook.StackMob.isEnabled()) { if (JobsHook.StackMob.isEnabled()) {
stackMobHandler = new StackMobHandler(); stackMobHandler = new StackMobHandler();
CMIMessages.consoleMessage("&e" + JobsHook.StackMob + " detected.");
} }
} }
private static void setWildStackerHandler() { private static void setWildStackerHandler() {
if (JobsHook.WildStacker.isEnabled()) { if (JobsHook.WildStacker.isEnabled()) {
wildStackerHandler = new WildStackerHandler(); wildStackerHandler = new WildStackerHandler();
CMIMessages.consoleMessage("&e" + JobsHook.WildStacker + " detected.");
} }
} }
private static void setBlockTrackerManager() { private static void setBlockTrackerManager() {
if (JobsHook.BlockTracker.isEnabled()) { if (JobsHook.BlockTracker.isEnabled()) {
blockTrackerManager = new BlockTrackerManager(); blockTrackerManager = new BlockTrackerManager();
CMIMessages.consoleMessage("&e" + JobsHook.BlockTracker + " detected.");
} }
} }
private static void setPyroFishingProManager() { private static void setPyroFishingProManager() {
if (JobsHook.PyroFishingPro.isEnabled()) { if (JobsHook.PyroFishingPro.isEnabled()) {
pyroFishingProManager = new PyroFishingProManager(); pyroFishingProManager = new PyroFishingProManager();
CMIMessages.consoleMessage("&e" + JobsHook.PyroFishingPro + " detected.");
} }
} }
} }

View File

@ -18,18 +18,14 @@ public enum JobsHook {
private Boolean present; private Boolean present;
public boolean isEnabled() { public boolean isEnabled() {
if (enabled == null) { if (enabled == null)
enabled = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().isPluginEnabled(name()); enabled = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().isPluginEnabled(name());
}
return enabled; return enabled;
} }
public boolean isPresent() { public boolean isPresent() {
if (present == null) { if (present == null)
present = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().getPlugin(name()) != null; present = JavaPlugin.getPlugin(Jobs.class).getServer().getPluginManager().getPlugin(name()) != null;
}
return present; return present;
} }
} }

View File

@ -7,6 +7,7 @@ import org.bukkit.event.Listener;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import me.arsmagica.API.PyroFishCatchEvent; import me.arsmagica.API.PyroFishCatchEvent;
import net.Zrips.CMILib.Logs.CMIDebug;
public class PyroFishingProManager implements Listener { public class PyroFishingProManager implements Listener {
private static String lastFish; private static String lastFish;
@ -25,6 +26,7 @@ public class PyroFishingProManager implements Listener {
} }
public static String getFish() { public static String getFish() {
CMIDebug.d("Get fish", time + 60 < System.currentTimeMillis(), lastFish);
if (time + 60 < System.currentTimeMillis()) if (time + 60 < System.currentTimeMillis())
return null; return null;
return lastFish; return lastFish;

View File

@ -557,7 +557,6 @@ public final class JobsPaymentListener implements Listener {
// check is mcMMO enabled // check is mcMMO enabled
if (JobsHook.mcMMO.isEnabled()) { if (JobsHook.mcMMO.isEnabled()) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
// check is the fishing being exploited. If yes, prevent payment. // check is the fishing being exploited. If yes, prevent payment.
if (mcMMOPlayer != null && ExperienceConfig.getInstance().isFishingExploitingPrevented() if (mcMMOPlayer != null && ExperienceConfig.getInstance().isFishingExploitingPrevented()
&& mcMMOPlayer.getFishingManager().isExploitingFishing(event.getHook().getLocation().toVector())) { && mcMMOPlayer.getFishingManager().isExploitingFishing(event.getHook().getLocation().toVector())) {