diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java b/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java index 734f7e41..c7005028 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java @@ -400,6 +400,7 @@ public class editjobs implements Cmd { case KILL: case MILK: case MMKILL: + case BOSS: case BREED: case SHEAR: case EXPLORE: @@ -559,7 +560,7 @@ public class editjobs implements Cmd { } type = myKey; } else if (actionT == ActionType.CUSTOMKILL || actionT == ActionType.SHEAR || actionT == ActionType.MMKILL - || actionT == ActionType.COLLECT || actionT == ActionType.BAKE) + || actionT == ActionType.COLLECT || actionT == ActionType.BAKE || actionT == ActionType.BOSS) type = myKey; else if (actionT == ActionType.EXPLORE) { type = myKey; 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 78919e23..24cdfe08 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java @@ -352,6 +352,7 @@ public class editquests implements Cmd { case KILL: case MILK: case MMKILL: + case BOSS: case BREED: case SHEAR: case EXPLORE: @@ -511,7 +512,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.COLLECT || actionT == ActionType.BAKE || actionT == ActionType.BOSS) 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 e68641af..cdbfefeb 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -344,6 +344,7 @@ public class ConfigManager { case KILL: case MILK: case MMKILL: + case BOSS: case BREED: case SHEAR: case EXPLORE: @@ -510,7 +511,7 @@ public class ConfigManager { CMIEnchantment enchant = CMIEnchantment.get(myKey); type = enchant == null ? myKey : enchant.toString(); } else if (actionType == ActionType.CUSTOMKILL || actionType == ActionType.SHEAR || actionType == ActionType.MMKILL - || actionType == ActionType.COLLECT || actionType == ActionType.BAKE) + || actionType == ActionType.COLLECT || actionType == ActionType.BAKE || actionType == ActionType.BOSS) type = myKey; else if (actionType == ActionType.EXPLORE) { type = myKey; @@ -1117,6 +1118,7 @@ public class ConfigManager { case KILL: case MILK: case MMKILL: + case BOSS: case BREED: case SHEAR: case EXPLORE: @@ -1297,7 +1299,7 @@ public class ConfigManager { type = enchant == null ? myKey : enchant.toString(); } else if (actionType == ActionType.CUSTOMKILL || actionType == ActionType.COLLECT || actionType == ActionType.MMKILL - || actionType == ActionType.SHEAR || actionType == ActionType.BAKE) + || actionType == ActionType.SHEAR || actionType == ActionType.BAKE || actionType == ActionType.BOSS) type = myKey; else if (actionType == ActionType.EXPLORE) { type = myKey; diff --git a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java index adc6dbe2..abe2d20a 100644 --- a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java @@ -55,7 +55,7 @@ public class NameTranslatorManager { CMIMaterial mat = CMIMaterial.get(materialName.replace(" ", "")); NameList nameLs = ListOfNames.get(mat); if (nameLs == null) { - return mat.getName(); + return mat.getName(); } if (meta != null && !meta.isEmpty()) { @@ -122,6 +122,8 @@ 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 a58c1408..b0363cb8 100644 --- a/src/main/java/com/gamingmesh/jobs/container/ActionType.java +++ b/src/main/java/com/gamingmesh/jobs/container/ActionType.java @@ -41,7 +41,8 @@ public enum ActionType { EAT("Eat"), CUSTOMKILL("custom-kill"), COLLECT("Collect"), - BAKE("Bake"); + BAKE("Bake"), + BOSS("Boss"); private String name; diff --git a/src/main/java/com/gamingmesh/jobs/hooks/Boss/BossManager.java b/src/main/java/com/gamingmesh/jobs/hooks/Boss/BossManager.java new file mode 100644 index 00000000..15abe86c --- /dev/null +++ b/src/main/java/com/gamingmesh/jobs/hooks/Boss/BossManager.java @@ -0,0 +1,22 @@ +package com.gamingmesh.jobs.hooks.Boss; + +import org.bukkit.entity.Entity; +import org.mineacademy.boss.api.Boss; +import org.mineacademy.boss.api.BossAPI; + +public class BossManager { + + public String getName(Entity entity) { + return BossAPI.isBoss(entity) ? BossAPI.getBoss(entity).getName() : ""; + } + + public String getName(String name) { + for (Boss boss : BossAPI.getBosses()) { + if (boss.getName().equalsIgnoreCase(name)) { + return boss.getName(); + } + } + + return ""; + } +} diff --git a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java index 39a103c3..c9bda19e 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java @@ -3,6 +3,7 @@ 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; @@ -18,6 +19,7 @@ public class HookManager { private static MythicMobInterface MythicManager = null; private static MyPetManager myPetManager = null; private static WorldGuardManager worldGuardManager = null; + private static BossManager bossManager = null; private static PluginManager pm = null; @@ -30,12 +32,13 @@ public class HookManager { setMyPetManager(); setWorldGuard(); setMythicManager(); + setBossManager(); if (checkMythicMobs()) MythicManager.registerListener(); } - public static MyPetManager getMyPetManager() { + public static MyPetManager getMyPetManager() { if (myPetManager == null) { setMyPetManager(); } @@ -58,7 +61,14 @@ public class HookManager { return McMMOManager; } - public static MythicMobInterface getMythicManager() { + public static BossManager getBossManager() { + if (bossManager == null) + setBossManager(); + + return bossManager; + } + + public static MythicMobInterface getMythicManager() { return MythicManager; } @@ -117,4 +127,11 @@ public class HookManager { Jobs.consoleMsg("&e[Jobs] MyPet detected."); } } + + private static void setBossManager() { + if (pm.getPlugin("Boss") != null && pm.isPluginEnabled("Boss")) { + bossManager = new BossManager(); + Jobs.consoleMsg("&e[Jobs] Boss detected."); + } + } }