Пример #1
0
  @Override
  public Flag<?> transform(String argument) throws TransformException {
    Flag<?> flag = null;

    for (Flag<?> f : FlagType.getFlagList()) {
      if (flag != null) {
        break;
      }

      if (f.getName().equalsIgnoreCase(argument)) {
        flag = f;
        break;
      } else {
        // Check the aliases
        String[] aliases = f.getAliases();
        if (aliases == null) // Aliases null, continue
        continue;

        for (String alias : aliases) {
          if (alias.equalsIgnoreCase(argument)) {
            flag = f;
            break;
          }
        }
      }
    }

    if (flag == null) {
      throw new TransformException();
    }

    return flag;
  }
Пример #2
0
	private String getFriendlyFlagInfo(Game game) {
		Map<Flag<?>, Object> flags = game.getFlags();
		String[] info = new String[flags.size()];
		
		int i = 0;
		for (Flag<?> flag : flags.keySet()) {
			info[i] = flag.toInfo(flags.get(flag));
			i++;
		}
		
		return Util.toFriendlyString(info, ", ");
	}