Player Item Held not firing?

Discussion in 'Plugin Development' started by Waffletastic, Dec 30, 2011.

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

    Waffletastic

    Anyone else having this problem? When someone switches the item in their hand this event is not firing for me.
     
  2. Offline

    tkausl

    Show us code please.
     
  3. Offline

    Waffletastic

    public void onPlayerItemHeld(PlayerItemHeldEvent event){
    System.out.println("Item switched.");
    }

    This doesn't even work :p But other listeners in the same class work.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 22, 2016
  4. Offline

    nisovin

    This is why you always use @Override
    Code:
    @Override
    public void onItemHeldChange(PlayerItemHeldEvent event) {
    }
    
     
  5. Offline

    Waffletastic

    will try it. Jw what does @Override even do?

    The method onPlayerItemHeld(PlayerItemHeldEvent) of type SATPlayerListener must override or implement a supertype method

    Got this after putting @Override

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 22, 2016
  6. Offline

    tkausl

    Yes, this tell you that you will NOT override any Method.
    Always use @Override, then you get this error, when you Named the Method false.
     
  7. Offline

    halley

    In other words, adding @Override to your code does not change your code behavior, but it helps the compiler spit out an error if your function does not in fact match the one you're trying to override.

    Another clue in Eclipse is when you don't see a little triangle in the left margin next to the method declaration. Triangles appear when you properly declare an override of the base class's method (solid) or an implementation of an interface method (hollow).
     
  8. Offline

    Waffletastic

    Thanks for the info. So how should I add the override?
     
  9. Offline

    nisovin

    Please read my code more closely.
     
Thread Status:
Not open for further replies.

Share This Page