Solved [HELP] Right Click Items not working?

Discussion in 'Plugin Development' started by frogman6102, Dec 13, 2014.

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

    frogman6102

    Hello! I'm making a plugin for a server of where when you right click with a certain item in your hand it will do something.

    My Code:
    Code:
    @EventHandler
        public void pclick(PlayerInteractEvent e){
            Player p = e.getPlayer();
            p.sendMessage("t");
            if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
                p.sendMessage("u");
               
                if(p.getItemInHand().getType() == Material.BLAZE_ROD){
                    p.setWalkSpeed(5.0f);
                    p.sendMessage("i");
    I do succesfully get the "u" and "t" messages but not the "u"?? And nothing if happening? Please help.
     
  2. Offline

    Skionz

    @frogman6102 So you get the 'u' and 't' messages but you don't get the 'u' message? That totally contradicts itself. Was that a typo or what?
     
  3. Offline

    frogman6102

    @Skionz sorry, I get the t and u but not the i
     
  4. Offline

    Skionz

    @frogman6102 Are you holding a blaze rod when you right click?
     
    Darkpicasa likes this.
  5. Offline

    frogman6102

  6. Offline

    Darkpicasa

    @frogman6102 console error? Or is there none..?

    Remember to cancel the event ;)
     
  7. Offline

    frogman6102

    @Darkpicasa console error
    Could not pass event PlayerInteractEvent to Hubmess v1.0 org.bukkit.event.EventException
     
  8. Offline

    Darkpicasa

    Could you print the stack trace for me?
     
  9. Offline

    Skionz

    @frogman6102 Add a null check before checking if the items type is a blaze rod.
     
  10. Offline

    frogman6102

    Idk how to like copy and paste a stack trace?
    @Darkpicasa
     
  11. Offline

    Darkpicasa

  12. Offline

    Skionz

    @frogman6102 Highlight it, press command-c or control-c, click on the reply box, press command-v or control-p/v whatever it is for windows.
     
  13. Offline

    frogman6102

    Added a null check, didnt work.
    @Skionz
     
  14. Offline

    Skionz

    @frogman6102 Then we are going to need to see the entire stack-trace.
     
    Darkpicasa likes this.
  15. Offline

    Darkpicasa

    I don't think you can highlight in cmd on windows...
    But you can in Terminal on macs.
     
  16. Offline

    Skionz

    @frogman6102 Alright your other options are to either write a command prompt wrapper using
    Code:
    Runtime.getRuntime().exec("command");
    and get all of the streams to read errors and such, or you can take a picture of it.

    @frogman6102 Can't set the player's speed to '5.0'

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Sep 18, 2018
  17. Offline

    frogman6102

    here u go
     

    Attached Files:

  18. Offline

    frogman6102

    @Skionz I can't? Then how do I change player's speed?
     
  19. Offline

    Darkpicasa

    Yeah. You should look at the "Caused By" part of the stack trace ;)

    0 is normal. -1 is the minimum, +1 is the maximum.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 29, 2016
    Skionz likes this.
  20. Offline

    Skionz

  21. Offline

    frogman6102

    Skionz likes this.
Thread Status:
Not open for further replies.

Share This Page