From 0c4a43e6cc600074c6d18850c4058339f6af9b93 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Wed, 21 Oct 2020 17:31:32 +0200 Subject: [PATCH] Removed Boss dependency - Fix for mushroom cow can't be milked with bowl - Now pig_zombie will automatically changes to piglin in 1.16+ versions (for lazy peoples) --- .../jobs/commands/list/editquests.java | 3 +-- .../gamingmesh/jobs/config/ConfigManager.java | 26 +++++++++---------- .../jobs/config/NameTranslatorManager.java | 2 -- .../gamingmesh/jobs/container/ActionType.java | 3 +-- .../gamingmesh/jobs/hooks/HookManager.java | 17 ------------ .../jobs/listeners/JobsPaymentListener.java | 11 ++++---- 6 files changed, 20 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java b/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java index 1e4fc113..0c4dfec5 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java @@ -355,7 +355,6 @@ public class editquests implements Cmd { case KILL: case MILK: case MMKILL: - case BOSS: case BREED: case TAME: case SHEAR: @@ -517,7 +516,7 @@ public class editquests implements Cmd { } type = myKey; } else if (actionT == ActionType.CUSTOMKILL || actionT == ActionType.SHEAR || actionT == ActionType.MMKILL - || actionT == ActionType.COLLECT || actionT == ActionType.BAKE || actionT == ActionType.BOSS) + || actionT == ActionType.COLLECT || actionT == ActionType.BAKE) type = myKey; else if (actionT == ActionType.EXPLORE) { type = myKey; diff --git a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java index ff1ef0b2..935a3f36 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -406,7 +406,6 @@ public class ConfigManager { case KILL: case MILK: case MMKILL: - case BOSS: case BREED: case TAME: case SHEAR: @@ -526,18 +525,14 @@ public class ConfigManager { // check entities CMIEntityType entity = CMIEntityType.getByName(myKey); - if (entity != null) { - if (entity.isAlive()) { - type = entity.toString(); - id = entity.getId(); + // Change pig zombie -> piglin in 1.16+ + if (Version.isCurrentEqualOrHigher(Version.v1_16_R1) && entity == CMIEntityType.PIG_ZOMBIE) { + entity = CMIEntityType.PIGLIN; + } - // using breeder finder - if (actionType == ActionType.BREED) - Jobs.getGCManager().useBreederFinder = true; - } else if (entity == CMIEntityType.ENDER_CRYSTAL) { - type = entity.toString(); - id = entity.getId(); - } + if (entity != null && (entity.isAlive() || entity == CMIEntityType.ENDER_CRYSTAL)) { + type = entity.toString(); + id = entity.getId(); } // Pre 1.13 checks for custom names @@ -582,7 +577,6 @@ public class ConfigManager { break; } } - } else if (actionType == ActionType.ENCHANT) { CMIEnchantment enchant = CMIEnchantment.get(myKey); if (enchant == null && material == CMIMaterial.NONE) { @@ -592,7 +586,7 @@ public class ConfigManager { type = enchant == null ? myKey : enchant.toString(); } else if (actionType == ActionType.CUSTOMKILL || actionType == ActionType.COLLECT || actionType == ActionType.MMKILL - || actionType == ActionType.BAKE || actionType == ActionType.BOSS) { + || actionType == ActionType.BAKE) { type = myKey; } else if (actionType == ActionType.EXPLORE) { type = myKey; @@ -638,6 +632,10 @@ public class ConfigManager { if (actionType == ActionType.TNTBREAK) Jobs.getGCManager().setTntFinder(true); + // using breeder finder + if (actionType == ActionType.BREED) + Jobs.getGCManager().useBreederFinder = true; + KeyValues kv = new KeyValues(); kv.setId(id); kv.setMeta(meta); diff --git a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java index 36afe0d8..432dc01f 100644 --- a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java @@ -148,8 +148,6 @@ public class NameTranslatorManager { if (got != null && got.getName() != null) return got.getName(); return HookManager.getMythicManager() == null ? materialName : HookManager.getMythicManager().getDisplayName(materialName); - case BOSS: - return HookManager.getBossManager() == null ? materialName : HookManager.getBossManager().getName(materialName); default: break; } diff --git a/src/main/java/com/gamingmesh/jobs/container/ActionType.java b/src/main/java/com/gamingmesh/jobs/container/ActionType.java index b0363cb8..a58c1408 100644 --- a/src/main/java/com/gamingmesh/jobs/container/ActionType.java +++ b/src/main/java/com/gamingmesh/jobs/container/ActionType.java @@ -41,8 +41,7 @@ public enum ActionType { EAT("Eat"), CUSTOMKILL("custom-kill"), COLLECT("Collect"), - BAKE("Bake"), - BOSS("Boss"); + BAKE("Bake"); private String name; diff --git a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java index 53c5c13a..e83f5aed 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java @@ -3,7 +3,6 @@ package com.gamingmesh.jobs.hooks; import org.bukkit.plugin.PluginManager; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.hooks.Boss.BossManager; import com.gamingmesh.jobs.hooks.McMMO.McMMO1_X_listener; import com.gamingmesh.jobs.hooks.McMMO.McMMO2_X_listener; import com.gamingmesh.jobs.hooks.McMMO.McMMOManager; @@ -20,7 +19,6 @@ public class HookManager { private static MythicMobInterface MythicManager; private static MyPetManager myPetManager; private static WorldGuardManager worldGuardManager; - private static BossManager bossManager; private static StackMobHandler stackMobHandler; private static WildStackerHandler wildStackerHandler; @@ -35,7 +33,6 @@ public class HookManager { setMyPetManager(); setWorldGuard(); setMythicManager(); - setBossManager(); setStackMobHandler(); setWildStackerHandler(); @@ -82,13 +79,6 @@ public class HookManager { return McMMOManager; } - public static BossManager getBossManager() { - if (bossManager == null) - setBossManager(); - - return bossManager; - } - public static MythicMobInterface getMythicManager() { return MythicManager; } @@ -144,13 +134,6 @@ public class HookManager { } } - private static void setBossManager() { - if (isPluginEnabled("Boss")) { - bossManager = new BossManager(); - Jobs.consoleMsg("&e[Jobs] Boss detected."); - } - } - private static void setStackMobHandler() { if (isPluginEnabled("StackMob")) { stackMobHandler = new StackMobHandler(); diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index d2519371..40b4213c 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -222,8 +222,8 @@ public class JobsPaymentListener implements Listener { ItemStack itemInHand = Jobs.getNms().getItemInMainHand(player); - if ((cow.getType() == EntityType.COW && itemInHand.getType() != Material.BUCKET) - || (cow.getType() == EntityType.MUSHROOM_COW && itemInHand.getType() != Material.BOWL)) { + if (itemInHand.getType() != Material.BUCKET + && (cow.getType() == EntityType.MUSHROOM_COW && itemInHand.getType() != Material.BOWL)) { return; } @@ -878,9 +878,10 @@ public class JobsPaymentListener implements Listener { return; if (Version.isCurrentEqualOrHigher(Version.v1_14_R1) && inv instanceof StonecutterInventory) { - if (event.getAction() != InventoryAction.DROP_ONE_SLOT) { - Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT)); - } + if (event.getAction() != InventoryAction.DROP_ONE_SLOT) { + Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT)); + } + return; }