mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-07 08:58:20 +01:00
Get entities from all instances when none is specified in an entity query
This commit is contained in:
parent
20c947650f
commit
1b98a65869
@ -363,7 +363,17 @@ public class EntityFinder {
|
||||
return new ArrayList<>(instance != null ?
|
||||
instance.getPlayers() : MinecraftServer.getConnectionManager().getOnlinePlayers());
|
||||
} else if (targetSelector == TargetSelector.ALL_ENTITIES) {
|
||||
return new ArrayList<>(instance.getEntities());
|
||||
if (instance != null) {
|
||||
return new ArrayList<>(instance.getEntities());
|
||||
} else {
|
||||
// Get entities from every instance
|
||||
var instances = MinecraftServer.getInstanceManager().getInstances();
|
||||
List<Entity> entities = new LinkedList<>();
|
||||
for (Instance inst : instances) {
|
||||
entities.addAll(inst.getEntities());
|
||||
}
|
||||
return entities;
|
||||
}
|
||||
} else if (targetSelector == TargetSelector.SELF) {
|
||||
return Collections.singletonList(self);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user