playerList.add((String) this.data.get(i));
}
boolean previousData = SpaceRaceManager.getSpaceRaceFromID(teamID) != null;
SpaceRace newRace = new SpaceRace(playerList, teamName, flagData, teamColor);
if (teamID > 0)
{
newRace.setSpaceRaceID(teamID);
}
SpaceRaceManager.addSpaceRace(newRace);
if (previousData)
{
SpaceRaceManager.sendSpaceRaceData(null, SpaceRaceManager.getSpaceRaceFromPlayer(playerBase.getGameProfile().getName()));
}
break;
case S_REQUEST_FLAG_DATA:
SpaceRaceManager.sendSpaceRaceData(playerBase, SpaceRaceManager.getSpaceRaceFromPlayer((String) this.data.get(0)));
break;
case S_INVITE_RACE_PLAYER:
EntityPlayerMP playerInvited = PlayerUtil.getPlayerBaseServerFromPlayerUsername((String) this.data.get(0), true);
if (playerInvited != null)
{
Integer teamInvitedTo = (Integer) this.data.get(1);
SpaceRace race = SpaceRaceManager.getSpaceRaceFromID(teamInvitedTo);
if (race != null)
{
GCPlayerStats.get(playerInvited).spaceRaceInviteTeamID = teamInvitedTo;
String dA = EnumColor.DARK_AQUA.code;
String bG = EnumColor.BRIGHT_GREEN.code;
String dB = EnumColor.PURPLE.code;
String teamNameTotal = "";
String[] teamNameSplit = race.getTeamName().split(" ");
for (String teamNamePart : teamNameSplit)
{
teamNameTotal = teamNameTotal.concat(dB + teamNamePart + " ");
}
playerInvited.addChatMessage(new ChatComponentText(dA + GCCoreUtil.translateWithFormat("gui.spaceRace.chat.inviteReceived", bG + player.getGameProfile().getName() + dA) + " " + GCCoreUtil.translateWithFormat("gui.spaceRace.chat.toJoin", teamNameTotal, EnumColor.AQUA + "/joinrace" + dA)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_AQUA)));
}
}
break;
case S_REMOVE_RACE_PLAYER:
Integer teamInvitedTo = (Integer) this.data.get(1);
SpaceRace race = SpaceRaceManager.getSpaceRaceFromID(teamInvitedTo);
if (race != null)
{
String playerToRemove = (String) this.data.get(0);
if (!race.getPlayerNames().remove(playerToRemove))
{
player.addChatMessage(new ChatComponentText(GCCoreUtil.translateWithFormat("gui.spaceRace.chat.notFound", playerToRemove)));
}
else
{
SpaceRaceManager.onPlayerRemoval(playerToRemove, race);
}
}
break;
case S_ADD_RACE_PLAYER:
Integer teamToAddPlayer = (Integer) this.data.get(1);
SpaceRace spaceRaceToAddPlayer = SpaceRaceManager.getSpaceRaceFromID(teamToAddPlayer);
if (spaceRaceToAddPlayer != null)
{
String playerToAdd = (String) this.data.get(0);
if (!spaceRaceToAddPlayer.getPlayerNames().contains(playerToAdd))
{
SpaceRace oldRace = null;
while ((oldRace = SpaceRaceManager.getSpaceRaceFromPlayer(playerToAdd)) != null)
{
SpaceRaceManager.removeSpaceRace(oldRace);
}