Skip to content

Commit 92af760

Browse files
PlayerFinder:Disable offline search when offline stash is enabled
1 parent eb99616 commit 92af760

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/org/maxgamer/quickshop/util/PlayerFinder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public final class PlayerFinder {
4848
private static final Map<String, UUID> string2UUIDStash = new java.util.concurrent.ConcurrentHashMap<>();
4949
private static final Cache<String, UUID> string2UUIDCache = CacheBuilder.newBuilder().expireAfterAccess(60, TimeUnit.MINUTES).build();
5050

51-
private static volatile boolean isStashNeeded;
51+
private static volatile boolean useOfflineStash;
5252

5353
private PlayerFinder() {
5454
}
@@ -75,14 +75,14 @@ public static Set<String> getCachedOfflinePlayerNames() {
7575
}
7676

7777
public static void updateStashIfNeeded(Player player) {
78-
if (isStashNeeded) {
78+
if (useOfflineStash) {
7979
string2UUIDStash.put(player.getName().toLowerCase(Locale.ROOT), player.getUniqueId());
8080
}
8181
}
8282

8383
public static void doLargeOfflineCachingWork(QuickShop quickShop, OfflinePlayer[] offlinePlayers) {
8484
quickShop.getLogger().log(Level.INFO, "Large server detected (offline player > 2000), start offline player caching...");
85-
isStashNeeded = true;
85+
useOfflineStash = true;
8686
for (OfflinePlayer offlinePlayer : quickShop.getServer().getOfflinePlayers()) {
8787
String name = offlinePlayer.getName();
8888
if (name != null) {
@@ -107,7 +107,7 @@ public static OfflinePlayer findOfflinePlayerByName(String name) {
107107
} else {
108108
Server server = Bukkit.getServer();
109109
result = findPlayerByName(name, server.getOnlinePlayers(), false);
110-
if (result == null) {
110+
if (!useOfflineStash && result == null) {
111111
result = findPlayerByName(name, Arrays.asList(server.getOfflinePlayers()), true);
112112
}
113113
if (result == null) {

0 commit comments

Comments
 (0)