mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-22 16:39:25 +00:00
Summons can themselves be bosses now
This commit is contained in:
@@ -351,7 +351,7 @@ public class EcoBoss extends PluginDependent {
|
||||
String[] split = string.split(":");
|
||||
this.summons.add(new SummonsOption(
|
||||
Double.parseDouble(split[1]),
|
||||
EntityType.valueOf(split[0].toUpperCase())
|
||||
BossEntityUtils.getBossType(split[0].toUpperCase())
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,8 @@ public class LivingEcoBoss extends PluginDependent {
|
||||
while (!loc.getBlock().getType().equals(Material.AIR)) {
|
||||
loc.add(0, 1, 0);
|
||||
}
|
||||
Entity summonedEntity = player.getWorld().spawnEntity(loc, summon.getType());
|
||||
|
||||
Entity summonedEntity = summon.getType().spawnBossEntity(loc);
|
||||
if (summonedEntity instanceof Mob) {
|
||||
((Mob) summonedEntity).setTarget(player);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@UtilityClass
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -17,7 +16,6 @@ public class BossEntityUtils {
|
||||
* @param id The name.
|
||||
* @return The boss type.
|
||||
*/
|
||||
@Nullable
|
||||
public static BossType getBossType(@NotNull final String id) {
|
||||
try {
|
||||
Class<? extends LivingEntity> type = (Class<? extends LivingEntity>) EntityType.valueOf(id.toUpperCase()).getEntityClass();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.willfp.ecobosses.bosses.util.obj;
|
||||
|
||||
import com.willfp.ecobosses.bosses.util.bosstype.BossType;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SummonsOption {
|
||||
@@ -15,7 +15,7 @@ public class SummonsOption {
|
||||
* The type of entity to summon.
|
||||
*/
|
||||
@Getter
|
||||
private final EntityType type;
|
||||
private final BossType type;
|
||||
|
||||
/**
|
||||
* Create a new summons option.
|
||||
@@ -24,7 +24,7 @@ public class SummonsOption {
|
||||
* @param type The entity type.
|
||||
*/
|
||||
public SummonsOption(final double chance,
|
||||
@NotNull final EntityType type) {
|
||||
@NotNull final BossType type) {
|
||||
this.chance = chance;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user