use of net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket in project SpongeCommon by SpongePowered.
the class ServerScoreboardMixin method bridge$addPlayer.
@Override
public void bridge$addPlayer(final ServerPlayer player, final boolean sendPackets) {
this.impl$players.add(player);
if (sendPackets) {
for (final PlayerTeam team : this.getPlayerTeams()) {
player.connection.send(new ClientboundSetPlayerTeamPacket(team, 0));
}
for (final net.minecraft.world.scores.Objective objective : this.getObjectives()) {
player.connection.send(new ClientboundSetObjectivePacket(objective, 0));
for (int i = 0; i < 19; ++i) {
if (this.getDisplayObjective(i) == objective) {
player.connection.send(new ClientboundSetDisplayObjectivePacket(i, objective));
}
}
for (final Score score : this.getPlayerScores(objective)) {
final ClientboundSetScorePacket packetIn = new ClientboundSetScorePacket(Method.CHANGE, score.getObjective().getName(), score.getOwner(), score.getScore());
player.connection.send(packetIn);
}
}
}
}
Aggregations