org.spongepowered.api.entity.Entity Java Examples

The following examples show how to use org.spongepowered.api.entity.Entity. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockListener.java    From RedProtect with GNU General Public License v3.0 6 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onFrameAndBoatBrake(DamageEntityEvent e) {
    RedProtect.get().logger.debug(LogLevel.BLOCKS, "Is BlockListener - DamageEntityEvent event");

    Entity ent = e.getTargetEntity();
    Location<World> l = e.getTargetEntity().getLocation();

    Region r = RedProtect.get().rm.getTopRegion(l, this.getClass().getName());
    if (r == null) return;

    if (ent instanceof Hanging && e.getCause().first(Monster.class).isPresent()) {
        if (!r.canFire()) {
            e.setCancelled(true);
            return;
        }
    }

    if ((ent instanceof Boat || ent instanceof Minecart) && e.getCause().first(Player.class).isPresent()) {
        Player p = e.getCause().first(Player.class).get();
        if (!r.canMinecart(p)) {
            RedProtect.get().lang.sendMessage(p, "blocklistener.region.cantbreak");
            e.setCancelled(true);
        }
    }
}
 
Example #2
Source File: CachedEntity.java    From Web-API with MIT License 6 votes vote down vote up
public CachedEntity(Entity entity) {
    super(entity);

    this.type = new CachedCatalogType(entity.getType());
    this.uuid = UUID.fromString(entity.getUniqueId().toString());
    this.location = new CachedLocation(entity.getLocation());

    this.rotation = entity.getRotation().clone();
    this.velocity = entity.getVelocity().clone();
    this.scale = entity.getScale().clone();

    if (entity instanceof Carrier) {
        try {
            this.inventory = new CachedInventory(((Carrier) entity).getInventory());
        } catch (AbstractMethodError ignored) {}
    }
}
 
Example #3
Source File: EntityUtils.java    From GriefDefender with MIT License 6 votes vote down vote up
public static String getFriendlyName(net.minecraft.entity.Entity mcEntity) {
    String entityName = mcEntity.getName();
    final String[] parts = entityName.split(":");
    if (parts.length > 1) {
        entityName = parts[1];
    }
    if (entityName.contains(".")) {
        if ((entityName.indexOf(".") + 1) < entityName.length()) {
            entityName = entityName.substring(entityName.indexOf(".") + 1, entityName.length());
        }
    }

    entityName = entityName.replace("entity", "");
    entityName = entityName.replaceAll("[^A-Za-z0-9]", "");
    return entityName;
}
 
Example #4
Source File: HuskyUI.java    From HuskyUI-Plugin with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Handle item drops
 * @param event dispense event
 */
@Listener
public void onItemDrop(DropItemEvent.Dispense event){
    for(Entity e :event.getEntities()){
        if(e instanceof Item){
            ItemStack affectedStack = ((Item) e).getItemData().item().get().createStack();
            Optional<Integer> potentialID = registry.getElementIDFromItemStack(affectedStack);
            if(potentialID.isPresent()){
                if(registry.elementExists(potentialID.get())){
                    event.setCancelled(true); //NOTHING should drop a registered item. >:(
                    //TODO: handle https://github.com/SpongePowered/SpongeCommon/issues/1678 properly w/ workaround
                }
            }
        }
    }
}
 
Example #5
Source File: Selector.java    From UltimateCore with MIT License 6 votes vote down vote up
/**
 * Returns a list of all entities which satisfy the string.
 * This can be empty if no entities are found.
 *
 * @param s The string to search for
 * @return All entities which statisfy the string
 */
public static List<Entity> multipleEntities(CommandSource source, String s) {
    List<Entity> matches = new ArrayList<>();

    Optional<Player> match = Sponge.getServer().getPlayer(s);
    match.ifPresent(matches::add);

    try {
        UUID uuid = UUID.fromString(s);
        if (source instanceof Locatable) {
            Locatable loc = (Locatable) source;
            Optional<Entity> en = loc.getWorld().getEntity(uuid);
            en.ifPresent(matches::add);
        }
    } catch (IllegalArgumentException ignored) {
    }

    if (s.startsWith("@")) {
        org.spongepowered.api.text.selector.Selector selector = org.spongepowered.api.text.selector.Selector.parse(s);
        selector.resolve(source).forEach(matches::add);
    }

    return matches;
}
 
