How to get entities? [Solved]

Hey there!

I’ve made an ability system and allowed any entity (whether AI or player controlled) to use abilities. Whenever I try to use
World#getEntity(UUID), it returns an empty optional if the entity is a player instance. I can’t imagine that this would be the intended functionality, right? .-.

Thanks for any help! :smiley:

For Players, it’s better to use Sponge.getServer.getPlayer(UUID playerUUID)

Well the thing is, is that the plugin won’t know (and really doesn’t need to know) if it’s a Player or Zombie or Skeleton or etc. that is using the ability. It just needs the Entity

Sponge.getServer.getPlayer(uuid).flatMap(world.getEntity(uuid))

If anyone ever needs the solution to this, I simply used
world.getEntity(uuid)
as I saw in Katrix’s reply.