Re-introduce online mode

This commit is contained in:
Hannes Greule 2020-06-13 15:53:03 +02:00
parent a3586791b5
commit 3e2e61d2be

View File

@ -60,6 +60,7 @@ public class OfflinePlayerUUIDService implements UUIDService {
@Override @NotNull public List<UUIDMapping> getUUIDs(@NotNull final List<String> usernames) { @Override @NotNull public List<UUIDMapping> getUUIDs(@NotNull final List<String> usernames) {
final List<UUIDMapping> wrappers = new ArrayList<>(usernames.size()); final List<UUIDMapping> wrappers = new ArrayList<>(usernames.size());
for (final String username : usernames) { for (final String username : usernames) {
if (Settings.UUID.OFFLINE) {
if (Settings.UUID.FORCE_LOWERCASE) { if (Settings.UUID.FORCE_LOWERCASE) {
wrappers.add(new UUIDMapping(UUID.nameUUIDFromBytes(("OfflinePlayer:" + wrappers.add(new UUIDMapping(UUID.nameUUIDFromBytes(("OfflinePlayer:" +
username.toLowerCase()).getBytes(Charsets.UTF_8)), username)); username.toLowerCase()).getBytes(Charsets.UTF_8)), username));
@ -67,6 +68,12 @@ public class OfflinePlayerUUIDService implements UUIDService {
wrappers.add(new UUIDMapping(UUID.nameUUIDFromBytes(("OfflinePlayer:" + wrappers.add(new UUIDMapping(UUID.nameUUIDFromBytes(("OfflinePlayer:" +
username).getBytes(Charsets.UTF_8)), username)); username).getBytes(Charsets.UTF_8)), username));
} }
} else {
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(username);
if (offlinePlayer.hasPlayedBefore()) {
wrappers.add(new UUIDMapping(offlinePlayer.getUniqueId(), offlinePlayer.getName()));
}
}
} }
return wrappers; return wrappers;
} }