| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public boolean parse(GameMode gameMode, String value, URI source) |
| 46 | { |
| 47 | final StringTokenizer aTok = new StringTokenizer(value, Constants.PIPE, false); |
| 48 | |
| 49 | if (aTok.countTokens() < 2) |
| 50 | { |
| 51 | Logging.log(Logging.LST_ERROR, |
| 52 | getTokenName() + " expecting '|', format is: " + "EquipType|IconPath was: " + value); |
| 53 | return false; |
| 54 | } |
| 55 | |
| 56 | if (aTok.countTokens() > 3) |
| 57 | { |
| 58 | Logging.log(Logging.LST_ERROR, |
| 59 | getTokenName() + " too many '|', format is: " + "EquipType|IconPath|Priority was: " + value); |
| 60 | return false; |
| 61 | } |
| 62 | |
| 63 | final String equipType = aTok.nextToken(); |
| 64 | final String iconPath = aTok.nextToken(); |
| 65 | int priority = 10; |
| 66 | if (aTok.hasMoreElements()) |
| 67 | { |
| 68 | String priorityToken = aTok.nextToken(); |
| 69 | try |
| 70 | { |
| 71 | priority = Integer.parseInt(priorityToken); |
| 72 | } |
| 73 | catch (NumberFormatException ex) |
| 74 | { |
| 75 | Logging.log(Logging.LST_ERROR, |
| 76 | getTokenName() + " expected an integer priority . Found: " + priorityToken + " in " + value); |
| 77 | return false; |
| 78 | } |
| 79 | |
| 80 | } |
| 81 | |
| 82 | gameMode.setEquipTypeIcon(equipType.intern(), iconPath.intern(), priority); |
| 83 | return true; |
| 84 | } |
| 85 | |
| 86 | } |