public int getMaxPlayerCount() { int i = 0; for (TeamInfo ti : teams) { i += ti.getMaxPlayerCount(); } return i; }
public String getCreate() { return "create table " + getTableName() + " (" + _ID + " integer primary key autoincrement, " + RacerClubInfo_ID + " integer references " + RacerClubInfo.Instance().getTableName() + "(" + RacerClubInfo._ID + ") null, " + TeamInfo_ID + " integer references " + TeamInfo.Instance().getTableName() + "(" + TeamInfo._ID + ") null, " + Race_ID + " integer references " + Race.Instance().getTableName() + "(" + Race._ID + ") not null, " + StartOrder + " integer not null," + StartTimeOffset + " integer not null," + StartTime + " integer null," + EndTime + " integer null," + ElapsedTime + " integer null," + OverallPlacing + " integer null," + CategoryPlacing + " integer null," + Points + " integer not null," + PrimePoints + " integer not null," + IsSynced + " integer not null" + ");"; }
@Override public IMessage onMessage(GenericMessage message, MessageContext ctx) { String msg = message.getMessage(); String args[] = StringUtils.split(msg, "|"); int length = args.length; if (args[0].equals("match")) { if (length == 3) { if (args[2].equalsIgnoreCase("init")) { TeamInfo.worldName = args[1]; TeamInfo.leftTeamName = "Left"; TeamInfo.rightTeamName = "Right"; // TeamInfo.objectives.clear(); TeamInfo.rightObjectives.clear(); TeamInfo.leftObjectives.clear(); TeamInfo.leftTeamPlayers.clear(); TeamInfo.rightTeamPlayers.clear(); TeamInfo.playerDeaths.clear(); TeamInfo.playerKills.clear(); TeamInfo.playerHealth.clear(); TeamInfo.resetPlayerHP(); TeamInfo.resetPlayerHP(); TeamInfo.startTimestampTimer(); } else if (args[2].equalsIgnoreCase("start")) { TeamInfo.resetPlayerHP(); } } else if (length == 4) { if (args[1].equalsIgnoreCase("map")) { TeamInfo.mapName = args[3]; } else if (args[2].equalsIgnoreCase("time")) { String timedata[] = StringUtils.split(args[3], ","); TeamInfo.matchTime[0] = Integer.parseInt(timedata[0]); TeamInfo.matchTime[1] = Integer.parseInt(timedata[1]); TeamInfo.matchTime[2] = Integer.parseInt(timedata[2]); } else if (args[2].equalsIgnoreCase("countdown")) { // ARSpec.titleCommand(args[3]); } } } else if (args[0].equalsIgnoreCase("team")) { String teamstring = args[1]; boolean team = TeamInfo.getTeamLeft(teamstring); if (length == 4) { if (args[2].equalsIgnoreCase("name")) { if (team) { TeamInfo.leftTeamName = args[3]; } else { TeamInfo.rightTeamName = args[3]; } } else if (args[2].equalsIgnoreCase("color")) { if (team) { TeamInfo.leftTeamColor = args[3]; } else { TeamInfo.rightTeamColor = args[3]; } } else if (args[2].equalsIgnoreCase("player")) { String mod = args[3].substring(0, 1); if (mod.equals("+")) { String player = StringUtils.replace(args[3], "+", ""); if (TeamInfo.playerInMatch(player) != true) { if (team) { TeamInfo.leftTeamPlayers.add(player); } else { TeamInfo.rightTeamPlayers.add(player); } TeamInfo.playerHealth.put(player, 0); TeamInfo.playerKills.put(player, 0); TeamInfo.playerDeaths.put(player, 0); TeamInfo.playerAcc.put(player, 0); TeamInfo.playerTakenDamage.put(player, 0); } } else if (mod.equals("-")) { String player = StringUtils.replace(args[3], "-", ""); if (team) { TeamInfo.leftTeamPlayers.remove(player); } else { TeamInfo.rightTeamPlayers.remove(player); } } } else if (args[2].equalsIgnoreCase("goal")) { String mod = args[3].substring(0, 1); String block = StringUtils.replace(args[3], "+", ""); // System.out.println(team); // System.out.println(mod.equals("+")); if (mod.equals("+")) { if (team) { if (TeamInfo.leftObjectives.contains(block) == false) { TeamInfo.leftObjectives.add(block); } } else { if (TeamInfo.rightObjectives.contains(block) == false) { TeamInfo.rightObjectives.add(block); } } } else { if (team) { if (TeamInfo.leftObjectives.contains(block) == true) { TeamInfo.leftObjectives.remove(block); } } else { if (TeamInfo.rightObjectives.contains(block) == true) { TeamInfo.rightObjectives.remove(block); } } } } } else if (length == 5) { if (args[2].equalsIgnoreCase("state")) { TeamInfo.ObjectiveStatus obj = TeamInfo.ObjectiveStatus.NONE; if (args[4].equalsIgnoreCase("none")) { obj = TeamInfo.ObjectiveStatus.NONE; } else if (args[4].equalsIgnoreCase("found")) { obj = TeamInfo.ObjectiveStatus.FOUND; } else if (args[4].equalsIgnoreCase("carry")) { obj = TeamInfo.ObjectiveStatus.CARRY; } else if (args[4].equalsIgnoreCase("vm")) { obj = TeamInfo.ObjectiveStatus.VM; } else if (args[4].equalsIgnoreCase("target")) { obj = TeamInfo.ObjectiveStatus.VM; } if (team) { TeamInfo.leftTeamObjectiveState.put(args[3], obj); } else { TeamInfo.rightTeamObjectiveState.put(args[3], obj); } } } } else if (args[0].equalsIgnoreCase("player")) { String player = args[1]; // String arg = args[2]; // String val = args[3]; if (length == 4) { String arg = args[2]; String val = args[3]; if (arg.equalsIgnoreCase("hp")) { int intval = Integer.parseInt(val); TeamInfo.playerHealth.put(player, intval); } else if (arg.equalsIgnoreCase("hunger")) { int intval = Integer.parseInt(val); TeamInfo.playerHunger.put(player, intval); } else if (arg.equalsIgnoreCase("kills")) { int intval = Integer.parseInt(val); TeamInfo.playerKills.put(player, intval); } else if (arg.equalsIgnoreCase("deaths")) { int intval = Integer.parseInt(val); TeamInfo.playerDeaths.put(player, intval); } else if (arg.equalsIgnoreCase("accuracy")) { int intval = Integer.parseInt(val); TeamInfo.playerAcc.put(player, intval); } } } System.out.println(msg); return message; }
@Bean TeamInfo teamInfo() { return TeamInfo.teamInfo("Test Team", "*****@*****.**", "*****@*****.**"); }