Example #6
Source File: ModSupport.java    From EagleFactions with MIT License 6 votes vote down vote up
/**
 * Gets the attacking entity from the EntityDamageSource. EntityDamageSource must come from TechGuns.
 * @param entityDamageSource the source
 * @return attacking/source entity.
 */
public static Entity getAttackerFromTechGuns(final EntityDamageSource entityDamageSource)
{
    Object attacker = null;
    try
    {
        attacker = entityDamageSource.getClass().getField("attacker").get(entityDamageSource);
    }
    catch (IllegalAccessException | NoSuchFieldException e)
    {
        e.printStackTrace();
    }
    if (attacker instanceof Entity)
        return (Entity)attacker;
    else return null;
}
 
Example #7
Source File: EntityListener.java    From RedProtect with GNU General Public License v3.0 6 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onInteractEvent(InteractEntityEvent.Secondary e, @First Player p) {
    Entity et = e.getTargetEntity();
    Location<World> l = et.getLocation();
    Region r = RedProtect.get().rm.getTopRegion(l, this.getClass().getName());

    RedProtect.get().logger.debug(LogLevel.ENTITY, "EntityListener - InteractEntityEvent.Secondary entity " + et.getType().getName());

    if (r != null && !r.canInteractPassives(p) && (et instanceof Animal || et instanceof Villager || et instanceof Golem || et instanceof Ambient)) {
        if (RedProtect.get().getVersionHelper().checkHorseOwner(et, p)) {
            return;
        }
        e.setCancelled(true);
        RedProtect.get().lang.sendMessage(p, "entitylistener.region.cantinteract");
    }
}
 
Example #8
Source File: EntityUtils.java    From GriefPrevention with MIT License 6 votes vote down vote up
public static String getFriendlyName(net.minecraft.entity.Entity mcEntity) {
    String entityName = mcEntity.getName();
    final String[] parts = entityName.split(":");
    if (parts.length > 1) {
        entityName = parts[1];
    }
    if (entityName.contains(".")) {
        if ((entityName.indexOf(".") + 1) < entityName.length()) {
            entityName = entityName.substring(entityName.indexOf(".") + 1, entityName.length());
        }
    }

    entityName = entityName.replace("entity", "");
    entityName = entityName.replaceAll("[^A-Za-z0-9]", "");
    return entityName;
}
 
Example #9
Source File: PlayerInteractListener.java    From EagleFactions with MIT License 6 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onEntityInteract(final InteractEntityEvent event, @Root final Player player)
{
    final Entity targetEntity = event.getTargetEntity();
    final Optional<Vector3d> optionalInteractionPoint = event.getInteractionPoint();

    if((targetEntity instanceof Living) && !(targetEntity instanceof ArmorStand))
        return;

    final Vector3d blockPosition = optionalInteractionPoint.orElseGet(() -> targetEntity.getLocation().getPosition());
    final Location<World> location = new Location<>(targetEntity.getWorld(), blockPosition);
    boolean canInteractWithEntity = super.getPlugin().getProtectionManager().canInteractWithBlock(location, player, true).hasAccess();
    if(!canInteractWithEntity)
    {
        event.setCancelled(true);
        return;
    }
}
 
Example #10
Source File: GriefPreventionPlugin.java    From GriefPrevention with MIT License 6 votes vote down vote up
public static void sendMessage(CommandSource source, Text message, long delayInTicks) {
    if (source instanceof Player && SpongeImplHooks.isFakePlayer((net.minecraft.entity.Entity) source)) {
        return;
    }

    if (source instanceof Player) {
        SendPlayerMessageTask task = new SendPlayerMessageTask((Player) source, message);
        if (delayInTicks > 0) {
            Sponge.getGame().getScheduler().createTaskBuilder().delayTicks(delayInTicks).execute(task).submit(GriefPreventionPlugin.instance);
        } else {
            task.run();
        }
    } else {
        source.sendMessage(message);
    }
}
 
