Teleport to next wall

Discussion in 'Plugin Development' started by Julz_Dev, May 31, 2014.

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

    Julz_Dev

    Hello Community,

    I have a question:

    How can I teleport a player to the next wall in their view?
    Like the compass in WorldEdit.

    I tried the method p.getLineOfSight(null, 100);, but it is deprecated.

    Thanks. :)
     
  2. Offline

    fireblast709

    aaomidi likes this.
  3. Offline

    Julz_Dev

  4. Offline

    fireblast709

    Julz_Dev
    Code:java
    1. BlockIterator bi = new BlockIterator(player, maxDistance);
    2. Block b;
    3. while(bi.hasNext())
    4. {
    5. b = bi.next();
    6. if(b.getType() != Material.AIR)
    7. break;
    8. b = null;
    9. }
    10. if(b == null)
    11. {
    12. // No block found
    13. }
    14. else
    15. {
    16. // Block found
    17. }
     
Thread Status:
Not open for further replies.

Share This Page