From 159b35c717fde43210e5d2bcbf11f45504a04841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Wed, 24 Jun 2020 08:05:06 +0200 Subject: [PATCH] Fix OfflinePlayerUUIDService breaking when no worlds have been loaded. --- .../bukkit/uuid/OfflinePlayerUUIDService.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java index 3789de0c7..7b904e627 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java @@ -44,15 +44,19 @@ import java.util.UUID; public class OfflinePlayerUUIDService implements UUIDService { @Override @NotNull public List getNames(@NotNull final List uuids) { - if (Settings.UUID.FORCE_LOWERCASE) { + if (Settings.UUID.FORCE_LOWERCASE || Bukkit.getWorlds().isEmpty()) { return Collections.emptyList(); // This is useless now } final List wrappers = new ArrayList<>(uuids.size()); for (final UUID uuid : uuids) { final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid); - if (offlinePlayer.hasPlayedBefore()) { - wrappers.add(new UUIDMapping(uuid, offlinePlayer.getName())); - } + try { + if (offlinePlayer.hasPlayedBefore()) { + wrappers.add(new UUIDMapping(uuid, offlinePlayer.getName())); + } + } catch (final Exception ignored) {} /* This can be safely ignored. If this happens, it is + probably because it's called before the worlds have + been loaded. This is bad, but does not break anything */ } return wrappers; }