Removed stream function.

Stream functions generate new objects. Looping through the values is more efficient.
This commit is contained in:
JitseB 2018-04-16 07:49:57 +02:00
parent 0387732482
commit 06b034c86e
1 changed files with 9 additions and 1 deletions

View File

@ -59,7 +59,15 @@ public abstract class NPC {
public void destroy() {
NPCManager.remove(this);
shown.stream().filter(u -> !autoHidden.contains(u)).forEach(u -> hide(Bukkit.getPlayer(u), true));
// Destroy NPC for every player that is still seeing it.
for (UUID uuid : shown) {
if (autoHidden.contains(uuid)) {
continue;
}
hide(Bukkit.getPlayer(uuid), true);
}
}
public Set<UUID> getShown() {