From 89649acb9e9b3340cae724eb5e0cf20922807802 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Fri, 18 Dec 2020 20:15:45 +0100 Subject: [PATCH] StackMobs build seems to be working --- src/main/java/com/gamingmesh/jobs/PlayerManager.java | 1 - .../java/com/gamingmesh/jobs/hooks/HookManager.java | 12 ++++++------ .../java/com/gamingmesh/jobs/hooks/JobsHook.java | 8 ++++---- .../jobs/hooks/stackMob/StackMobHandler.java | 4 +--- .../jobs/listeners/JobsPaymentListener.java | 8 ++++---- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index 4755754c..9d842cf2 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -195,7 +195,6 @@ public class PlayerManager { } jPlayer.setPaymentLimit(Jobs.getJobsDAO().getPlayersLimits(jPlayer)); - jPlayer.setPoints(Jobs.getJobsDAO().getPlayerPoints(jPlayer)); } // Lets load quest progression diff --git a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java index d271f4fa..4c6fcc37 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java @@ -88,7 +88,7 @@ public class HookManager { } private static boolean setWorldGuard() { - if (JobsHook.WorldGuard.enabled()) { + if (JobsHook.WorldGuard.isEnabled()) { worldGuardManager = new WorldGuardManager(); Jobs.consoleMsg("&e[Jobs] WorldGuard detected."); return true; @@ -98,7 +98,7 @@ public class HookManager { } private static void setMythicManager() { - if (!JobsHook.MythicMobs.enabled()) + if (!JobsHook.MythicMobs.isEnabled()) return; try { @@ -128,21 +128,21 @@ public class HookManager { } private static void setMyPetManager() { - if (JobsHook.MyPet.enabled()) { + if (JobsHook.MyPet.isEnabled()) { myPetManager = new MyPetManager(); Jobs.consoleMsg("&e[Jobs] MyPet detected."); } } private static void setStackMobHandler() { - if (JobsHook.StackMob.enabled()) { + if (JobsHook.StackMob.isEnabled()) { stackMobHandler = new StackMobHandler(); } } private static void setWildStackerHandler() { - if (JobsHook.WildStacker.enabled()) { + if (JobsHook.WildStacker.isEnabled()) { wildStackerHandler = new WildStackerHandler(); } - } + } } diff --git a/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java b/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java index 7e0a0330..e546636e 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java @@ -10,12 +10,12 @@ public enum JobsHook { MythicMobs, mcMMO; - Boolean enabled = null; + private Boolean enabled; - public boolean enabled() { + public boolean isEnabled() { if (enabled == null) { - enabled = Jobs.getInstance().getServer().getPluginManager().getPlugin(this.name()) != null && - Jobs.getInstance().getServer().getPluginManager().isPluginEnabled(this.name()); + enabled = Jobs.getInstance().getServer().getPluginManager().getPlugin(name()) != null && + Jobs.getInstance().getServer().getPluginManager().isPluginEnabled(name()); } return enabled; } diff --git a/src/main/java/com/gamingmesh/jobs/hooks/stackMob/StackMobHandler.java b/src/main/java/com/gamingmesh/jobs/hooks/stackMob/StackMobHandler.java index 77beefa8..c0cffb07 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/stackMob/StackMobHandler.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/stackMob/StackMobHandler.java @@ -17,9 +17,7 @@ public class StackMobHandler extends HookPlugin { } public HashSet getStackEntities() { - return new HashSet<>(); - // waiting for the author to fix build issue - //return getPlugin().getEntityManager().getStackEntities(); + return getPlugin().getEntityManager().getStackEntities(); } @Override diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 10b92540..76eb79d5 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -304,7 +304,7 @@ public class JobsPaymentListener implements Listener { if (jDamager == null || sheep.getColor() == null) return; - if (Jobs.getGCManager().payForStackedEntities && JobsHook.WildStacker.enabled() && HookManager.getWildStackerHandler().isStackedEntity(sheep)) { + if (Jobs.getGCManager().payForStackedEntities && JobsHook.WildStacker.isEnabled() && HookManager.getWildStackerHandler().isStackedEntity(sheep)) { for (com.bgsoftware.wildstacker.api.objects.StackedEntity stacked : HookManager.getWildStackerHandler().getStackedEntities()) { if (stacked.getType() == sheep.getType()) { Jobs.action(jDamager, new CustomKillInfo(((Sheep) stacked.getLivingEntity()).getColor().name(), ActionType.SHEAR)); @@ -537,7 +537,7 @@ public class JobsPaymentListener implements Listener { if (jDamager == null) return; - if (Jobs.getGCManager().payForStackedEntities && JobsHook.WildStacker.enabled() && HookManager.getWildStackerHandler().isStackedEntity(animal)) { + if (Jobs.getGCManager().payForStackedEntities && JobsHook.WildStacker.isEnabled() && HookManager.getWildStackerHandler().isStackedEntity(animal)) { for (com.bgsoftware.wildstacker.api.objects.StackedEntity stacked : HookManager.getWildStackerHandler().getStackedEntities()) { if (stacked.getType() == animal.getType()) { Jobs.action(jDamager, new EntityActionInfo(stacked.getLivingEntity(), ActionType.TAME)); @@ -1244,7 +1244,7 @@ public class JobsPaymentListener implements Listener { return; } - if (Jobs.getGCManager().payForStackedEntities && JobsHook.WildStacker.enabled() && HookManager.getWildStackerHandler().isStackedEntity(lVictim)) { + if (Jobs.getGCManager().payForStackedEntities && JobsHook.WildStacker.isEnabled() && HookManager.getWildStackerHandler().isStackedEntity(lVictim)) { for (com.bgsoftware.wildstacker.api.objects.StackedEntity stacked : HookManager.getWildStackerHandler().getStackedEntities()) { if (stacked.getType() == lVictim.getType()) { Jobs.action(jDamager, new EntityActionInfo(stacked.getLivingEntity(), ActionType.KILL), e.getDamager(), stacked.getLivingEntity()); @@ -1582,7 +1582,7 @@ public class JobsPaymentListener implements Listener { public void onPlayerInteract(PlayerInteractEvent event) { if (event.isCancelled()) return; - + Player p = event.getPlayer(); if (!Jobs.getGCManager().canPerformActionInWorld(p.getWorld())) return;