Solved Teleport Stick PlayerInteractEvent

Discussion in 'Plugin Development' started by Veilbreaker, May 27, 2015.

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

    Veilbreaker

    Solved
     
    Last edited: May 27, 2015
  2. Offline

    nverdier

    @Veilbreaker You should probably post your solution so somebody doesn't create another thread about the same issue
     
  3. Offline

    Agentleader1

    Lol, the thread was started and already solved?

    I'll give the solution for others:
    Code:
    @EventHandler
    public void onInteract(PlayerInteractEvent pie){
        Player player = pie.getPlayer();
        if(pie.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
            if(player.getInventory().getItemInHand().getType().equals(Material.BLAZE_ROD)){
                pie.setCancelled();
                Location loc = player.getTargetBlock(null, 99999).getLocation();
                player.teleport(loc);
            }
        }
    
    }
    http://pastebin.com/612ZPKqa
     
Thread Status:
Not open for further replies.

Share This Page