Beispiel #1
0
 @Override
 public String execute(Gameplay game, String[] parts) {
   return "Czas(dla twojej strefy): "
       + App.getApp()
           .getWorld()
           .getTimeMachine()
           .getString(game.getCharacter().getLocationCoordinates());
 }
Beispiel #2
0
 @Subscribe
 public void messageReceived(ReceivedTextFromUser evt) {
   if (state == State.LOGIN_PROMPT) {
     login = evt.getText();
     if (!login.isEmpty()) {
       if (login.equals("new") || login.equals("signup") || login.equals("sign up")) {
         ebus.unregister(this);
         ebus.register(new SignUpPanel(ebus));
       } else {
         try {
           if (App.getApp().getEntitiesManager().getUsersDao().queryForId(login) == null) {
             ebus.post(new SendTextToUser("Sorry. There is no such user.\nType your name: "));
           } else {
             ebus.post(new SendTextToUser("Hi, " + login + "! Type your password: "******"Could not check if user login is correct", ex);
           ebus.post(
               new SendTextToUser(
                   "Sorry, there was an error. We are unable to check your credintials. Please try again later or contact system administrator."));
         }
       }
     }
   } else if (state == State.PASSWORD_PROMPT) {
     try {
       User u = App.getApp().getEntitiesManager().getUsersDao().queryForId(login);
       if (u.isPasswordCorrect(evt.getText())) {
         ebus.unregister(this);
         ebus.register(new GlobalMenuPanel(ebus, u));
       } else {
         ebus.post(new SendTextToUser("Your password is incorrect. Please login once again."));
         state = State.LOGIN_PROMPT;
       }
     } catch (SQLException ex) {
       Logger.getLogger(LoginPanel.class.getName())
           .log(Level.SEVERE, "Could not check user password", ex);
       ebus.post(
           new SendTextToUser(
               "Sorry, there was an error. We are unable to check your credintials. Please try again later or contact system administrator."));
     }
   }
 }