Пример #1
0
 public boolean start(User aUser) throws MudException {
   Logger.getLogger("mmud").finer("theRegExpr=" + theRegExpr);
   aUser.setNow();
   String myregexpr = theRegExpr.replaceAll("%s", aUser.getName());
   boolean result = true;
   if (myregexpr.endsWith(".+") && getCommand().indexOf('\n') != -1) {
     String stuff = getCommand().substring(0, getCommand().indexOf('\n'));
     result = stuff.matches(myregexpr);
     Logger.getLogger("mmud").finer("returns case 1 " + result);
   } else {
     result = (getCommand().matches(myregexpr));
     Logger.getLogger("mmud").finer("returns case 2 " + result);
   }
   if (!result) {
     /** didn't match the case, exiting */
     return result;
   }
   /** continue with the actual command */
   return run(aUser);
 }
  @Override
  public boolean run(User aUser) throws MailException, MudException {
    Logger.getLogger("mmud").finer("");
    String[] myParsed = getParsedCommand();
    if (myParsed.length == 2) {
      try {
        theString = MailDb.deleteMail(aUser, Integer.parseInt(myParsed[1]));
        theString += aUser.printForm();
      } catch (NumberFormatException e) {
        Logger.getLogger("mmud").info("thrown: " + Constants.INVALIDMAILERROR);
        throw new InvalidMailException();
      }
      return true;
    }

    return false;
  }