File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/main/java/org/maxgamer/quickshop/util Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -50,19 +50,24 @@ public static UUID findUUIDByName(String name) {
5050
5151 @ Nullable
5252 private static OfflinePlayer findPlayerByName (String name , java .util .Collection <? extends org .bukkit .OfflinePlayer > players ) {
53- //Cache all players when offline player is too much
53+ //Cache all players when offline player is too many
5454 boolean cacheAllPlayers = players .size () > 5000 ;
55+ OfflinePlayer result = null ;
5556 for (OfflinePlayer player : players ) {
5657 String playerName = player .getName ();
5758 if (playerName != null ) {
5859 if (playerName .equalsIgnoreCase (name )) {
59- return player ;
60- } else if (cacheAllPlayers ) {
60+ result = player ;
61+ if (!cacheAllPlayers ) {
62+ return result ;
63+ }
64+ }
65+ if (cacheAllPlayers ) {
6166 string2UUIDCache .put (playerName .toLowerCase (Locale .ROOT ), player .getUniqueId ());
6267 }
6368 }
6469 }
65- return null ;
70+ return result ;
6671 }
6772
6873 public static OfflinePlayer findOfflinePlayerByName (String name ) {
You can’t perform that action at this time.
0 commit comments