From 3e2e61d2be893691757f4191b15adaf07737c777 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Sat, 13 Jun 2020 15:53:03 +0200 Subject: [PATCH] Re-introduce online mode --- .../bukkit/uuid/OfflinePlayerUUIDService.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 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 9c9f02344..3789de0c7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/uuid/OfflinePlayerUUIDService.java @@ -60,12 +60,19 @@ public class OfflinePlayerUUIDService implements UUIDService { @Override @NotNull public List getUUIDs(@NotNull final List usernames) { final List wrappers = new ArrayList<>(usernames.size()); for (final String username : usernames) { - if (Settings.UUID.FORCE_LOWERCASE) { - wrappers.add(new UUIDMapping(UUID.nameUUIDFromBytes(("OfflinePlayer:" + - username.toLowerCase()).getBytes(Charsets.UTF_8)), username)); + if (Settings.UUID.OFFLINE) { + if (Settings.UUID.FORCE_LOWERCASE) { + wrappers.add(new UUIDMapping(UUID.nameUUIDFromBytes(("OfflinePlayer:" + + username.toLowerCase()).getBytes(Charsets.UTF_8)), username)); + } else { + wrappers.add(new UUIDMapping(UUID.nameUUIDFromBytes(("OfflinePlayer:" + + username).getBytes(Charsets.UTF_8)), username)); + } } else { - wrappers.add(new UUIDMapping(UUID.nameUUIDFromBytes(("OfflinePlayer:" + - username).getBytes(Charsets.UTF_8)), username)); + final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(username); + if (offlinePlayer.hasPlayedBefore()) { + wrappers.add(new UUIDMapping(offlinePlayer.getUniqueId(), offlinePlayer.getName())); + } } } return wrappers;