Example #1
0
 public static Object getValue(GameOption go, String value) {
   switch (go) {
     case TEAMSIZE:
     case NTEAMS:
       return MinMax.valueOf(value);
     case VICTORYTIME:
     case PRESTARTTIME:
     case MATCHTIME:
     case FORCESTARTTIME:
     case NLIVES:
     case NCUMONCURRENTCOMPETITIONS:
     case ALLOWEDTEAMSIZEDIFFERENCE:
       return ConfigSerializer.toPositiveSize(value, -1);
     case PREFIX:
     case COMMAND:
       return value;
     case VICTORYCONDITION:
       return VictoryType.fromString(value);
     case CANCELIFNOTENOUGHPLAYERS:
     case CLOSEWAITROOMWHILERUNNING:
     case RATED:
       return Boolean.valueOf(value);
     default:
       break;
   }
   return null;
 }
 public MatchParams loadParams(String node) {
   BaseConfig bc = new BaseConfig(new File("test_files/competitions/" + node + "Config.yml"));
   //		ConfigurationSection cs = bc.getConfigurationSection(node);
   MatchParams mp = null;
   try {
     ConfigSerializer config = new ConfigSerializer(plugin, bc.getFile(), node);
     mp = config.loadMatchParams();
     //			mp = ConfigSerializer.setTypeConfig(plugin, "arena", cs);
   } catch (ConfigException e) {
     e.printStackTrace();
     fail();
   } catch (InvalidOptionException e) {
     e.printStackTrace();
     fail();
   }
   return mp;
 }