Beispiel #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 Object parseValue(String value) throws Exception {
   /// Handle values for this option
   switch (this) {
     case HEALTHP:
     case HEALTH:
     case POOLMONEY:
     case WITHINDISTANCE:
     case MONEY:
       return Double.valueOf(value);
     case LEVELRANGE:
       return MinMax.valueOf(value);
     case DISGUISEALLAS:
       return value;
     case MAGIC:
     case MAGICP:
     case HUNGER:
     case EXPERIENCE:
     case INVULNERABLE:
       return Integer.valueOf(value);
     case FLIGHTSPEED:
       return Float.valueOf(value);
     case ENCHANTS:
       return EffectUtil.parseArg(value, 0, 120);
     case DOCOMMANDS:
       return value;
     case GIVECLASS:
       return ArenaClassController.getClass(value);
     case GAMEMODE:
       GameMode gm;
       try {
         gm = GameMode.getByValue(Integer.valueOf(value));
       } catch (Throwable e) {
         gm = GameMode.valueOf(value.toUpperCase());
       }
       return gm; // multiply by number of ticks per second
     default:
       break;
   }
   return null;
 }