mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-23 00:49:36 +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(":");
|
String[] split = string.split(":");
|
||||||
this.summons.add(new SummonsOption(
|
this.summons.add(new SummonsOption(
|
||||||
Double.parseDouble(split[1]),
|
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)) {
|
while (!loc.getBlock().getType().equals(Material.AIR)) {
|
||||||
loc.add(0, 1, 0);
|
loc.add(0, 1, 0);
|
||||||
}
|
}
|
||||||
Entity summonedEntity = player.getWorld().spawnEntity(loc, summon.getType());
|
|
||||||
|
Entity summonedEntity = summon.getType().spawnBossEntity(loc);
|
||||||
if (summonedEntity instanceof Mob) {
|
if (summonedEntity instanceof Mob) {
|
||||||
((Mob) summonedEntity).setTarget(player);
|
((Mob) summonedEntity).setTarget(player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ 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.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
@UtilityClass
|
@UtilityClass
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -17,7 +16,6 @@ public class BossEntityUtils {
|
|||||||
* @param id The name.
|
* @param id The name.
|
||||||
* @return The boss type.
|
* @return The boss type.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
|
||||||
public static BossType getBossType(@NotNull final String id) {
|
public static BossType getBossType(@NotNull final String id) {
|
||||||
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();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.willfp.ecobosses.bosses.util.obj;
|
package com.willfp.ecobosses.bosses.util.obj;
|
||||||
|
|
||||||
|
import com.willfp.ecobosses.bosses.util.bosstype.BossType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SummonsOption {
|
public class SummonsOption {
|
||||||
@@ -15,7 +15,7 @@ public class SummonsOption {
|
|||||||
* The type of entity to summon.
|
* The type of entity to summon.
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private final EntityType type;
|
private final BossType type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new summons option.
|
* Create a new summons option.
|
||||||
@@ -24,7 +24,7 @@ public class SummonsOption {
|
|||||||
* @param type The entity type.
|
* @param type The entity type.
|
||||||
*/
|
*/
|
||||||
public SummonsOption(final double chance,
|
public SummonsOption(final double chance,
|
||||||
@NotNull final EntityType type) {
|
@NotNull final BossType type) {
|
||||||
this.chance = chance;
|
this.chance = chance;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user