mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
Add Boss support
This commit is contained in:
parent
f649b004cd
commit
02178fc719
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ public enum ActionType {
|
||||
EAT("Eat"),
|
||||
CUSTOMKILL("custom-kill"),
|
||||
COLLECT("Collect"),
|
||||
BAKE("Bake");
|
||||
BAKE("Bake"),
|
||||
BOSS("Boss");
|
||||
|
||||
private String name;
|
||||
|
||||
|
@ -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 "";
|
||||
}
|
||||
}
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user