From 2017d3dbca58490a1e2ec9ef595e68012037b0af Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Tue, 24 Dec 2024 12:17:41 +0800 Subject: [PATCH] chore: show raw lkey when convert failed --- .../slimefun4/storage/util/LocationUtils.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/util/LocationUtils.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/util/LocationUtils.java index ba334a6324..ae484696a4 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/util/LocationUtils.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/util/LocationUtils.java @@ -1,6 +1,10 @@ package com.xzavier0722.mc.plugin.slimefun4.storage.util; import city.norain.slimefun4.SlimefunExtended; +import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; + +import java.util.logging.Level; + import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Location; @@ -20,13 +24,17 @@ public static Location toLocation(String lKey) { return null; } - var strArr = lKey.split(";"); - var loc = strArr[1].split(":"); - return new Location( + try { + var strArr = lKey.split(";"); + var loc = strArr[1].split(":"); + return new Location( Bukkit.getWorld(strArr[0]), Double.parseDouble(loc[0]), Double.parseDouble(loc[1]), Double.parseDouble(loc[2])); + } catch (Exception e) { + throw new RuntimeException("Unable to parse location [" + lKey + "]", e); + } } public static boolean isSameChunk(Chunk c1, Chunk c2) {