1.14.4 How to teleport specific entity to location?

Discussion in 'Spigot Plugin Development' started by kinukin, Feb 2, 2020.

  1. I want to teleport a specific entity to a location but it's teleporting every entity to the same location? I only want to teleport a specific entity to a location. How can I do that?

    Code (Text):
        @EventHandler
        public void onEntityMove(EntityMoveEvent e) {
            Entity entity = (Entity) e.getEntity();
            if(goblinUUID.contains(entity.getUniqueId())) {
                entity.teleport(location);
            }
        }
     
  2. Theres no event called EntityMoveEvent are you sure using a fork of bukkit?
     
    • Like Like x 1
  3. Firstly, your question is not clear. We don't know what you really want to achieve here.
    Secondly, there's no such event as EntityMoveEvent. You can only check for Player and Vehicule movements.

    If you want to teleport a specific Entity to a specific Location, you need to have both entity and location reference.
    Then do the following.

    Code (Java):
    entity.teleport(location);