Bug Scoreboard

Discussion in 'Plugin Development' started by Mother__, Jul 9, 2014.

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

    Mother__

    Hi guys i have problem i use hashmap <player,double> and show money from player but i have
    that problem

    [​IMG]


    When have more one player online scoreboard show money all the players not specific player ( sorry my english)

    On image show 2 values ( 2 players )

    Player 1 $48.3
    Player 2 $26.2

    i try this i use other hashmap writing last_coins off player and resetScore look

    http://pastebin.com/nVySNb3x


    Please help me!!
     
  2. Offline

    tommycake50

    Don't store players in HashMaps! If the player logs out you will still have the instance in your HashMap which doesn't allow the player and the chunks it would be on to be despawned and unloaded, this causes problems over time and can lead to excessive memory use because the server can't free the ram that the player in your HashMap is hogging.
     
  3. Offline

    Mother__

    This is not my problem someone can help me?
     
  4. Offline

    LordVakar

    tommycake50
    Not necessarily. If you remove the player instance accordingly when you should, then keeping the player object is still okay.
    Mother__
    I'll look at your code.
     
  5. Offline

    tommycake50

    This is true but it is still really really ill advised to do so.
    Not to mention terrible practice.
     
    LordVakar likes this.
  6. Offline

    Mother__

    Someone can help me ?=(
     
  7. Offline

    Konato_K

    You need to create a new scoreboard for each player that logs in the server and (since you are storing players in a hashmap) remove the player from the map once he logs out.
     
  8. Offline

    Mother__

    remove player scoreboard and set again ?
     
  9. Offline

    xTigerRebornx

    Mother__ Each Player needs their own Scoreboard for what you are trying to do.
     
  10. Offline

    Mother__

    THX GUYS WORKING!!!!!!! LOVE U SO MUCH!!
     
Thread Status:
Not open for further replies.

Share This Page