Examples of GetPostmanMessagesCommand


Examples of games.stendhal.server.core.engine.dbcommand.GetPostmanMessagesCommand

  private static final Logger LOGGER = Logger.getLogger(ReadPostmanMessages.class);
 
  private ResultHandle handle = new ResultHandle();
 
  public void readMessages(final Player player) {
    DBCommand command = new GetPostmanMessagesCommand(player);
    DBCommandQueue.get().enqueueAndAwaitResult(command, handle);
    // wait one turn so that the messages come after any login messages
    TurnNotifier.get().notifyInTurns(1, new TurnListenerDecorator(this));
  }
View Full Code Here

Examples of games.stendhal.server.core.engine.dbcommand.GetPostmanMessagesCommand

   * Completes handling the get messages action.
   *
   * @param currentTurn ignored
   */
  public void onTurnReached(int currentTurn) {
    GetPostmanMessagesCommand command = DBCommandQueue.get().getOneResult(GetPostmanMessagesCommand.class, handle);
   
    if (command == null) {
      TurnNotifier.get().notifyInTurns(0, new TurnListenerDecorator(this));
      return;
    }

    List<ChatMessage> messages = command.getMessages();
    Player player = command.getPlayer();
    LOGGER.debug(messages.size()+ " messages left for " + player.getName());
    for (ChatMessage chatmessage : messages) {
      LOGGER.debug(player.getName() + " got message: " + chatmessage.toString());
      // set the date to 'unknown' if the message was sent on a specific hard coded date which we will use for the old messages from xml
      player.sendPrivateText(getNotificationType(chatmessage.getMessagetype()), "postman tells you: " + chatmessage.getSource() + " asked me to deliver this message on " + chatmessage.getTimestamp().substring(0,16).replace("2010-07-20 00:00", "an unknown date") + ": \n" + chatmessage.getMessage());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.