Arrow Teleportation

Discussion in 'Plugin Development' started by CoderRevolq, Apr 12, 2014.

Thread Status:
Not open for further replies.
  1. Offline


    How do I make it so when I shoot a bow, whereever it lands, it tp's the user to that location. Example I have a bow in my inventory, I shoot it at a wall and when the arrow hits I get teleported to that, please help!
  2. Offline


    Listen for ProjectileHitEvent -> Check if it's an arrow and the shooter is a player -> Teleport player to the projectile's location.
  3. Offline


    Gater12 Can you go more in depth on how to do it? Like how to check if the projectile hits and all that?
  4. Offline



    I dont have the time right now, but i will in the morning, but i can help you with this

    i've already made a plugin that does exactly what you want, when you shoot an arrow, when it lands the player is teleported to that location

    so if no body has answered you by in the morning ill help you in depth.
  5. Offline


    Minermax7 likes this.
  6. Offline


    1. if (projectile instanceof Arrow) {
    2. Arrow a = (Arrow) projectile;
    3. if (arrow.getShooter() instanceof Player) {
    4. Player p = (Player) a.getShooter();
    6. p.teleport(arrow);

    I'm pretty sure that's about it. And its
    1. ProjectileHitEvent
  7. Offline


  8. Offline


    FabeGabeMC You can use the teleport() method to either teleport(Entity) or teleport(Location)
  9. FabeGabeMC Doesn't matter either way. You can teleport entities to locations or other entities. :)
  10. Offline


    unon1100 AdamQpzm okie dokie. Just pointing out. lol but thanks for reminding me that. Mistakes have been made! lol
    ShearsSheep and AdamQpzm like this.
Thread Status:
Not open for further replies.

Share This Page