Skip to content

Commit 58225d2

Browse files
committed
Softer fail handling for uuid during pwi import
1 parent 6119823 commit 58225d2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/org/mvplugins/multiverse/inventories/dataimport/perworldinventory/PwiImportHelper.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.jetbrains.annotations.Nullable;
2323
import org.mvplugins.multiverse.core.utils.ReflectHelper;
2424
import org.mvplugins.multiverse.core.world.WorldManager;
25+
import org.mvplugins.multiverse.external.vavr.control.Try;
2526
import org.mvplugins.multiverse.inventories.config.InventoriesConfig;
2627
import org.mvplugins.multiverse.inventories.dataimport.DataImportException;
2728
import org.mvplugins.multiverse.inventories.profile.GlobalProfile;
@@ -128,7 +129,11 @@ private void findPlayersWithData() throws DataImportException {
128129
}
129130
this.playerList = Arrays.stream(playerFolders)
130131
.filter(File::isDirectory)
131-
.map(file -> UUID.fromString(file.getName()))
132+
.map(file -> Try.of(() -> UUID.fromString(file.getName()))
133+
.onFailure(throwable -> Logging.warning("Unable to convert %s to UUID: %s",
134+
file.getName(), throwable.getMessage()))
135+
.getOrNull())
136+
.filter(Objects::nonNull)
132137
.map(Bukkit::getOfflinePlayer)
133138
.toList();
134139
}

0 commit comments

Comments
 (0)