mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-12-24 17:47:41 +01:00
#3629: Fix scoreboard team data reading
This commit is contained in:
parent
1b88a84710
commit
2394e204fa
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -267,9 +267,9 @@ public class DownstreamBridge extends PacketHandler
|
||||
{
|
||||
if ( team.getMode() == 0 || team.getMode() == 2 )
|
||||
{
|
||||
t.setDisplayName( ComponentSerializer.toString( team.getDisplayName() ) );
|
||||
t.setPrefix( ComponentSerializer.toString( team.getPrefix() ) );
|
||||
t.setSuffix( ComponentSerializer.toString( team.getSuffix() ) );
|
||||
t.setDisplayName( team.getDisplayName().getLeftOrCompute( ComponentSerializer::toString ) );
|
||||
t.setPrefix( team.getPrefix().getLeftOrCompute( ComponentSerializer::toString ) );
|
||||
t.setSuffix( team.getSuffix().getLeftOrCompute( ComponentSerializer::toString ) );
|
||||
t.setFriendlyFire( team.getFriendlyFire() );
|
||||
t.setNameTagVisibility( team.getNameTagVisibility() );
|
||||
t.setCollisionRule( team.getCollisionRule() );
|
||||
|
Loading…
Reference in New Issue
Block a user