From d50d9b42c45dcf7884ddd1c6919e6726744eca7c Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sat, 5 Nov 2022 03:26:25 +0100 Subject: [PATCH] Delays refunding on startup to prevent a crash --- .../knarcraft/paidsigns/manager/TrackedSignManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java b/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java index 0392404..7c9d6d2 100644 --- a/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java +++ b/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java @@ -104,9 +104,11 @@ public final class TrackedSignManager { //Prevent destroyed signs from being tracked indefinitely if (!(signLocation.getBlock().getState() instanceof Sign)) { - PaidSigns.getInstance().getLogger().log(Level.WARNING, "The sign at " + signLocation + " no longer " + - "exists. Removing from sign tracker. Refunding the player."); - refund(trackedSign, true); + Bukkit.getScheduler().scheduleSyncDelayedTask(PaidSigns.getInstance(), () -> { + PaidSigns.getInstance().getLogger().log(Level.WARNING, "The sign at " + signLocation + + " no longer exists. Removing from sign tracker. Refunding the player."); + refund(trackedSign, true); + }, 100); return; }