use of net.minecraft.network.play.server.SPacketTeams in project Minecraft-SlientClient-Hack by YouNeverKnow00.
the class ServerScoreboard method addPlayerToTeam.
/**
* Adds a player to the given team
*/
public boolean addPlayerToTeam(String player, String newTeam) {
if (super.addPlayerToTeam(player, newTeam)) {
ScorePlayerTeam scoreplayerteam = this.getTeam(newTeam);
this.scoreboardMCServer.getPlayerList().sendPacketToAllPlayers(new SPacketTeams(scoreplayerteam, Arrays.asList(player), 3));
this.markSaveDataDirty();
return true;
} else {
return false;
}
}
use of net.minecraft.network.play.server.SPacketTeams in project Minecraft-SlientClient-Hack by YouNeverKnow00.
the class ServerScoreboard method broadcastTeamInfoUpdate.
/**
* This packet will notify the players that this team is updated
*/
public void broadcastTeamInfoUpdate(ScorePlayerTeam playerTeam) {
super.broadcastTeamInfoUpdate(playerTeam);
this.scoreboardMCServer.getPlayerList().sendPacketToAllPlayers(new SPacketTeams(playerTeam, 2));
this.markSaveDataDirty();
}
use of net.minecraft.network.play.server.SPacketTeams in project Magma by magmafoundation.
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;
Scoreboard oldboard = getPlayerBoard(player).getHandle();
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());
}
use of net.minecraft.network.play.server.SPacketTeams in project Minecraft-SlientClient-Hack by YouNeverKnow00.
the class ServerScoreboard method broadcastTeamRemove.
public void broadcastTeamRemove(ScorePlayerTeam playerTeam) {
super.broadcastTeamRemove(playerTeam);
this.scoreboardMCServer.getPlayerList().sendPacketToAllPlayers(new SPacketTeams(playerTeam, 1));
this.markSaveDataDirty();
}
use of net.minecraft.network.play.server.SPacketTeams in project Minecraft-SlientClient-Hack by YouNeverKnow00.
the class ServerScoreboard method removePlayerFromTeam.
/**
* Removes the given username from the given ScorePlayerTeam. If the player is not on the team then an
* IllegalStateException is thrown.
*/
public void removePlayerFromTeam(String username, ScorePlayerTeam playerTeam) {
super.removePlayerFromTeam(username, playerTeam);
this.scoreboardMCServer.getPlayerList().sendPacketToAllPlayers(new SPacketTeams(playerTeam, Arrays.asList(username), 4));
this.markSaveDataDirty();
}
Aggregations