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
|
* @return {@link Optional#empty()} if instance is not found
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public Optional<Instance> getInstance(UUID uuid) {
|
public @Nullable Instance getInstance(UUID uuid) {
|
||||||
return getInstances()
|
Optional<Instance> instance = getInstances()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(instance -> instance.getUniqueId().equals(uuid))
|
.filter(someInstance -> someInstance.getUniqueId().equals(uuid))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
return instance.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user