Package net.bnubot.core.commands

Examples of net.bnubot.core.commands.NeverSeenUserException


        throw new InvalidUseException();
      params = param.split(" ", 2);

      BNetUser bnSubject = source.findUser(params[0], user);
      if(bnSubject == null)
        throw new NeverSeenUserException(params[0]);

      long duration;
      try {
        duration = TimeFormatter.parseDuration(params[1]);
      } catch(NumberFormatException e) {
View Full Code Here


      throw new CommandFailedWithDetailsException("You must have an account to use recruit.");

    BNetUser bnSubject = source.getCreateBNetUser(params[0], user);
    BNLogin rsSubject = BNLogin.get(bnSubject);
    if(rsSubject == null)
      throw new NeverSeenUserException(bnSubject);

    if(rsSubject.getAccount() != null)
      throw new CommandFailedWithDetailsException("That user already has an account!");

    String requiredTagPrefix = GlobalSettings.recruitTagPrefix;
View Full Code Here

      return subjectAccount;

    // The account does not exist
    BNLogin subject = BNLogin.get(bnSubject);
    if(subject == null)
      throw new NeverSeenUserException(bnSubject);

    return createAccount(accountName, createAccess, commanderAccount, subject);
  }
View Full Code Here

      if(rsSubjectAccount == null) {
        BNetUser bnSubject = source.getCreateBNetUser(params[0], user);

        BNLogin rsSubject = BNLogin.get(bnSubject);
        if(rsSubject == null)
          throw new NeverSeenUserException(bnSubject);

        rsSubjectAccount = rsSubject.getAccount();
        if(rsSubjectAccount == null)
          throw new CommandFailedWithDetailsException("User [" + rsSubject.getLogin() + "] has no account");
      }
View Full Code Here

    }

    BNetUser bnSubject = source.getCreateBNetUser(params[0], user);
    BNLogin rsSubject = BNLogin.get(bnSubject);
    if(rsSubject == null)
      throw new NeverSeenUserException(bnSubject);

    Account newAccount = null;
    if(params.length == 2) {
      newAccount = Account.get(params[1]);
      if(newAccount == null)
View Full Code Here

    if(rsSubjectAccount == null) {
      //They don't have an account by that name, check if it's a user
      BNetUser bnSubject = source.getCreateBNetUser(params[0], user);
      rsSubject = BNLogin.get(bnSubject);
      if(rsSubject == null)
        throw new NeverSeenUserException(bnSubject);
    } else {
      for(BNLogin login : rsSubjectAccount.getBnLogins()) {
        Date nt = login.getLastSeen();
        if((rsSubject == null)
        || ((nt != null) && (nt.compareTo(rsSubject.getLastSeen()) > 0)))
          rsSubject = login;
      }
      if(rsSubject == null)
        throw new NeverSeenUserException(rsSubjectAccount);
    }

    Date mostRecent = rsSubject.getLastSeen();
    String mostRecentAction = rsSubject.getLastAction();
    params[0] = new BNetUser(rsSubject.getLogin()).getShortLogonName(user);

    if(mostRecent == null)
      throw new NeverSeenUserException(params[0]);

    String diff = TimeFormatter.formatTime(System.currentTimeMillis() - mostRecent.getTime());
    diff = "User [" + params[0] + "] was last seen " + diff + " ago";
    if(mostRecentAction != null)
      diff += " " + mostRecentAction;
View Full Code Here

TOP

Related Classes of net.bnubot.core.commands.NeverSeenUserException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.