mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-21 16:09:24 +00:00
Properly killed bosses on /ebkillall and on plugin disable
This commit is contained in:
@@ -4,6 +4,7 @@ import com.willfp.eco.core.AbstractPacketAdapter;
|
||||
import com.willfp.eco.core.EcoPlugin;
|
||||
import com.willfp.eco.core.command.AbstractCommand;
|
||||
import com.willfp.eco.core.integrations.IntegrationLoader;
|
||||
import com.willfp.ecobosses.bosses.EcoBoss;
|
||||
import com.willfp.ecobosses.bosses.EcoBosses;
|
||||
import com.willfp.ecobosses.bosses.listeners.AttackListeners;
|
||||
import com.willfp.ecobosses.bosses.listeners.DeathListeners;
|
||||
@@ -15,11 +16,14 @@ import com.willfp.ecobosses.commands.CommandEbreload;
|
||||
import com.willfp.ecobosses.commands.CommandEbspawn;
|
||||
import com.willfp.ecobosses.commands.TabCompleterEbspawn;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class EcoBossesPlugin extends EcoPlugin {
|
||||
@@ -50,7 +54,13 @@ public class EcoBossesPlugin extends EcoPlugin {
|
||||
*/
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
for (EcoBoss boss : EcoBosses.values()) {
|
||||
for (UUID uuid : boss.getLivingBosses().keySet()) {
|
||||
LivingEntity entity = (LivingEntity) Bukkit.getEntity(uuid);
|
||||
assert entity != null;
|
||||
entity.damage(10000000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.willfp.ecobosses.bosses;
|
||||
import com.willfp.eco.core.EcoPlugin;
|
||||
import com.willfp.eco.core.PluginDependent;
|
||||
import com.willfp.eco.core.scheduling.RunnableTask;
|
||||
import com.willfp.eco.util.NumberUtils;
|
||||
import com.willfp.eco.util.StringUtils;
|
||||
import com.willfp.ecobosses.bosses.effects.Effect;
|
||||
import com.willfp.ecobosses.bosses.tick.BossTicker;
|
||||
@@ -69,6 +70,7 @@ public class LivingEcoBoss extends PluginDependent {
|
||||
this.tickers.add(
|
||||
new BossBarTicker(
|
||||
Bukkit.getServer().createBossBar(
|
||||
plugin.getNamespacedKeyFactory().create("boss_" + NumberUtils.randInt(0, 1000000)),
|
||||
entity.getCustomName(),
|
||||
boss.getBossbarProperties().getColor(),
|
||||
boss.getBossbarProperties().getStyle(),
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.willfp.ecobosses.bosses.EcoBoss;
|
||||
import com.willfp.ecobosses.bosses.EcoBosses;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
@@ -28,12 +28,9 @@ public class CommandEbkillall extends AbstractCommand {
|
||||
int amount = 0;
|
||||
for (EcoBoss boss : EcoBosses.values()) {
|
||||
for (UUID uuid : boss.getLivingBosses().keySet()) {
|
||||
Entity entity = Bukkit.getEntity(uuid);
|
||||
boss.removeLivingBoss(uuid);
|
||||
if (entity == null) {
|
||||
break;
|
||||
}
|
||||
entity.remove();
|
||||
LivingEntity entity = (LivingEntity) Bukkit.getEntity(uuid);
|
||||
assert entity != null;
|
||||
entity.damage(10000000);
|
||||
amount++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user