Example #11
Source File: PvpListener.java    From Nations with MIT License 6 votes vote down vote up
@Listener(order=Order.FIRST, beforeModifications = true)
public void onEntityDamagedByPlayer(DamageEntityEvent event, @All(ignoreEmpty=false) EntityDamageSource[] sources)
{
	if (!ConfigHandler.getNode("worlds").getNode(event.getTargetEntity().getWorld().getName()).getNode("enabled").getBoolean())
	{
		return;
	}
	Entity attacker = null;
	for (int i = 0; i < sources.length; i++)
	{
		if (sources[i].getSource().getType() == EntityTypes.PLAYER
				|| (sources[i] instanceof IndirectEntityDamageSource && ((IndirectEntityDamageSource) sources[i]).getIndirectSource().getType() == EntityTypes.PLAYER))
		{
			attacker = sources[i].getSource();
		}
	}
	if (attacker != null && event.getTargetEntity().getType() == EntityTypes.PLAYER)
	{
		if (!DataHandler.getFlag("pvp", attacker.getLocation()) || !DataHandler.getFlag("pvp", event.getTargetEntity().getLocation()))
		{
			event.setCancelled(true);
			return;
		}
	}
}
 
Example #12
Source File: GPClaim.java    From GriefPrevention with MIT License 5 votes vote down vote up
@Override
public List<Entity> getEntities() {
    Collection<Entity> worldEntityList = Sponge.getServer().getWorld(this.world.getUniqueId()).get().getEntities();
    List<Entity> entityList = new ArrayList<>();
    for (Entity entity : worldEntityList) {
        if (!((net.minecraft.entity.Entity) entity).isDead && this.contains(entity.getLocation())) {
            entityList.add(entity);
        }
    }

    return entityList;
}
 
Example #13
Source File: EntityEventHandler.java    From GriefPrevention with MIT License 5 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onProjectileImpactEntity(CollideEntityEvent.Impact event) {
    if (!GPFlags.PROJECTILE_IMPACT_ENTITY) {
        return;
    }
    if (GriefPreventionPlugin.isSourceIdBlacklisted(ClaimFlag.PROJECTILE_IMPACT_ENTITY.toString(), event.getSource(), event.getImpactPoint().getExtent().getProperties())) {
        return;
    }

    final User user = CauseContextHelper.getEventUser(event);
    if (user == null || !GriefPreventionPlugin.instance.claimsEnabledForWorld(event.getImpactPoint().getExtent().getProperties())) {
        return;
    }

    GPTimings.PROJECTILE_IMPACT_ENTITY_EVENT.startTimingIfSync();
    Object source = event.getCause().root();
    Location<World> impactPoint = event.getImpactPoint();
    GPClaim targetClaim = null;
    for (Entity entity : event.getEntities()) {
        if (GriefPreventionPlugin.isTargetIdBlacklisted(ClaimFlag.PROJECTILE_IMPACT_ENTITY.toString(), entity, event.getImpactPoint().getExtent().getProperties())) {
            return;
        }
        targetClaim = this.dataStore.getClaimAt(impactPoint, targetClaim);
        final Tristate result = GPPermissionHandler.getClaimPermission(event, impactPoint, targetClaim, GPPermissions.PROJECTILE_IMPACT_ENTITY, source, entity, user, TrustType.ACCESSOR, true);
        if (result == Tristate.FALSE) {
            if (GPPermissionHandler.getClaimPermission(event, impactPoint, targetClaim, GPPermissions.PROJECTILE_IMPACT_ENTITY, source, entity, user) == Tristate.TRUE) {
                GPTimings.PROJECTILE_IMPACT_ENTITY_EVENT.stopTimingIfSync();
                return;
            }

            event.setCancelled(true);
        }
    }
    GPTimings.PROJECTILE_IMPACT_ENTITY_EVENT.stopTimingIfSync();
}
 
