Package games.stendhal.server.core.engine.dbcommand

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


public class ReadAchievementsOnLogin implements LoginListener, TurnListener {
 
  private ResultHandle handle = new ResultHandle();
 
  public void onLoggedIn(Player player) {
    DBCommand command = new ReadAchievementsForPlayerCommand(player);
    DBCommandQueue.get().enqueueAndAwaitResult(command, handle);
    TurnNotifier.get().notifyInTurns(1, new TurnListenerDecorator(this));
  }
View Full Code Here


    DBCommandQueue.get().enqueueAndAwaitResult(command, handle);
    TurnNotifier.get().notifyInTurns(1, new TurnListenerDecorator(this));
  }

  public void onTurnReached(int currentTurn) {
    ReadAchievementsForPlayerCommand command = DBCommandQueue.get().getOneResult(ReadAchievementsForPlayerCommand.class, handle);
    if (command == null) {
      TurnNotifier.get().notifyInTurns(0, new TurnListenerDecorator(this));
      return;
    }
    Player p = command.getPlayer();
    Set<String> identifiers = command.getIdentifiers();
    p.initReachedAchievements();
    for (String identifier : identifiers) {
      p.addReachedAchievement(identifier);
    }
    SingletonRepository.getAchievementNotifier().onLogin(command.getPlayer());
  }
View Full Code Here

TOP

Related Classes of games.stendhal.server.core.engine.dbcommand.ReadAchievementsForPlayerCommand

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.