diff --git a/pom.xml b/pom.xml
index 35f266d..43953dd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.artillexstudios
AxGraves
- 1.15.0
+ 1.15.1
jar
AxGraves
diff --git a/src/main/java/com/artillexstudios/axgraves/AxGraves.java b/src/main/java/com/artillexstudios/axgraves/AxGraves.java
index 03831e4..bc49fd5 100644
--- a/src/main/java/com/artillexstudios/axgraves/AxGraves.java
+++ b/src/main/java/com/artillexstudios/axgraves/AxGraves.java
@@ -64,6 +64,7 @@ public void enable() {
public void disable() {
TickGraves.stop();
SaveGraves.stop();
+
for (Grave grave : SpawnedGraves.getGraves()) {
if (!CONFIG.getBoolean("save-graves.enabled", true))
grave.remove();
diff --git a/src/main/java/com/artillexstudios/axgraves/grave/Grave.java b/src/main/java/com/artillexstudios/axgraves/grave/Grave.java
index 0a23b2b..5669120 100644
--- a/src/main/java/com/artillexstudios/axgraves/grave/Grave.java
+++ b/src/main/java/com/artillexstudios/axgraves/grave/Grave.java
@@ -21,6 +21,7 @@
import dev.triumphteam.gui.guis.Gui;
import dev.triumphteam.gui.guis.StorageGui;
import org.bukkit.Bukkit;
+import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
@@ -168,7 +169,7 @@ public void interact(@NotNull Player opener, org.bukkit.inventory.EquipmentSlot
}
if (slot.equals(org.bukkit.inventory.EquipmentSlot.HAND) && opener.isSneaking()) {
- if(opener.getGameMode() == GameMode.SPECTATOR) return;
+ if (opener.getGameMode() == GameMode.SPECTATOR) return;
if (!CONFIG.getBoolean("enable-instant-pickup", true)) return;
if (CONFIG.getBoolean("instant-pickup-only-own", false) && !opener.getUniqueId().equals(player.getUniqueId())) return;
diff --git a/src/main/java/com/artillexstudios/axgraves/grave/SpawnedGraves.java b/src/main/java/com/artillexstudios/axgraves/grave/SpawnedGraves.java
index 5648924..00a727e 100644
--- a/src/main/java/com/artillexstudios/axgraves/grave/SpawnedGraves.java
+++ b/src/main/java/com/artillexstudios/axgraves/grave/SpawnedGraves.java
@@ -65,7 +65,8 @@ public static void saveToFile() {
array.add(obj);
}
- try (FileWriter fw = new FileWriter(new File(AxGraves.getInstance().getDataFolder(), "data.json"))){
+ File file = new File(AxGraves.getInstance().getDataFolder(), "data.json");
+ try (FileWriter fw = new FileWriter(file)) {
gson.toJson(array, fw);
} catch (Exception ex) {
ex.printStackTrace();
@@ -87,6 +88,7 @@ public static void loadFromFile() {
for (JsonElement el : array) {
JsonObject obj = el.getAsJsonObject();
Location location = Serializers.LOCATION.deserialize(obj.get("location").getAsString());
+ if (location == null || location.getWorld() == null) continue;
OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(obj.get("owner").getAsString()));
String itStr = obj.get("items").getAsString();
ItemStack[] items = Serializers.ITEM_ARRAY.deserialize(Base64.getDecoder().decode(itStr));