1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-28 12:00:23 +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 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.");
}
}
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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())) {