Example #14
Source File: EntityEventHandler.java    From GriefPrevention with MIT License 5 votes vote down vote up
@Listener(order = Order.FIRST, beforeModifications = true)
public void onEntityExplosionDetonate(ExplosionEvent.Detonate event) {
    if (!GPFlags.EXPLOSION || !GriefPreventionPlugin.instance.claimsEnabledForWorld(event.getTargetWorld().getProperties())) {
        return;
    }
    if (GriefPreventionPlugin.isSourceIdBlacklisted(ClaimFlag.EXPLOSION.toString(), event.getSource(), event.getTargetWorld().getProperties())) {
        return;
    }

    GPTimings.ENTITY_EXPLOSION_DETONATE_EVENT.startTimingIfSync();
    final User user = CauseContextHelper.getEventUser(event);
    Iterator<Entity> iterator = event.getEntities().iterator();
    GPClaim targetClaim = null;
    Object source = event.getSource();
    if (source instanceof Explosion) {
        final Explosion explosion = (Explosion) source;
        if (explosion.getSourceExplosive().isPresent()) {
            source = explosion.getSourceExplosive().get();
        } else {
            Entity exploder = event.getCause().first(Entity.class).orElse(null);
            if (exploder != null) {
                source = exploder;
            }
        }
    }

    while (iterator.hasNext()) {
        Entity entity = iterator.next();
        targetClaim =  GriefPreventionPlugin.instance.dataStore.getClaimAt(entity.getLocation(), targetClaim);
        if (GPPermissionHandler.getClaimPermission(event, entity.getLocation(), targetClaim, GPPermissions.ENTITY_DAMAGE, source, entity, user) == Tristate.FALSE) {
            iterator.remove();
        }
    }
    GPTimings.ENTITY_EXPLOSION_DETONATE_EVENT.stopTimingIfSync();
}
 
Example #15
Source File: CachedEntity.java    From Web-API with MIT License 5 votes vote down vote up
@Override
public Optional<Entity> getLive() {
    for (World w : Sponge.getServer().getWorlds()) {
        Optional<Entity> e = w.getEntity(uuid);
        if (e.isPresent())
            return Optional.of(e.get());
    }
    return Optional.empty();
}
 
Example #16
Source File: CacheService.java    From Web-API with MIT License 5 votes vote down vote up
/**
 * Gets a specific entity by UUID.
 * @param uuid The UUID of the entity.
 * @return An optional containing the cached entity if found, or empty otherwise.
 */
public Optional<CachedEntity> getEntity(UUID uuid) {
    return WebAPI.runOnMain(() -> {
        Collection<World> worlds = Sponge.getServer().getWorlds();
        for (World world : worlds) {
            Optional<Entity> optEnt = world.getEntity(uuid);
            if (optEnt.isPresent()) {
                return Optional.of(new CachedEntity(optEnt.get()));
            }
        }
        return Optional.empty();
    });
}
 
Example #17
Source File: WorldCalculator.java    From LuckPerms with MIT License 5 votes vote down vote up
@Listener(order = Order.LAST)
public void onWorldChange(MoveEntityEvent.Teleport e) {
    Entity targetEntity = e.getTargetEntity();
    if (!(targetEntity instanceof Player)) {
        return;
    }

    if (e.getFromTransform().getExtent().equals(e.getToTransform().getExtent())) {
        return;
    }

    Player player = (Player) targetEntity;
    this.plugin.getContextManager().signalContextUpdate(player);
}
 
Example #18
Source File: WorldUtil.java    From Prism with MIT License 5 votes vote down vote up
/**
 * Removes all item entities in a radius around a given a location.
 *
 * @param location Location center
 * @param radius Integer radius around location
 * @return integer Count of removals
 */
public static int removeItemEntitiesAroundLocation(Location<World> location, int radius) {
    int xMin = location.getBlockX() - radius;
    int xMax = location.getBlockX() + radius;

    int zMin = location.getBlockZ() - radius;
    int zMax = location.getBlockZ() + radius;

    int yMin = location.getBlockY() - radius;
    int yMax = location.getBlockY() + radius;

    Collection<Entity> entities = location.getExtent().getEntities(e -> {
        Location<World> loc = e.getLocation();

        return (e.getType().equals(EntityTypes.ITEM)
                && (loc.getX() > xMin && loc.getX() <= xMax)
                && (loc.getY() > yMin && loc.getY() <= yMax)
                && (loc.getZ() > zMin && loc.getZ() <= zMax)
        );
    });

    if (!entities.isEmpty()) {
        entities.forEach(Entity::remove);
    }

    return entities.size();
}
 
