mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Swap slow get method
This commit is contained in:
parent
d626c08b4c
commit
9fde237d9b
@ -30,7 +30,6 @@ import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
|||||||
import me.lucko.luckperms.utils.AbstractManager;
|
import me.lucko.luckperms.utils.AbstractManager;
|
||||||
import me.lucko.luckperms.utils.Identifiable;
|
import me.lucko.luckperms.utils.Identifiable;
|
||||||
|
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@ -44,13 +43,12 @@ public abstract class UserManager extends AbstractManager<UserIdentifier, User>
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
||||||
public User get(String name) {
|
public User get(String name) {
|
||||||
try {
|
for (User user : getAll().values()) {
|
||||||
return getAll().values().stream()
|
if (user.getName().equalsIgnoreCase(name)) {
|
||||||
.filter(u -> u.getName().equalsIgnoreCase(name))
|
return user;
|
||||||
.limit(1).findAny().get();
|
}
|
||||||
} catch (NoSuchElementException e) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User get(UUID uuid) {
|
public User get(UUID uuid) {
|
||||||
|
Loading…
Reference in New Issue
Block a user