#3629: Fix scoreboard team data reading
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user