Solved PlayerInteractEvent Right Click event not working... help!!!

Discussion in 'Plugin Development' started by solly576, Apr 26, 2013.

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


    As part of my Kits plugin, when a user right clicks air with a Nether Star, i want them to be given a 5-second long jump boost. However, the code below (placed in my main class) doesn't work:

        public void onPlayerInteract(PlayerInteractEvent event)
        Player player = (Player) event.getPlayer();
                    int blockId = player.getItemInHand().getType().getId();
                    if (blockId == 399)
                            if (event.getAction() == Action.RIGHT_CLICK_AIR)
                                ((LivingEntity) player).addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 100 , 3));
                                player.sendMessage("ยง9You feel like the wind...");
    Help please!

    Oh yeah, if it makes any difference, i use Command Executor classes f0r different commands

    Please help!

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

    Ewe Loon

    first put some debugging in to see how far its getting if its getting there at all
    add a first line to send something to the console

    I personally dont use command executor classes so i cant help if they arnt being processed
  3. Offline


    Ok i will try that. This piece of code has nothing to do with the command executors since it is in the main class
  4. Offline


    It doesn't get anywhere! It is located at the end of my main class, will that make a difference?
  5. Offline


    1) Does the class implement Listener?
    2) Did you register your events?
  6. Offline


    Yeah, i got it fixed now, thanks!
Thread Status:
Not open for further replies.

Share This Page