mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2026-11-22 05:02:35 +00:00
Huge cleanup
This commit is contained in:
1 parent
0e449cdd7a
commit
84335afacd
43 files changed
+351
-378
No files matched your search
@@ -6,6 +6,7 @@ import me.lucko.luckperms.data.Datastore;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@@ -40,17 +41,13 @@ public abstract class UserManager {
|
||||
* @param name The name to search by
|
||||
* @return a {@link User} object if the user is loaded, returns null if the user is not loaded
|
||||
*/
|
||||
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
||||
public User getUser(String name) {
|
||||
User user = null;
|
||||
|
||||
for (User u : users.values()) {
|
||||
if (u.getName().equalsIgnoreCase(name)) {
|
||||
user = u;
|
||||
break;
|
||||
}
|
||||
try {
|
||||
return users.values().stream().filter(u -> u.getName().equalsIgnoreCase(name)).limit(1).findAny().get();
|
||||
} catch (NoSuchElementException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user