Quick question | What is the best way to store a balance?

Discussion in 'Plugin Development' started by xXRobbie21Xx, Sep 7, 2014.

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

    xXRobbie21Xx

    So im in the middle of creating an economy plugin and im wondering what the most efficient way to save there balances would be. As of now im using a hashmap and plan on making them save upon disabling the plugin and load when enabling it, but iv seen some other ways of doing it, such as changing a int within the config, right on the spot.

    So if anyone knows what the best way to manage a balance would be, please let me know, it would mean alot!
     
  2. Offline

    fireblast709

    xXRobbie21Xx I don't think there is much difference between using a HashMap and the config, especially since they are both HashMap based storages. Though, configuration files can chain up some method calls, so you probably save some ns by using your own Map.

    A third implementation could use the Player's metadata, allowing you to access the data directly from the Player.
     
    xXRobbie21Xx likes this.
  3. Offline

    xXRobbie21Xx

    fireblast709 I gotcha, im just worried about the lag saving/loading a whole bunch of data with a hashmap would cause upon restarts.
     
  4. Offline

    fireblast709

    xXRobbie21Xx generally speaking, you would only load it onEnable (when there are no players unless you reload) and save onDisable (just before they get kicked regardless). This should give players no lag issues or anything :p
     
  5. Offline

    xXRobbie21Xx

Thread Status:
Not open for further replies.

Share This Page