mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Fix OfflinePlayerUUIDService breaking when no worlds have been loaded.
This commit is contained in:
parent
e17222dd19
commit
159b35c717
1 changed files with 8 additions and 4 deletions
|
@ -44,15 +44,19 @@ import java.util.UUID;
|
|||
public class OfflinePlayerUUIDService implements UUIDService {
|
||||
|
||||
@Override @NotNull public List<UUIDMapping> getNames(@NotNull final List<UUID> uuids) {
|
||||
if (Settings.UUID.FORCE_LOWERCASE) {
|
||||
if (Settings.UUID.FORCE_LOWERCASE || Bukkit.getWorlds().isEmpty()) {
|
||||
return Collections.emptyList(); // This is useless now
|
||||
}
|
||||
final List<UUIDMapping> 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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue