Solved Rightclick event not working

Discussion in 'Plugin Development' started by seanliam2000, May 21, 2015.

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


    I am trying to make an inventory open when a player rightclicks but it isn't working
    It only executes up till the first message and stops after it checks for the material, I had it working before with a different way of checking if the user was using the right item but that gave off on an error when you weren't holding it

    P.S I can provide any additional info if needed

    1. @EventHandler
    2. public void onPlayerInteract(PlayerInteractEvent event) {
    4. if ((event.getAction() == Action.RIGHT_CLICK_AIR ) || (event.getAction() == Action.RIGHT_CLICK_BLOCK )) {
    5. event.getPlayer().sendMessage("1");
    6. if (event.getPlayer().getItemInHand().equals(Material.getMaterial(Configuration.joinitem))) {
    7. event.getPlayer().sendMessage("2");
    8. if ( event.getPlayer().getItemInHand().getItemMeta().getLore().equals(ChatColor.AQUA + "" + ChatColor.BOLD + "Right click to open wardrobe!")) {
    9. event.getPlayer().sendMessage("3");
    10. event.getPlayer().performCommand("wardrobe");
    11. }
    12. }
    13. }
    14. }

    joinitem: "DIRT"
    joinitemslot: 1
    joinitemname: "&c&lWardrobe"
    NEVERMIND I fixed it marking as solved

    new code:

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

Share This Page