Cant check if im right clicking a block?

Discussion in 'Plugin Development' started by PotatoLol12321, Dec 12, 2014.

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

    PotatoLol12321

    My code
    Code:
    public void onEnable(){
            Bukkit.getPluginManager().registerEvents(this, this);
        }
        @EventHandler
        public void onInteract(PlayerInteractEvent e) {
            if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
                double x = (e.getClickedBlock().getLocation().getX());
                double y = (e.getClickedBlock().getLocation().getY() + 5);
                double z = (e.getClickedBlock().getLocation().getZ());
                Location loc = new Location(e.getClickedBlock().getWorld(), x, y, z);
                loc.getBlock().setType(Material.DIAMOND_BLOCK);
                }
            }
        }
    Doesnt do anything, and no errors.

    nvm fixed

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 29, 2016
Thread Status:
Not open for further replies.

Share This Page