How to make a compass command?

Discussion in 'Plugin Development' started by Bucket Configured, Oct 26, 2013.

Thread Status:
Not open for further replies.
  1. Hello, so, I'm trying to make a compass command sort of thing, where if you click a compass and pointing your cursor at a block, it will teleport you to the block you are looking at. Now, I think it has something to do with action.rightclick, which I think I have done correctly, but I'm not really sure on how to make it so when you right click, it teleports you to the block you're looking at! Any ideas or help?

    Here is what I have so far: (Not sure if it's correct)


  2. Offline


  3. Offline


    To elaborate on your three word answer, you need to put that code in a PlayerInteractEvent. If you don't understand what I mean, let me know.
  4. "Command sort of thing" meaning not necessarily a command

    Ugh, ya, it would be helpful if you could elaborate on that, thanks!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 5, 2016
  5. Offline


    Watch this video on Listeners:

    Then, apply what you learn to a PlayerInteractEvent.
  6. Oh wow, I just realized you were replying to me. I watch these videos actually, haha, just haven't got this far. It's cool that YOU replied! :) Thanks
  7. Offline


    Thanks for the views ;) If you need any more help, let me know.
  8. Well how exactly do I, using the Interact Events, make it so it tps you to the block you are looking at when you do the interactevent?
  9. Offline


    Well, you can get the block a player is looking at with:
    1. event.getPlayer().getTargetBlock(null, 100); //or maybe its 100, null

    Then, teleport with

  10. Ah, this helps, thanks!
    PogoStick29 likes this.
  11. Offline


  12. Offline


    No idea :D
Thread Status:
Not open for further replies.

Share This Page