Skip to content

Commit

Permalink
Fixed infinite recursive call when calling cancelAllIslandPreviews as…
Browse files Browse the repository at this point in the history
…ync while disabling the plugin
  • Loading branch information
OmerBenGera committed Jan 7, 2023
1 parent 64f6f38 commit 19fa671
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -339,8 +339,16 @@ public void cancelIslandPreview(SuperiorPlayer superiorPlayer) {
@Override
public void cancelAllIslandPreviews() {
if (!Bukkit.isPrimaryThread()) {
BukkitExecutor.sync(this::cancelAllIslandPreviews);
return;
BukkitExecutor.sync(this::cancelAllIslandPreviewsSync);
} else {
cancelAllIslandPreviewsSync();
}
}

private void cancelAllIslandPreviewsSync() {
if (!Bukkit.isPrimaryThread()) {
Log.warn("Trying to cancel all island previews asynchronous. Stack trace:");
new Exception().printStackTrace();
}

this.islandPreviews.getActivePreviews().forEach(islandPreview -> {
Expand Down

0 comments on commit 19fa671

Please sign in to comment.