Removing Entry from a Scoreboard

Discussion in 'Plugin Development' started by SirFaizdat, Jun 26, 2014.

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

    SirFaizdat

    I am having a lot of trouble removing an entry from a scoreboard. I am using Chinwe's Scroller class, and every time I call the .next() method it just appends a new line onto the scoreboard. Calling the scoreboard.resetScores() method does not work. Here is my code:


    Code:text
    1.  
    2. public void update() {
    3. new BukkitRunnable() {
    4. @Override
    5. public void run() {
    6. if (ready) {
    7. for (Entry<StringIntGroup, Scroller> entry : scrollers
    8. .entrySet()) {
    9. scoreboard.resetScores(entry.getKey().getString());
    10. obj.getScore(entry.getValue().next()).setScore(
    11. entry.getKey().getInteger());
    12. entry.getValue();
    13. }
    14. }
    15. }
    16. }.runTaskTimer(Core.i(), 0L, 5L);
    17. }
    18.  


    Is there another way to remove an entry?
     
  2. Offline

    SirFaizdat

    Is it impossible? Am I doing something wrong?
     
  3. Offline

    fireblast709

    SirFaizdat you seem to reset the score, which name has been stored in the key, and then you create a new score from the value. Next time that code is ran, is that String you acquired from the value, the in the key from the Map? Because that seems pretty unlikely to me.
     
  4. Offline

    SirFaizdat

    Actually, what I think I'm trying to do is edit the key and value in the HashMap to equal the scroller.next() value. Whenever I do this, I get a ConcurrentModificationException.
     
Thread Status:
Not open for further replies.

Share This Page