From 58225d2ea8317925b1c6d4eeafca3c370b7808b4 Mon Sep 17 00:00:00 2001 From: Ben Woo <30431861+benwoo1110@users.noreply.github.com> Date: Fri, 6 Jun 2025 20:26:25 +0800 Subject: [PATCH] Softer fail handling for uuid during pwi import --- .../dataimport/perworldinventory/PwiImportHelper.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/mvplugins/multiverse/inventories/dataimport/perworldinventory/PwiImportHelper.java b/src/main/java/org/mvplugins/multiverse/inventories/dataimport/perworldinventory/PwiImportHelper.java index 0ff6c039..eaaf5ed5 100644 --- a/src/main/java/org/mvplugins/multiverse/inventories/dataimport/perworldinventory/PwiImportHelper.java +++ b/src/main/java/org/mvplugins/multiverse/inventories/dataimport/perworldinventory/PwiImportHelper.java @@ -22,6 +22,7 @@ import org.jetbrains.annotations.Nullable; import org.mvplugins.multiverse.core.utils.ReflectHelper; import org.mvplugins.multiverse.core.world.WorldManager; +import org.mvplugins.multiverse.external.vavr.control.Try; import org.mvplugins.multiverse.inventories.config.InventoriesConfig; import org.mvplugins.multiverse.inventories.dataimport.DataImportException; import org.mvplugins.multiverse.inventories.profile.GlobalProfile; @@ -128,7 +129,11 @@ private void findPlayersWithData() throws DataImportException { } this.playerList = Arrays.stream(playerFolders) .filter(File::isDirectory) - .map(file -> UUID.fromString(file.getName())) + .map(file -> Try.of(() -> UUID.fromString(file.getName())) + .onFailure(throwable -> Logging.warning("Unable to convert %s to UUID: %s", + file.getName(), throwable.getMessage())) + .getOrNull()) + .filter(Objects::nonNull) .map(Bukkit::getOfflinePlayer) .toList(); }