Skip to content

Commit

Permalink
Optimized sorting of islands in the sorted registry to not do anythin…
Browse files Browse the repository at this point in the history
…g when there aren't at least two islands in cache
  • Loading branch information
OmerBenGera committed Feb 4, 2022
1 parent 0c90b0f commit 4506339
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -54,6 +54,12 @@ public List<V> getIslands(Z sortingType) {
}

public void sort(Z sortingType, Predicate<V> predicate, Runnable onFinish) {
if (innerMap.size() <= 1) {
if (onFinish != null)
onFinish.run();
return;
}

if (Bukkit.isPrimaryThread()) {
Executor.async(() -> sort(sortingType, predicate, onFinish));
return;
Expand Down

0 comments on commit 4506339

Please sign in to comment.