Various scoreboard improvements. (#2204)
- Correctly remove objectives that use heart type. - Also sends remove score packets on server switch. - Players are only removed if Team packet mode is 4.
This commit is contained in:
parent
017f3a2424
commit
2ae8ba0afc
@ -22,5 +22,5 @@ public class Objective
|
||||
/**
|
||||
* Type; integer or hearts
|
||||
*/
|
||||
private final String type;
|
||||
private String type;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import net.md_5.bungee.api.event.ServerConnectedEvent;
|
||||
import net.md_5.bungee.api.event.ServerKickEvent;
|
||||
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
||||
import net.md_5.bungee.api.score.Objective;
|
||||
import net.md_5.bungee.api.score.Score;
|
||||
import net.md_5.bungee.api.score.Scoreboard;
|
||||
import net.md_5.bungee.api.score.Team;
|
||||
import net.md_5.bungee.chat.ComponentSerializer;
|
||||
@ -37,6 +38,7 @@ import net.md_5.bungee.protocol.packet.LoginSuccess;
|
||||
import net.md_5.bungee.protocol.packet.PluginMessage;
|
||||
import net.md_5.bungee.protocol.packet.Respawn;
|
||||
import net.md_5.bungee.protocol.packet.ScoreboardObjective;
|
||||
import net.md_5.bungee.protocol.packet.ScoreboardScore;
|
||||
import net.md_5.bungee.protocol.packet.SetCompression;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@ -209,7 +211,11 @@ public class ServerConnector extends PacketHandler
|
||||
Scoreboard serverScoreboard = user.getServerSentScoreboard();
|
||||
for ( Objective objective : serverScoreboard.getObjectives() )
|
||||
{
|
||||
user.unsafe().sendPacket( new ScoreboardObjective( objective.getName(), objective.getValue(), "integer", (byte) 1 ) ); // TODO:
|
||||
user.unsafe().sendPacket( new ScoreboardObjective( objective.getName(), objective.getValue(), objective.getType(), (byte) 1 ) );
|
||||
}
|
||||
for ( Score score : serverScoreboard.getScores() )
|
||||
{
|
||||
user.unsafe().sendPacket( new ScoreboardScore( score.getItemName(), (byte) 1, score.getScoreName(), score.getValue() ) );
|
||||
}
|
||||
for ( Team team : serverScoreboard.getTeams() )
|
||||
{
|
||||
|
@ -135,6 +135,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
if ( oldObjective != null )
|
||||
{
|
||||
oldObjective.setValue( objective.getValue() );
|
||||
oldObjective.setType( objective.getType() );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -210,7 +211,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
if ( team.getMode() == 0 || team.getMode() == 3 )
|
||||
{
|
||||
t.addPlayer( s );
|
||||
} else
|
||||
} else if ( team.getMode() == 4 )
|
||||
{
|
||||
t.removePlayer( s );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user