Glaedr Help.

Status
This thread has been locked.

Chirp

Banned
Feedback score
1
Posts
141
Reactions
54
Resources
0
How exactly do I clear the entries on the scoreboard? I tried some methods but I guess it likes to add more entries. If you could help that would be awesome.

I'm not looking for trashy replies such as "don't use glaedr", "glaedr sucks", "use <blank>". That's not what this thread is about.
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Chirp

Banned
Feedback score
1
Posts
141
Reactions
54
Resources
0
Well, looking at Glaedr's PlayerScoreboard class and looking at the task, the answer is right there. It goes through all of the entries and if the current Entry's boolean field named cancel is true, then it will remove that current Entry on the PlayerScoreboard.
Here's a little spoon feed since I'm feeling generous.
Using a Stream -
Code:
PlayerScoreboard playerScoreboard = PlayerScoreboard.getScoreboard(player); // Get the player's scoreboard
if (playerScoreboard != null) { // check if the PlayerScorboard object is null
  playerScoreboard.getEntries().stream().forEach(entry -> entry.setCancelled(true)); // Iterate through all the entries and then cancel them
}
Using an Iterator which is what Alex does -
Code:
PlayerScoreboard playerScoreboard = PlayerScoreboard.getScoreboard(player); // Get the player's scoreboard
if (playerScoreboard != null) { // check if the PlayerScorboard object is null
  Iterator<Entry> entryIterator = playerScoreboard.getEntries().iterator(); // duh
  while (entryIterator.hasNext()) { // if you don't understand this, then wat
    Entry entry = entryIterator.next(); // storing the current Entry
    entry.setCancelled(true); // duh, again
  }
}

EDIT: I do recommend using this scoreboard API.
Thank you so much! It worked :D
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/chirp-scam-report.256572/)
Status
This thread has been locked.
Top