#3629: Fix scoreboard team data reading

This commit is contained in:
Janmm14
2024-03-11 03:22:19 +00:00
committed by GitHub
parent 1b88a84710
commit 2394e204fa
2 changed files with 26 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
package net.md_5.bungee.protocol;
import java.util.function.Function;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -31,4 +32,26 @@ public final class Either<L, R>
{
return new Either<>( null, right );
}
public L getLeftOrCompute(Function<R, L> function)
{
if ( isLeft() )
{
return left;
} else
{
return function.apply( right );
}
}
public R getRightOrCompute(Function<L, R> function)
{
if ( isRight() )
{
return right;
} else
{
return function.apply( left );
}
}
}