[SOLVED] Find entity by name

Hi guys,

I currently working with command block and spawning custom mobs with this,.
My question is simple, is it possible via sponge to find all custom mobs spawned by their names ? (something similar as bukkit like entity.getName())

thanks by advance
SheppeR

public static Collection<Entity> entitiesByName(EntityUniverse world, final String name) {
    return world.getEntities(new Predicate() {
        @Override
        public boolean apply(Entity entity) {
            return Texts.toPlain(entity.getName(DisplayNameData.class).get().getDisplayName()).equals(name);
        }
    });
}
1 Like

thanks for your help :wink: