/** Handler for the 'scoreboard teams option' command. */
  protected void setTeamOption(
      ICommandSender par1ICommandSender, String[] par2ArrayOfStr, int par3) {
    ScorePlayerTeam scoreplayerteam = this.getTeam(par2ArrayOfStr[par3++]);
    String s = par2ArrayOfStr[par3++].toLowerCase();

    if (!s.equalsIgnoreCase("color")
        && !s.equalsIgnoreCase("friendlyfire")
        && !s.equalsIgnoreCase("seeFriendlyInvisibles")) {
      throw new WrongUsageException("commands.scoreboard.teams.option.usage", new Object[0]);
    } else if (par2ArrayOfStr.length == 4) {
      if (s.equalsIgnoreCase("color")) {
        throw new WrongUsageException(
            "commands.scoreboard.teams.option.noValue",
            new Object[] {s, func_96333_a(EnumChatFormatting.func_96296_a(true, false))});
      } else if (!s.equalsIgnoreCase("friendlyfire")
          && !s.equalsIgnoreCase("seeFriendlyInvisibles")) {
        throw new WrongUsageException("commands.scoreboard.teams.option.usage", new Object[0]);
      } else {
        throw new WrongUsageException(
            "commands.scoreboard.teams.option.noValue",
            new Object[] {s, func_96333_a(Arrays.asList(new String[] {"true", "false"}))});
      }
    } else {
      String s1 = par2ArrayOfStr[par3++];

      if (s.equalsIgnoreCase("color")) {
        EnumChatFormatting enumchatformatting = EnumChatFormatting.func_96300_b(s1);

        if (s1 == null) {
          throw new WrongUsageException(
              "commands.scoreboard.teams.option.noValue",
              new Object[] {s, func_96333_a(EnumChatFormatting.func_96296_a(true, false))});
        }

        scoreplayerteam.setNamePrefix(enumchatformatting.toString());
        scoreplayerteam.setNameSuffix(EnumChatFormatting.RESET.toString());
      } else if (s.equalsIgnoreCase("friendlyfire")) {
        if (!s1.equalsIgnoreCase("true") && !s1.equalsIgnoreCase("false")) {
          throw new WrongUsageException(
              "commands.scoreboard.teams.option.noValue",
              new Object[] {s, func_96333_a(Arrays.asList(new String[] {"true", "false"}))});
        }

        scoreplayerteam.setAllowFriendlyFire(s1.equalsIgnoreCase("true"));
      } else if (s.equalsIgnoreCase("seeFriendlyInvisibles")) {
        if (!s1.equalsIgnoreCase("true") && !s1.equalsIgnoreCase("false")) {
          throw new WrongUsageException(
              "commands.scoreboard.teams.option.noValue",
              new Object[] {s, func_96333_a(Arrays.asList(new String[] {"true", "false"}))});
        }

        scoreplayerteam.setSeeFriendlyInvisiblesEnabled(s1.equalsIgnoreCase("true"));
      }

      notifyAdmins(
          par1ICommandSender,
          "commands.scoreboard.teams.option.success",
          new Object[] {s, scoreplayerteam.func_96661_b(), s1});
    }
  }
  /** Adds the strings available in this command to the given list of tab completion options. */
  public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) {
    if (par2ArrayOfStr.length == 1) {
      return getListOfStringsMatchingLastWord(
          par2ArrayOfStr, new String[] {"objectives", "players", "teams"});
    } else {
      if (par2ArrayOfStr[0].equalsIgnoreCase("objectives")) {
        if (par2ArrayOfStr.length == 2) {
          return getListOfStringsMatchingLastWord(
              par2ArrayOfStr, new String[] {"list", "add", "remove", "setdisplay"});
        }

        if (par2ArrayOfStr[1].equalsIgnoreCase("add")) {
          if (par2ArrayOfStr.length == 4) {
            return getListOfStringsFromIterableMatchingLastWord(
                par2ArrayOfStr, ScoreObjectiveCriteria.field_96643_a.keySet());
          }
        } else if (par2ArrayOfStr[1].equalsIgnoreCase("remove")) {
          if (par2ArrayOfStr.length == 3) {
            return getListOfStringsFromIterableMatchingLastWord(
                par2ArrayOfStr, this.getScoreObjectivesList(false));
          }
        } else if (par2ArrayOfStr[1].equalsIgnoreCase("setdisplay")) {
          if (par2ArrayOfStr.length == 3) {
            return getListOfStringsMatchingLastWord(
                par2ArrayOfStr, new String[] {"list", "sidebar", "belowName"});
          }

          if (par2ArrayOfStr.length == 4) {
            return getListOfStringsFromIterableMatchingLastWord(
                par2ArrayOfStr, this.getScoreObjectivesList(false));
          }
        }
      } else if (par2ArrayOfStr[0].equalsIgnoreCase("players")) {
        if (par2ArrayOfStr.length == 2) {
          return getListOfStringsMatchingLastWord(
              par2ArrayOfStr, new String[] {"set", "add", "remove", "reset", "list"});
        }

        if (!par2ArrayOfStr[1].equalsIgnoreCase("set")
            && !par2ArrayOfStr[1].equalsIgnoreCase("add")
            && !par2ArrayOfStr[1].equalsIgnoreCase("remove")) {
          if ((par2ArrayOfStr[1].equalsIgnoreCase("reset")
                  || par2ArrayOfStr[1].equalsIgnoreCase("list"))
              && par2ArrayOfStr.length == 3) {
            return getListOfStringsFromIterableMatchingLastWord(
                par2ArrayOfStr, this.getScoreboardFromWorldServer().getObjectiveNames());
          }
        } else {
          if (par2ArrayOfStr.length == 3) {
            return getListOfStringsMatchingLastWord(
                par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames());
          }

          if (par2ArrayOfStr.length == 4) {
            return getListOfStringsFromIterableMatchingLastWord(
                par2ArrayOfStr, this.getScoreObjectivesList(true));
          }
        }
      } else if (par2ArrayOfStr[0].equalsIgnoreCase("teams")) {
        if (par2ArrayOfStr.length == 2) {
          return getListOfStringsMatchingLastWord(
              par2ArrayOfStr,
              new String[] {"add", "remove", "join", "leave", "empty", "list", "option"});
        }

        if (par2ArrayOfStr[1].equalsIgnoreCase("join")) {
          if (par2ArrayOfStr.length == 3) {
            return getListOfStringsFromIterableMatchingLastWord(
                par2ArrayOfStr, this.getScoreboardFromWorldServer().func_96531_f());
          }

          if (par2ArrayOfStr.length >= 4) {
            return getListOfStringsMatchingLastWord(
                par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames());
          }
        } else {
          if (par2ArrayOfStr[1].equalsIgnoreCase("leave")) {
            return getListOfStringsMatchingLastWord(
                par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames());
          }

          if (!par2ArrayOfStr[1].equalsIgnoreCase("empty")
              && !par2ArrayOfStr[1].equalsIgnoreCase("list")
              && !par2ArrayOfStr[1].equalsIgnoreCase("remove")) {
            if (par2ArrayOfStr[1].equalsIgnoreCase("option")) {
              if (par2ArrayOfStr.length == 3) {
                return getListOfStringsFromIterableMatchingLastWord(
                    par2ArrayOfStr, this.getScoreboardFromWorldServer().func_96531_f());
              }

              if (par2ArrayOfStr.length == 4) {
                return getListOfStringsMatchingLastWord(
                    par2ArrayOfStr,
                    new String[] {"color", "friendlyfire", "seeFriendlyInvisibles"});
              }

              if (par2ArrayOfStr.length == 5) {
                if (par2ArrayOfStr[3].equalsIgnoreCase("color")) {
                  return getListOfStringsFromIterableMatchingLastWord(
                      par2ArrayOfStr, EnumChatFormatting.func_96296_a(true, false));
                }

                if (par2ArrayOfStr[3].equalsIgnoreCase("friendlyfire")
                    || par2ArrayOfStr[3].equalsIgnoreCase("seeFriendlyInvisibles")) {
                  return getListOfStringsMatchingLastWord(
                      par2ArrayOfStr, new String[] {"true", "false"});
                }
              }
            }
          } else if (par2ArrayOfStr.length == 3) {
            return getListOfStringsFromIterableMatchingLastWord(
                par2ArrayOfStr, this.getScoreboardFromWorldServer().func_96531_f());
          }
        }
      }

      return null;
    }
  }