mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-09-16 17:44:17 +02:00
Fix the detection of dead entities not being removed
This commit is contained in:
parent
d78414c30e
commit
7e68239263
@ -21,9 +21,11 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
|
||||||
import com.gmail.filoghost.holographicdisplays.HolographicDisplays;
|
import com.gmail.filoghost.holographicdisplays.HolographicDisplays;
|
||||||
import com.gmail.filoghost.holographicdisplays.api.Hologram;
|
import com.gmail.filoghost.holographicdisplays.api.Hologram;
|
||||||
@ -59,20 +61,22 @@ public class DebugCommand extends HologramSubCommand {
|
|||||||
for (World world : Bukkit.getWorlds()) {
|
for (World world : Bukkit.getWorlds()) {
|
||||||
Map<Hologram, HologramDebugInfo> hologramsDebugInfo = new HashMap<>();
|
Map<Hologram, HologramDebugInfo> hologramsDebugInfo = new HashMap<>();
|
||||||
|
|
||||||
for (Entity entity : world.getEntities()) {
|
for (Chunk chunk : world.getLoadedChunks()) {
|
||||||
NMSEntityBase nmsEntity = HolographicDisplays.getNMSManager().getNMSEntityBase(entity);
|
for (Entity entity : chunk.getEntities()) {
|
||||||
|
NMSEntityBase nmsEntity = HolographicDisplays.getNMSManager().getNMSEntityBase(entity);
|
||||||
|
|
||||||
if (nmsEntity == null) {
|
if (nmsEntity == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Hologram ownerHologram = nmsEntity.getHologramLine().getParent();
|
Hologram ownerHologram = nmsEntity.getHologramLine().getParent();
|
||||||
HologramDebugInfo hologramDebugInfo = hologramsDebugInfo.computeIfAbsent(ownerHologram, mapKey -> new HologramDebugInfo());
|
HologramDebugInfo hologramDebugInfo = hologramsDebugInfo.computeIfAbsent(ownerHologram, mapKey -> new HologramDebugInfo());
|
||||||
|
|
||||||
if (nmsEntity.isDeadNMS()) {
|
if (nmsEntity.isDeadNMS()) {
|
||||||
hologramDebugInfo.deadEntities++;
|
hologramDebugInfo.deadEntities++;
|
||||||
} else {
|
} else {
|
||||||
hologramDebugInfo.aliveEntities++;
|
hologramDebugInfo.aliveEntities++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user