Example #19
Source File: EntityUtils.java    From GriefPrevention with MIT License 5 votes vote down vote up
public static UUID getOwnerUniqueId(Entity entity) {
    if (entity instanceof EntityPlayer) {
        return null;
    }

    UUID ownerUniqueId = entity.getCreator().orElse(null);
    if (ownerUniqueId == null && entity instanceof IEntityOwnable) {
        IEntityOwnable ownable = (IEntityOwnable) entity;
        ownerUniqueId = ownable.getOwnerId();
    }

    return ownerUniqueId;
}
 
Example #20
Source File: EventUtil.java    From Prism with MIT License 5 votes vote down vote up
/**
 * Reject certain events which can only be identified
 * by the change + cause signature.
 *
 * @param a BlockType original
 * @param b BlockType replacement
 * @param cause Cause chain from event
 * @return boolean If should be rejected
 */
public static boolean rejectPlaceEventIdentity(BlockType a, BlockType b, Cause cause) {
    // Things that eat grass...
    if (a.equals(BlockTypes.GRASS) && b.equals(BlockTypes.DIRT)) {
        return cause.first(Living.class).isPresent();
    }

    // Grass-like "Grow" events
    if (a.equals(BlockTypes.DIRT) && b.equals(BlockTypes.GRASS)) {
        return cause.first(BlockSnapshot.class).isPresent();
    }

    // If no entity at fault, we don't care about placement that didn't affect anything
    if (!cause.first(Entity.class).isPresent()) {
        return (a.equals(BlockTypes.AIR));
    }

    // Natural flow/fire.
    // Note: This only allows tracking on the source block set by a player using
    // buckets, or items to set fires. Blocks broken by water, lava or fire are still logged as usual.
    // Full flow/fire tracking would be hard on the database and is generally unnecessary.
    if (!cause.first(Player.class).isPresent()) {
        return (a.equals(BlockTypes.AIR) && (b.equals(BlockTypes.FLOWING_LAVA) || b.equals(BlockTypes.FLOWING_WATER)) ||
        b.equals(BlockTypes.FIRE));
    }

    return false;
}
 
Example #21
Source File: UCTeleportation.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public List<Entity> getEntities() {
    List<Entity> rtrn = new ArrayList<>();
    for (UUID uuid : entities) {
        for (World w : Sponge.getServer().getWorlds()) {
            w.getEntity(uuid).ifPresent(rtrn::add);
        }
    }
    return rtrn;
}
 
Example #22
Source File: GriefPreventionPlugin.java    From GriefPrevention with MIT License 5 votes vote down vote up
public static void sendMessage(CommandSource source, Text message) {
    if (source instanceof Player && SpongeImplHooks.isFakePlayer((net.minecraft.entity.Entity) source)) {
        return;
    }
    if (message.toText() == Text.of() || message == null) {
        return;
    }

    if (source == null) {
        GriefPreventionPlugin.addLogEntry(Text.of(message).toPlain());
    } else {
        source.sendMessage(message);
    }
}
 
Example #23
Source File: FireballExecutor.java    From EssentialCmds with MIT License 5 votes vote down vote up
public void spawnEntity(Location<World> location, Vector3d velocity, CommandSource src)
{
	Extent extent = location.getExtent();
	Entity fireball = extent.createEntity(EntityTypes.FIREBALL, location.getPosition());
	fireball.offer(Keys.VELOCITY, velocity);
	extent.spawnEntity(fireball, Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.CUSTOM).build())));
}
 
Example #24
Source File: GPClaim.java    From GriefPrevention with MIT License 5 votes vote down vote up
@Override
public List<Player> getPlayers() {
    Collection<Player> worldPlayerList = Sponge.getServer().getWorld(this.world.getUniqueId()).get().getPlayers();
    List<Player> playerList = new ArrayList<>();
    for (Player player : worldPlayerList) {
        if (!((net.minecraft.entity.Entity) player).isDead && this.contains(player.getLocation())) {
            playerList.add(player);
        }
    }

    return playerList;
}
 
Example #25
Source File: PrismRecord.java    From Prism with MIT License 5 votes vote down vote up
/**
 * Save the current record.
 */
