Search in sources :

Example 1 with SPacketTeams

use of net.minecraft.network.play.server.SPacketTeams in project CumServerPro by MCUmbrella.

the class ServerScoreboard method addPlayerToTeam.

public boolean addPlayerToTeam(String player, String newTeam) {
    if (super.addPlayerToTeam(player, newTeam)) {
        ScorePlayerTeam scoreplayerteam = this.getTeam(newTeam);
        this.sendAll(new SPacketTeams(scoreplayerteam, Arrays.asList(player), 3));
        this.markSaveDataDirty();
        return true;
    } else {
        return false;
    }
}
Also used : SPacketTeams(net.minecraft.network.play.server.SPacketTeams)

Example 2 with SPacketTeams

use of net.minecraft.network.play.server.SPacketTeams in project CumServerPro by MCUmbrella.

the class ServerScoreboard method broadcastTeamRemove.

public void broadcastTeamRemove(ScorePlayerTeam playerTeam) {
    super.broadcastTeamRemove(playerTeam);
    this.sendAll(new SPacketTeams(playerTeam, 1));
    this.markSaveDataDirty();
}
Also used : SPacketTeams(net.minecraft.network.play.server.SPacketTeams)

Example 3 with SPacketTeams

use of net.minecraft.network.play.server.SPacketTeams in project CumServerPro by MCUmbrella.

the class ServerScoreboard method broadcastTeamInfoUpdate.

public void broadcastTeamInfoUpdate(ScorePlayerTeam playerTeam) {
    super.broadcastTeamInfoUpdate(playerTeam);
    this.sendAll(new SPacketTeams(playerTeam, 2));
    this.markSaveDataDirty();
}
Also used : SPacketTeams(net.minecraft.network.play.server.SPacketTeams)

Example 4 with SPacketTeams

use of net.minecraft.network.play.server.SPacketTeams in project CumServerPro by MCUmbrella.

the class CraftScoreboardManager method setPlayerBoard.

// CraftBukkit method
public void setPlayerBoard(CraftPlayer player, org.bukkit.scoreboard.Scoreboard bukkitScoreboard) throws IllegalArgumentException {
    Validate.isTrue(bukkitScoreboard instanceof CraftScoreboard, "Cannot set player scoreboard to an unregistered Scoreboard");
    CraftScoreboard scoreboard = (CraftScoreboard) bukkitScoreboard;
    net.minecraft.scoreboard.Scoreboard oldboard = getPlayerBoard(player).getHandle();
    net.minecraft.scoreboard.Scoreboard newboard = scoreboard.getHandle();
    EntityPlayerMP entityplayer = player.getHandle();
    if (oldboard == newboard) {
        return;
    }
    if (scoreboard == mainScoreboard) {
        playerBoards.remove(player);
    } else {
        playerBoards.put(player, (CraftScoreboard) scoreboard);
    }
    // Old objective tracking
    HashSet<ScoreObjective> removed = new HashSet<ScoreObjective>();
    for (int i = 0; i < 3; ++i) {
        ScoreObjective scoreboardobjective = oldboard.getObjectiveInDisplaySlot(i);
        if (scoreboardobjective != null && !removed.contains(scoreboardobjective)) {
            entityplayer.connection.sendPacket(new SPacketScoreboardObjective(scoreboardobjective, 1));
            removed.add(scoreboardobjective);
        }
    }
    // Old team tracking
    Iterator<?> iterator = oldboard.getTeams().iterator();
    while (iterator.hasNext()) {
        ScorePlayerTeam scoreboardteam = (ScorePlayerTeam) iterator.next();
        entityplayer.connection.sendPacket(new SPacketTeams(scoreboardteam, 1));
    }
    // The above is the reverse of the below method.
    server.getPlayerList().sendScoreboard((ServerScoreboard) newboard, player.getHandle());
}
Also used : ScoreObjective(net.minecraft.scoreboard.ScoreObjective) SPacketTeams(net.minecraft.network.play.server.SPacketTeams) SPacketScoreboardObjective(net.minecraft.network.play.server.SPacketScoreboardObjective) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ScorePlayerTeam(net.minecraft.scoreboard.ScorePlayerTeam) Scoreboard(net.minecraft.scoreboard.Scoreboard) HashSet(java.util.HashSet)

Example 5 with SPacketTeams

use of net.minecraft.network.play.server.SPacketTeams in project Minecraft-SlientClient-Hack by YouNeverKnow00.

the class ServerScoreboard method broadcastTeamCreated.

/**
 * This packet will notify the players that this team is created, and that will register it on the client
 */
public void broadcastTeamCreated(ScorePlayerTeam playerTeam) {
    super.broadcastTeamCreated(playerTeam);
    this.scoreboardMCServer.getPlayerList().sendPacketToAllPlayers(new SPacketTeams(playerTeam, 0));
    this.markSaveDataDirty();
}
Also used : SPacketTeams(net.minecraft.network.play.server.SPacketTeams)

Aggregations

SPacketTeams (net.minecraft.network.play.server.SPacketTeams)12 HashSet (java.util.HashSet)2 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)2 SPacketScoreboardObjective (net.minecraft.network.play.server.SPacketScoreboardObjective)2 ScoreObjective (net.minecraft.scoreboard.ScoreObjective)2 ScorePlayerTeam (net.minecraft.scoreboard.ScorePlayerTeam)2 Scoreboard (net.minecraft.scoreboard.Scoreboard)2 ServerScoreboard (net.minecraft.scoreboard.ServerScoreboard)1