From cf66113ac12e9e97c1c43ebf4a9a25cdb1722e36 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sat, 12 Nov 2022 01:27:46 +0100 Subject: [PATCH] Fixes some problems in the plugin destroyed sign check --- .../net/knarcraft/paidsigns/listener/SignListener.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java b/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java index e560359..1985514 100644 --- a/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java +++ b/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java @@ -8,8 +8,9 @@ import net.knarcraft.paidsigns.formatting.PaidSignsTranslatableMessage; import net.knarcraft.paidsigns.manager.EconomyManager; import net.knarcraft.paidsigns.manager.TrackedSignManager; import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.block.Block; -import org.bukkit.block.data.type.Sign; +import org.bukkit.block.Sign; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -120,12 +121,13 @@ public class SignListener implements Listener { } performPaidSignTransaction(paidSign, player, event); + Location signLocation = event.getBlock().getLocation(); if (!event.isCancelled()) { //Immediately refund if a plugin destroyed the sign within 5 ticks of the creation Bukkit.getScheduler().scheduleSyncDelayedTask(PaidSigns.getInstance(), () -> { - Block block = event.getBlock(); - if (!(block.getBlockData() instanceof Sign)) { + Block block = signLocation.getBlock(); + if (!(block.getState() instanceof Sign)) { try { TrackedSignManager.removeTrackedSign(block.getLocation(), true, true); } catch (IOException e) {