I have max. 100 entities in a scoreboard called "shio_number" and wants to eliminate the entity with the highest score (edited)
the function in which then later is executed by the player
I assume that the entry in the scoreboard is an object and you have the 100 entities in a list. Then you can do the following:
Scoreboardentry entry = list.stream (). Sorted ((u1, u2) → u1.getScore (). CompareTo (u2.getScore (.findFirst (). OrElse (null);
And then you can do the following:
if (entry! = null) {
synchronized (list) {
liste.remove (entry);
}
}
The "synchronized" I use in lists in general, since I can rule out that this list is changed while I edit this. Of course, assume that all other accesses to this list are also synchronized.
Thanks for you great answer, but unfortunately I'm looking for a solution to implement the whole thing in Minecraft [Commands Commands) as it was already in the question and not in Java or the same