From c803e0a6de9ddf875cb9272e235d646421d2bc7c Mon Sep 17 00:00:00 2001 From: BenceX100 <52270269+BenceX100@users.noreply.github.com> Date: Wed, 28 Aug 2024 10:52:12 +0200 Subject: [PATCH] 1.13.6 --- pom.xml | 2 +- .../com/artillexstudios/axgraves/AxGraves.java | 6 ------ .../artillexstudios/axgraves/grave/Grave.java | 18 +++++++++++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 706b89d..affaf07 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.artillexstudios AxGraves - 1.13.5 + 1.13.6 jar AxGraves diff --git a/src/main/java/com/artillexstudios/axgraves/AxGraves.java b/src/main/java/com/artillexstudios/axgraves/AxGraves.java index 2f32b3f..4c5a850 100644 --- a/src/main/java/com/artillexstudios/axgraves/AxGraves.java +++ b/src/main/java/com/artillexstudios/axgraves/AxGraves.java @@ -8,7 +8,6 @@ import com.artillexstudios.axapi.libs.boostedyaml.boostedyaml.settings.loader.LoaderSettings; import com.artillexstudios.axapi.libs.boostedyaml.boostedyaml.settings.updater.UpdaterSettings; import com.artillexstudios.axapi.nms.NMSHandlers; -import com.artillexstudios.axapi.reflection.FastFieldAccessor; import com.artillexstudios.axapi.utils.FeatureFlags; import com.artillexstudios.axapi.utils.MessageUtils; import com.artillexstudios.axgraves.commands.Commands; @@ -20,7 +19,6 @@ import com.artillexstudios.axgraves.utils.UpdateNotifier; import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; -import org.bukkit.Warning; import org.bukkit.entity.Player; import revxrsal.commands.bukkit.BukkitCommandHandler; @@ -53,11 +51,7 @@ public void enable() { getServer().getPluginManager().registerEvents(new DeathListener(), this); getServer().getPluginManager().registerEvents(new PlayerInteractListener(), this); - Warning.WarningState prevState = Bukkit.getWarningState(); - FastFieldAccessor accessor = FastFieldAccessor.forClassField(Bukkit.getServer().getClass().getPackage().getName() + ".CraftServer", "warningState"); - accessor.set(Bukkit.getServer(), Warning.WarningState.OFF); final BukkitCommandHandler handler = BukkitCommandHandler.create(instance); - accessor.set(Bukkit.getServer(), prevState); handler.register(new Commands()); diff --git a/src/main/java/com/artillexstudios/axgraves/grave/Grave.java b/src/main/java/com/artillexstudios/axgraves/grave/Grave.java index cc1e404..eac2b0e 100644 --- a/src/main/java/com/artillexstudios/axgraves/grave/Grave.java +++ b/src/main/java/com/artillexstudios/axgraves/grave/Grave.java @@ -245,14 +245,22 @@ public void remove() { if (removed) return; removed = true; - Scheduler.get().runAt(location, scheduledTask -> { - SpawnedGraves.removeGrave(this); - removeInventory(); + if (Bukkit.isPrimaryThread()) { + removeNow(); + return; + } - if (entity != null) entity.remove(); - if (hologram != null) hologram.remove(); + Scheduler.get().runAt(location, scheduledTask -> { + removeNow(); }); + } + + private void removeNow() { + SpawnedGraves.removeGrave(this); + removeInventory(); + if (entity != null) entity.remove(); + if (hologram != null) hologram.remove(); } public void removeInventory() {