mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-20 23:49:22 +00:00
Improved mythicmobs pr
This commit is contained in:
@@ -51,8 +51,7 @@ public class EcoBossesPlugin extends EcoPlugin {
|
|||||||
@Override
|
@Override
|
||||||
protected List<IntegrationLoader> loadIntegrationLoaders() {
|
protected List<IntegrationLoader> loadIntegrationLoaders() {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
new IntegrationLoader("LevelledMobs", () -> this.getEventManager().registerListener(new LevelledMobsListener())),
|
new IntegrationLoader("LevelledMobs", () -> this.getEventManager().registerListener(new LevelledMobsListener()))
|
||||||
new IntegrationLoader("MythicMobs", () -> BossEntityUtils.mythicMobs = true)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import lombok.Setter;
|
|||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Zombie;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -14,11 +15,6 @@ import java.util.Arrays;
|
|||||||
@UtilityClass
|
@UtilityClass
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class BossEntityUtils {
|
public class BossEntityUtils {
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public static boolean mythicMobs = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get boss type.
|
* Get boss type.
|
||||||
*
|
*
|
||||||
@@ -27,8 +23,7 @@ public class BossEntityUtils {
|
|||||||
*/
|
*/
|
||||||
public static BossType getBossType(@NotNull String id) {
|
public static BossType getBossType(@NotNull String id) {
|
||||||
|
|
||||||
if (id.startsWith("mythicmobs_")) {
|
if (id.startsWith("mythicmobs:")) {
|
||||||
if (mythicMobs) {
|
|
||||||
int level;
|
int level;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -37,22 +32,21 @@ public class BossEntityUtils {
|
|||||||
level = 1;
|
level = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
MythicMob mob = MythicMobs.inst().getMobManager().getMythicMob(id.replace("mythicmobs_", "").replace("_"+level, ""));
|
MythicMob mob = MythicMobs.inst().getMobManager().getMythicMob(id.replace("mythicmobs:", "")
|
||||||
|
.replace("_" + level, ""));
|
||||||
|
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
return new MythicMobsBossType(mob, level);
|
return new MythicMobsBossType(mob, level);
|
||||||
}
|
}
|
||||||
else id = "zombie";
|
|
||||||
} else id = "zombie";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class<? extends LivingEntity> type = (Class<? extends LivingEntity>) EntityType.valueOf(id.toUpperCase()).getEntityClass();
|
Class<? extends LivingEntity> type = (Class<? extends LivingEntity>) EntityType.valueOf(id.toUpperCase()).getEntityClass();
|
||||||
assert type != null;
|
assert type != null;
|
||||||
return new VanillaBossType(type);
|
return new VanillaBossType(type);
|
||||||
} catch (IllegalArgumentException ignored) {}
|
} catch (IllegalArgumentException ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return new VanillaBossType(Zombie.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user