1
0
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:
montlikadani 2020-03-01 14:19:40 +01:00
parent f649b004cd
commit 02178fc719
7 changed files with 54 additions and 8 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -41,7 +41,8 @@ public enum ActionType {
EAT("Eat"),
CUSTOMKILL("custom-kill"),
COLLECT("Collect"),
BAKE("Bake");
BAKE("Bake"),
BOSS("Boss");
private String name;

View File

@ -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 "";
}
}

View File

@ -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,6 +32,7 @@ public class HookManager {
setMyPetManager();
setWorldGuard();
setMythicManager();
setBossManager();
if (checkMythicMobs())
MythicManager.registerListener();
@ -58,6 +61,13 @@ public class HookManager {
return McMMOManager;
}
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.");
}
}
}