public void save() {
    DataUtil.writeToDataView(getDataContainer(), DataQueries.Created, new Date());
    DataUtil.writeToDataView(getDataContainer(), DataQueries.EventName, getEvent());

    DataQuery causeKey = DataQueries.Cause;
    String causeValue = "environment";
    if (getSource() instanceof Player) {
        causeKey = DataQueries.Player;
        causeValue = ((Player) getSource()).getUniqueId().toString();
    } else if (getSource() instanceof Entity) {
        causeValue = ((Entity) getSource()).getType().getName();
    }

    DataUtil.writeToDataView(getDataContainer(), causeKey, causeValue);

    // Source filtered?
    if (!Prism.getInstance().getFilterList().allowsSource(getSource())) {
        return;
    }

    // Original block filtered?
    Optional<BlockType> originalBlockType = getDataContainer().getObject(DataQueries.OriginalBlock.then(DataQueries.BlockState).then(DataQueries.BlockType), BlockType.class);
    if (originalBlockType.map(Prism.getInstance().getFilterList()::allows).orElse(false)) {
        return;
    }

    // Replacement block filtered?
    Optional<BlockType> replacementBlockType = getDataContainer().getObject(DataQueries.ReplacementBlock.then(DataQueries.BlockState).then(DataQueries.BlockType), BlockType.class);
    if (replacementBlockType.map(Prism.getInstance().getFilterList()::allows).orElse(false)) {
        return;
    }

    // Queue the finished record for saving
    RecordingQueue.add(this);
}
 
Example #26
Source File: MobSpawnExecutor.java    From EssentialCmds with MIT License 5 votes vote down vote up
public void spawnEntity(Location<World> location, Player player, EntityType type, int amount)
{
	for (int i = 1; i <= amount; i++)
	{
		Entity entity = location.getExtent().createEntity(type, location.getPosition());
		location.getExtent().spawnEntity(entity, Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.CUSTOM).build())));
	}
}
 
Example #27
Source File: WebHookService.java    From Web-API with MIT License 5 votes vote down vote up
@Listener(order = Order.PRE)
public void onEntityDespawn(DestructEntityEvent event) {
    Entity ent = event.getTargetEntity();
    if (ent instanceof Player) {
        notifyHooks(WebHookService.WebHookType.PLAYER_DEATH, event);
    } else {
        notifyHooks(WebHookService.WebHookType.ENTITY_DESPAWN, event);
    }
}
 
Example #28
Source File: BloodListener.java    From UltimateCore with MIT License 5 votes vote down vote up
@Listener
public void onDamage(DamageEntityEvent event) {
    Entity en = event.getTargetEntity();
    EntityType type = en.getType();
    BloodEffect effect = BloodEffects.get(type).orElse(null);
    if (effect == null || !effect.isEnabled()) {
        return;
    }
    Location<World> loc = en.getLocation().add(effect.getCenterOffset());
    loc.getExtent().spawnParticles(effect.getEffect(), loc.getPosition());
}
 
Example #29
Source File: VersionHelper56.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public boolean checkHorseOwner(Entity ent, Player p) {
    if (ent instanceof Horse && ((Horse) ent).getHorseData().get(Keys.TAMED_OWNER).isPresent()) {
        Horse tam = (Horse) ent;
        Player owner = RedProtect.get().getServer().getPlayer(tam.getHorseData().get(Keys.TAMED_OWNER).get().get()).get();
        return owner.getName().equals(p.getName());
    }
    return false;
}
 
Example #30
Source File: EntityServlet.java    From Web-API with MIT License 5 votes vote down vote up
@GET
@ExplicitDetails
@Permission("list")
@ApiOperation(value = "List entities", notes = "Get a list of all entities on the server (in all worlds).")
public Collection<CachedEntity> listEntities(
        @QueryParam("world") @ApiParam("The world to filter the entities by") CachedWorld world,
        @QueryParam("type") @ApiParam("The type id of the entities to filter by") String typeId,
        @QueryParam("min") @ApiParam("The minimum coordinates at which the entity must be, min=x|y|z") Vector3i min,
        @QueryParam("max") @ApiParam("The maximum coordinates at which the entity must be, max=x|y|z") Vector3i max,
        @QueryParam("limit") @ApiParam("The maximum amount of entities returned") int limit) {
    Predicate<Entity> filter = e -> typeId == null || e.getType().getId().equalsIgnoreCase(typeId);

    return cacheService.getEntities(world, min, max, filter, limit);
}