mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-15 20:51:34 +01:00
Upate getInstance(UUID) to return nullable instance
This commit is contained in:
parent
6807217608
commit
d733dbbc3f
@ -161,11 +161,12 @@ public final class InstanceManager {
|
||||
* @return {@link Optional#empty()} if instance is not found
|
||||
*/
|
||||
@NotNull
|
||||
public Optional<Instance> getInstance(UUID uuid) {
|
||||
return getInstances()
|
||||
.stream()
|
||||
.filter(instance -> instance.getUniqueId().equals(uuid))
|
||||
.findFirst();
|
||||
public @Nullable Instance getInstance(UUID uuid) {
|
||||
Optional<Instance> instance = getInstances()
|
||||
.stream()
|
||||
.filter(someInstance -> someInstance.getUniqueId().equals(uuid))
|
||||
.findFirst();
|
||||
return instance.orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user