Solved Fires over 50 times, only called once?

Discussion in 'Plugin Development' started by skipperguy12, May 19, 2013.

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

    skipperguy12

  2. Offline

    Tjstretchalot

    Not relevant to the problem, but please only use exceptions in exceptional situations. Someone rightclicking something besides a sign is definitely not an exceptional circumstance. Just do an instanceof check. A catch statement is rather slow.
     
  3. Offline

    Vynlar

    If you commented your code, we would be able to help you so much more.
     
  4. Offline

    nitrousspark

    where are you sending that message?
     
  5. Offline

    skipperguy12

  6. Offline

    Tjstretchalot

    skipperguy12

    If you do an instanceof check, then it is impossible for the cast to fail. So remove the try-catch to avoid redundant code :)
     
  7. Offline

    skipperguy12

    Tjstretchalot
    Okay, i'll take it out later. But as of right now, the actual problem is the messages

    49 views...anyone see a problem?

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

    jorisk322

    The right click interact fires every tick while holding your mouse down, which often causes it to fire 3-4 times. But it definitely shouldn't be called 50 times.
     
  9. Offline

    Jeyge

    Just a guess here but it looks like in your https://github.com/skipperguy12/Mon...oneyBukkitPlayerMoneyChangeEventListener.java listener, you are checking if the person has enough money for the transaction (somewhat). If they don't, you then set their money to 0 (which doesn't work because your call just tries to subtract 0 from their current amount). This call then triggers another check to see if they have enough money which makes everything repeat.
     
  10. Offline

    skipperguy12

    Jeyge
    Haha, didn't see that. Thanks!
     
Thread Status:
Not open for further replies.

Share This Page