1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-04 23:37:49 +01:00

StackMobs build seems to be working

This commit is contained in:
montlikadani 2020-12-18 20:15:45 +01:00
parent 8cd5061ece
commit 89649acb9e
5 changed files with 15 additions and 18 deletions

View File

@ -195,7 +195,6 @@ public class PlayerManager {
} }
jPlayer.setPaymentLimit(Jobs.getJobsDAO().getPlayersLimits(jPlayer)); jPlayer.setPaymentLimit(Jobs.getJobsDAO().getPlayersLimits(jPlayer));
jPlayer.setPoints(Jobs.getJobsDAO().getPlayerPoints(jPlayer)); jPlayer.setPoints(Jobs.getJobsDAO().getPlayerPoints(jPlayer));
} }
// Lets load quest progression // Lets load quest progression

View File

@ -88,7 +88,7 @@ public class HookManager {
} }
private static boolean setWorldGuard() { private static boolean setWorldGuard() {
if (JobsHook.WorldGuard.enabled()) { if (JobsHook.WorldGuard.isEnabled()) {
worldGuardManager = new WorldGuardManager(); worldGuardManager = new WorldGuardManager();
Jobs.consoleMsg("&e[Jobs] WorldGuard detected."); Jobs.consoleMsg("&e[Jobs] WorldGuard detected.");
return true; return true;
@ -98,7 +98,7 @@ public class HookManager {
} }
private static void setMythicManager() { private static void setMythicManager() {
if (!JobsHook.MythicMobs.enabled()) if (!JobsHook.MythicMobs.isEnabled())
return; return;
try { try {
@ -128,21 +128,21 @@ public class HookManager {
} }
private static void setMyPetManager() { private static void setMyPetManager() {
if (JobsHook.MyPet.enabled()) { if (JobsHook.MyPet.isEnabled()) {
myPetManager = new MyPetManager(); myPetManager = new MyPetManager();
Jobs.consoleMsg("&e[Jobs] MyPet detected."); Jobs.consoleMsg("&e[Jobs] MyPet detected.");
} }
} }
private static void setStackMobHandler() { private static void setStackMobHandler() {
if (JobsHook.StackMob.enabled()) { if (JobsHook.StackMob.isEnabled()) {
stackMobHandler = new StackMobHandler(); stackMobHandler = new StackMobHandler();
} }
} }
private static void setWildStackerHandler() { private static void setWildStackerHandler() {
if (JobsHook.WildStacker.enabled()) { if (JobsHook.WildStacker.isEnabled()) {
wildStackerHandler = new WildStackerHandler(); wildStackerHandler = new WildStackerHandler();
} }
} }
} }

View File

@ -10,12 +10,12 @@ public enum JobsHook {
MythicMobs, MythicMobs,
mcMMO; mcMMO;
Boolean enabled = null; private Boolean enabled;
public boolean enabled() { public boolean isEnabled() {
if (enabled == null) { if (enabled == null) {
enabled = Jobs.getInstance().getServer().getPluginManager().getPlugin(this.name()) != null && enabled = Jobs.getInstance().getServer().getPluginManager().getPlugin(name()) != null &&
Jobs.getInstance().getServer().getPluginManager().isPluginEnabled(this.name()); Jobs.getInstance().getServer().getPluginManager().isPluginEnabled(name());
} }
return enabled; return enabled;
} }

View File

@ -17,9 +17,7 @@ public class StackMobHandler extends HookPlugin {
} }
public HashSet<StackEntity> getStackEntities() { public HashSet<StackEntity> getStackEntities() {
return new HashSet<>(); return getPlugin().getEntityManager().getStackEntities();
// waiting for the author to fix build issue
//return getPlugin().getEntityManager().getStackEntities();
} }
@Override @Override

View File

@ -304,7 +304,7 @@ public class JobsPaymentListener implements Listener {
if (jDamager == null || sheep.getColor() == null) if (jDamager == null || sheep.getColor() == null)
return; 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()) { for (com.bgsoftware.wildstacker.api.objects.StackedEntity stacked : HookManager.getWildStackerHandler().getStackedEntities()) {
if (stacked.getType() == sheep.getType()) { if (stacked.getType() == sheep.getType()) {
Jobs.action(jDamager, new CustomKillInfo(((Sheep) stacked.getLivingEntity()).getColor().name(), ActionType.SHEAR)); Jobs.action(jDamager, new CustomKillInfo(((Sheep) stacked.getLivingEntity()).getColor().name(), ActionType.SHEAR));
@ -537,7 +537,7 @@ public class JobsPaymentListener implements Listener {
if (jDamager == null) if (jDamager == null)
return; 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()) { for (com.bgsoftware.wildstacker.api.objects.StackedEntity stacked : HookManager.getWildStackerHandler().getStackedEntities()) {
if (stacked.getType() == animal.getType()) { if (stacked.getType() == animal.getType()) {
Jobs.action(jDamager, new EntityActionInfo(stacked.getLivingEntity(), ActionType.TAME)); Jobs.action(jDamager, new EntityActionInfo(stacked.getLivingEntity(), ActionType.TAME));
@ -1244,7 +1244,7 @@ public class JobsPaymentListener implements Listener {
return; 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()) { for (com.bgsoftware.wildstacker.api.objects.StackedEntity stacked : HookManager.getWildStackerHandler().getStackedEntities()) {
if (stacked.getType() == lVictim.getType()) { if (stacked.getType() == lVictim.getType()) {
Jobs.action(jDamager, new EntityActionInfo(stacked.getLivingEntity(), ActionType.KILL), e.getDamager(), stacked.getLivingEntity()); 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) { public void onPlayerInteract(PlayerInteractEvent event) {
if (event.isCancelled()) if (event.isCancelled())
return; return;
Player p = event.getPlayer(); Player p = event.getPlayer();
if (!Jobs.getGCManager().canPerformActionInWorld(p.getWorld())) if (!Jobs.getGCManager().canPerformActionInWorld(p.getWorld()))
return; return;