protected void sendScoreboard(ServerScoreboard scoreboardIn, EntityPlayerMP playerIn) { Set<ScoreObjective> set = Sets.<ScoreObjective>newHashSet(); for (ScorePlayerTeam scoreplayerteam : scoreboardIn.getTeams()) { playerIn.playerNetServerHandler.sendPacket(new S3EPacketTeams(scoreplayerteam, 0)); } for (int i = 0; i < 19; ++i) { ScoreObjective scoreobjective = scoreboardIn.getObjectiveInDisplaySlot(i); if (scoreobjective != null && !set.contains(scoreobjective)) { for (Packet packet : scoreboardIn.func_96550_d(scoreobjective)) { playerIn.playerNetServerHandler.sendPacket(packet); } set.add(scoreobjective); } } }
public void update(){ int flags = 0; if(this.friendlyFire) flags |= 0x1; if(this.friendlyInvisiblesVisible) flags |= 0x2; //TODO: visibility? S3EPacketTeams packet = new S3EPacketTeams(); packet.field_149320_a = this.id; packet.field_149318_b = this.displayName; packet.field_149319_c = this.prefix; packet.field_149316_d = this.suffix; packet.field_149317_e = getPlayerNames(); packet.field_149314_f = 2; //Update packet.field_149315_g = flags; manager.sendPacket(packet); }
/** * 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.getConfigurationManager().sendPacketToAllPlayers(new S3EPacketTeams(scoreplayerteam, Arrays.asList(new String[] {player}), 3)); this.func_96551_b(); return true; } else { return false; } }
/** * 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 p_96512_1_, ScorePlayerTeam p_96512_2_) { super.removePlayerFromTeam(p_96512_1_, p_96512_2_); this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3EPacketTeams(p_96512_2_, Arrays.asList(new String[] {p_96512_1_}), 4)); this.func_96551_b(); }
/** * 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.getConfigurationManager().sendPacketToAllPlayers(new S3EPacketTeams(playerTeam, 0)); this.func_96551_b(); }
/** * This packet will notify the players that this team is updated */ public void sendTeamUpdate(ScorePlayerTeam playerTeam) { super.sendTeamUpdate(playerTeam); this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3EPacketTeams(playerTeam, 2)); this.func_96551_b(); }
protected void func_96456_a(ServerScoreboard par1ServerScoreboard, EntityPlayerMP par2EntityPlayerMP) { HashSet var3 = new HashSet(); Iterator var4 = par1ServerScoreboard.getTeams().iterator(); while (var4.hasNext()) { ScorePlayerTeam var5 = (ScorePlayerTeam)var4.next(); par2EntityPlayerMP.playerNetServerHandler.sendPacket(new S3EPacketTeams(var5, 0)); } for (int var9 = 0; var9 < 3; ++var9) { ScoreObjective var10 = par1ServerScoreboard.func_96539_a(var9); if (var10 != null && !var3.contains(var10)) { List var6 = par1ServerScoreboard.func_96550_d(var10); Iterator var7 = var6.iterator(); while (var7.hasNext()) { Packet var8 = (Packet)var7.next(); par2EntityPlayerMP.playerNetServerHandler.sendPacket(var8); } var3.add(var10); } } }
public boolean func_151392_a(String p_151392_1_, String p_151392_2_) { if (super.func_151392_a(p_151392_1_, p_151392_2_)) { ScorePlayerTeam var3 = this.getTeam(p_151392_2_); this.scoreboardMCServer.getConfigurationManager().func_148540_a(new S3EPacketTeams(var3, Arrays.asList(new String[] {p_151392_1_}), 3)); this.func_96551_b(); return true; } else { return false; } }
/** * 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 par1Str, ScorePlayerTeam par2ScorePlayerTeam) { super.removePlayerFromTeam(par1Str, par2ScorePlayerTeam); this.scoreboardMCServer.getConfigurationManager().func_148540_a(new S3EPacketTeams(par2ScorePlayerTeam, Arrays.asList(new String[] {par1Str}), 4)); this.func_96551_b(); }
public void func_96456_a(ServerScoreboard p_96456_1_, EntityPlayerMP p_96456_2_) // CraftBukkit - protected -> public { HashSet hashset = new HashSet(); Iterator iterator = p_96456_1_.getTeams().iterator(); while (iterator.hasNext()) { ScorePlayerTeam scoreplayerteam = (ScorePlayerTeam)iterator.next(); p_96456_2_.playerNetServerHandler.sendPacket(new S3EPacketTeams(scoreplayerteam, 0)); } for (int i = 0; i < 3; ++i) { ScoreObjective scoreobjective = p_96456_1_.func_96539_a(i); if (scoreobjective != null && !hashset.contains(scoreobjective)) { List list = p_96456_1_.func_96550_d(scoreobjective); Iterator iterator1 = list.iterator(); while (iterator1.hasNext()) { Packet packet = (Packet)iterator1.next(); p_96456_2_.playerNetServerHandler.sendPacket(packet); } hashset.add(scoreobjective); } } }
public boolean func_151392_a(String p_151392_1_, String p_151392_2_) { if (super.func_151392_a(p_151392_1_, p_151392_2_)) { ScorePlayerTeam scoreplayerteam = this.getTeam(p_151392_2_); this.sendAll(new S3EPacketTeams(scoreplayerteam, Arrays.asList(new String[] { p_151392_1_}), 3)); // CraftBukkit - Internal packet method this.func_96551_b(); return true; } else { return false; } }
protected void func_96456_a(ServerScoreboard p_96456_1_, EntityPlayerMP p_96456_2_) { HashSet hashset = new HashSet(); Iterator iterator = p_96456_1_.getTeams().iterator(); while (iterator.hasNext()) { ScorePlayerTeam scoreplayerteam = (ScorePlayerTeam)iterator.next(); p_96456_2_.playerNetServerHandler.sendPacket(new S3EPacketTeams(scoreplayerteam, 0)); } for (int i = 0; i < 3; ++i) { ScoreObjective scoreobjective = p_96456_1_.func_96539_a(i); if (scoreobjective != null && !hashset.contains(scoreobjective)) { List list = p_96456_1_.func_96550_d(scoreobjective); Iterator iterator1 = list.iterator(); while (iterator1.hasNext()) { Packet packet = (Packet)iterator1.next(); p_96456_2_.playerNetServerHandler.sendPacket(packet); } hashset.add(scoreobjective); } } }
public boolean func_151392_a(String p_151392_1_, String p_151392_2_) { if (super.func_151392_a(p_151392_1_, p_151392_2_)) { ScorePlayerTeam scoreplayerteam = this.getTeam(p_151392_2_); this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3EPacketTeams(scoreplayerteam, Arrays.asList(new String[] {p_151392_1_}), 3)); this.func_96551_b(); return true; } else { return false; } }
@Override public boolean addPlayer(Player player) { Checks.notNull(player, "player may not be null"); if(players.add(player)){ S3EPacketTeams packet = new S3EPacketTeams(); packet.field_149320_a = id; packet.field_149317_e = getPlayerNames(); packet.field_149314_f = 3; //Add Player manager.sendPacket(packet); return true; }else{ return false; } }
@Override public boolean removePlayer(Player player) { Checks.notNull(player, "player may not be null"); if(players.remove(player)){ S3EPacketTeams packet = new S3EPacketTeams(); packet.field_149320_a = id; packet.field_149317_e = getPlayerNames(); packet.field_149314_f = 4; //Remove Player manager.sendPacket(packet); return true; }else{ return false; } }
@Nonnull @Override public ScoreboardTeam getOrCreateTeam(@Nonnull String id) { Checks.notNull(id, "Id may not be null"); NailedScoreboardTeam team = teamsById.get(id); if(team == null){ team = new NailedScoreboardTeam(id, this); this.teamsById.put(id, team); this.teams.add(team); int flags = 0; if(team.isFriendlyFire()) flags |= 0x1; if(team.areFriendlyInvisiblesInvisible()) flags |= 0x2; //TODO: visibility S3EPacketTeams packet = new S3EPacketTeams(); packet.field_149320_a = team.getId(); packet.field_149318_b = team.getDisplayName(); packet.field_149319_c = team.getPrefix(); packet.field_149316_d = team.getSuffix(); packet.field_149317_e = ImmutableList.of(); packet.field_149314_f = 0; //Create packet.field_149315_g = flags; this.sendPacket(packet); } return team; }
public void func_96513_c(ScorePlayerTeam playerTeam) { super.func_96513_c(playerTeam); this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3EPacketTeams(playerTeam, 1)); this.func_96551_b(); }
/** * Updates a team managed by the scoreboard: Create/Remove the team registration, Register/Remove the player-team- * memberships, Set team displayname/prefix/suffix and/or whether friendly fire is enabled */ public void handleTeams(S3EPacketTeams packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Scoreboard scoreboard = this.clientWorldController.getScoreboard(); ScorePlayerTeam scoreplayerteam; if (packetIn.func_149307_h() == 0) { scoreplayerteam = scoreboard.createTeam(packetIn.func_149312_c()); } else { scoreplayerteam = scoreboard.getTeam(packetIn.func_149312_c()); } if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 2) { scoreplayerteam.setTeamName(packetIn.func_149306_d()); scoreplayerteam.setNamePrefix(packetIn.func_149311_e()); scoreplayerteam.setNameSuffix(packetIn.func_149309_f()); scoreplayerteam.setChatFormat(EnumChatFormatting.func_175744_a(packetIn.func_179813_h())); scoreplayerteam.func_98298_a(packetIn.func_149308_i()); Team.EnumVisible team$enumvisible = Team.EnumVisible.func_178824_a(packetIn.func_179814_i()); if (team$enumvisible != null) { scoreplayerteam.setNameTagVisibility(team$enumvisible); } } if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 3) { for (String s : packetIn.func_149310_g()) { scoreboard.addPlayerToTeam(s, packetIn.func_149312_c()); } } if (packetIn.func_149307_h() == 4) { for (String s1 : packetIn.func_149310_g()) { scoreboard.removePlayerFromTeam(s1, scoreplayerteam); } } if (packetIn.func_149307_h() == 1) { scoreboard.removeTeam(scoreplayerteam); } }
/** * Updates a team managed by the scoreboard: Create/Remove the team * registration, Register/Remove the player-team- memberships, Set team * displayname/prefix/suffix and/or whether friendly fire is enabled */ public void handleTeams(S3EPacketTeams packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Scoreboard scoreboard = this.clientWorldController.getScoreboard(); ScorePlayerTeam scoreplayerteam; if (packetIn.func_149307_h() == 0) { scoreplayerteam = scoreboard.createTeam(packetIn.func_149312_c()); } else { scoreplayerteam = scoreboard.getTeam(packetIn.func_149312_c()); } if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 2) { scoreplayerteam.setTeamName(packetIn.func_149306_d()); scoreplayerteam.setNamePrefix(packetIn.func_149311_e()); scoreplayerteam.setNameSuffix(packetIn.func_149309_f()); scoreplayerteam.setChatFormat(EnumChatFormatting.func_175744_a(packetIn.func_179813_h())); scoreplayerteam.func_98298_a(packetIn.func_149308_i()); Team.EnumVisible team$enumvisible = Team.EnumVisible.func_178824_a(packetIn.func_179814_i()); if (team$enumvisible != null) { scoreplayerteam.setNameTagVisibility(team$enumvisible); } } if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 3) { for (String s : packetIn.func_149310_g()) { scoreboard.addPlayerToTeam(s, packetIn.func_149312_c()); } } if (packetIn.func_149307_h() == 4) { for (String s1 : packetIn.func_149310_g()) { scoreboard.removePlayerFromTeam(s1, scoreplayerteam); } } if (packetIn.func_149307_h() == 1) { scoreboard.removeTeam(scoreplayerteam); } }
/** * Updates a team managed by the scoreboard: Create/Remove the team registration, Register/Remove the player-team- * memberships, Set team displayname/prefix/suffix and/or whether friendly fire is enabled */ public void handleTeams(S3EPacketTeams p_147247_1_) { Scoreboard var2 = this.clientWorldController.getScoreboard(); ScorePlayerTeam var3; if (p_147247_1_.func_149307_h() == 0) { var3 = var2.createTeam(p_147247_1_.func_149312_c()); } else { var3 = var2.getTeam(p_147247_1_.func_149312_c()); } if (p_147247_1_.func_149307_h() == 0 || p_147247_1_.func_149307_h() == 2) { var3.setTeamName(p_147247_1_.func_149306_d()); var3.setNamePrefix(p_147247_1_.func_149311_e()); var3.setNameSuffix(p_147247_1_.func_149309_f()); var3.func_98298_a(p_147247_1_.func_149308_i()); } Iterator var4; String var5; if (p_147247_1_.func_149307_h() == 0 || p_147247_1_.func_149307_h() == 3) { var4 = p_147247_1_.func_149310_g().iterator(); while (var4.hasNext()) { var5 = (String)var4.next(); var2.func_151392_a(var5, p_147247_1_.func_149312_c()); } } if (p_147247_1_.func_149307_h() == 4) { var4 = p_147247_1_.func_149310_g().iterator(); while (var4.hasNext()) { var5 = (String)var4.next(); var2.removePlayerFromTeam(var5, var3); } } if (p_147247_1_.func_149307_h() == 1) { var2.removeTeam(var3); } }