How to update players money on scoreboards immediately?

Discussion in 'Plugin Development' started by kevin3220, Nov 11, 2013.

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

    kevin3220

    How to update players money on scoreboards immediately?
    Thank you ;)
     
  2. just use the set method for the score and it will update. You may need to hook into the plugin that is keeping the amount of players money. You may need to expand on this telling us what plugins you are using to do what so we can help more :)
     
  3. Offline

    kevin3220

    I am using vault
     
  4. I dont think that vault contains any events when a players money changes unless i missed it? Would be a useful event tho.
     
  5. Offline

    Garris0n

    Just set it again every second or so.
     
  6. Offline

    kevin3220

    But do you know some economy plugin that supports?;D

    Will it cause lag?

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

    Garris0n

    No (well, unless vault's money look up is tremendously inefficient)
     
  8. very inefficent way of doing it. Also I wouldnt rely on vault to take care of it.

    The ideal solution would be to create a custom event whenever a players account is changed to fire it. And have it update only then.

    This may help, near the end of the page is how to create custom events.
    http://wiki.bukkit.org/Introduction_to_the_New_Event_System
     
  9. Offline

    Quantum64

  10. Offline

    Garris0n

    Yeah, if he feels like making his own version of vault. Which would, in turn, make using vault redundant.
     
    russjr08 likes this.
  11. Offline

    kevin3220

    still looking solutions ;)

    bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  12. then request to have this feature implemented?
     
  13. Offline

    drtshock

    Try writing some code yourself and we can give feedback on it. You could always call an event when someone's money changes and then update the scoreboard on the event.
     
  14. just like I said :) ,

    or alteratly , I came across in iconomy that there is an account update event which you could hook into, but that would mean for you to use that plugin, and not use vault.

    here are the events that iconomy has as they may be of use:

    https://github.com/ElgarL/iConomy/blob/master/src/com/iConomy/events/
     
  15. Offline

    travelingdp

    Sleaker (the author of Vault), has stated several times that he will never add such a feature to the plugin. He states that creating an event listener for a "MoneyChangeEvent" wouldn't work, which doesn't seem right to me. It may not be efficient, but it's possible. Point is, the only way to implement this is to write it yourself. There are several ways you could do this, most of which, however, would be quite inefficient, which is probably Sleaker's main reason for not adding a method for this into his plugin.

    The problem is that there is no method that is called when a player's account has changed. Creating an event and listener for that event would require implementing said inefficient methods. Because of the difference between different economy plugins, Vault can't reliably call upon them when a player gains or loses money without being incredibly inefficient. There is no way to create an event to hook into Vault for something that doesn't really "exist" within Vault, if you understand what I'm saying.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  16. yes that makes sense, a better approach would be to implement it in the economy plugin itself and create an event there :). I know that defeats the purpose of vault but thats what I would do.

    yes you are correct, would be better to implement this into the economy plugin itself :)

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

Share This Page