mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
Fix OfflinePlayerUUIDService breaking when no worlds have been loaded.
This commit is contained in:
parent
e17222dd19
commit
159b35c717
@ -44,15 +44,19 @@ import java.util.UUID;
|
|||||||
public class OfflinePlayerUUIDService implements UUIDService {
|
public class OfflinePlayerUUIDService implements UUIDService {
|
||||||
|
|
||||||
@Override @NotNull public List<UUIDMapping> getNames(@NotNull final List<UUID> uuids) {
|
@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
|
return Collections.emptyList(); // This is useless now
|
||||||
}
|
}
|
||||||
final List<UUIDMapping> wrappers = new ArrayList<>(uuids.size());
|
final List<UUIDMapping> wrappers = new ArrayList<>(uuids.size());
|
||||||
for (final UUID uuid : uuids) {
|
for (final UUID uuid : uuids) {
|
||||||
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);
|
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);
|
||||||
if (offlinePlayer.hasPlayedBefore()) {
|
try {
|
||||||
wrappers.add(new UUIDMapping(uuid, offlinePlayer.getName()));
|
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;
|
return wrappers;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user