Package org.groovymud.object.alive

Examples of org.groovymud.object.alive.Player


    }
  }

  public Player loadPlayerData(String username) throws CompilationFailedException, ResourceException, ScriptException, FileNotFoundException {
    logger.info("loading playerImpl object..");
    Player player = null;
    XStream xstream = getXStream();
    load(getPlayerImpl());
    File playerFile = createFile(username);
    if (playerFile.exists()) {
      logger.info("loading player file");
View Full Code Here


    }
  }

  public Player createNewPlayer(String username) throws InstantiationException, FileNotFoundException, CompilationFailedException {
    logger.info("creating new player");
    Player player = (Player) load(getPlayerImpl());
    String upperName = username.substring(0, 1).toUpperCase() + username.substring(1);

    player.setName(upperName);
    player.addShortName(upperName);
    player.addShortName(username);
    getObjectRegistry().register(player);

    return player;
  }
View Full Code Here

    if (i.hasNext()) {
      logger.info("auto saving..");
    }
    while (i.hasNext()) {
      LoginShell o = i.next();
      Player p = o.getPlayer();
      if (getObjectRegistry().getMudObject(p.getName()) != null) {
        getObjectAttendant().savePlayerData(p);
        try {
          o.getPlayer().getTerminalOutput().writeln("\r\nAuto Saving...");
        } catch (IOException e) {
          logger.error(e, e);
View Full Code Here

    Iterator<LoginShell> x = new HashSet<LoginShell>(getObjectRegistry().getActivePlayerHandles()).iterator();
    CountingMap netDead = getNetDeadPlayers();
    while (x.hasNext()) {
      LoginShell shell = x.next();
      if (!shell.getConnection().isActive()) {
        Player p = getObjectRegistry().getPlayerByHandle(shell);
        if (!netDead.containsKey(p)) {
          // not a good way to do it.. but how.. ?
          logger.info(p.getName() + " is net dead..");
          p.addStatus(NET_DEAD_STATUS);
        }
        netDead.increment(p);
      }
    }
  }
View Full Code Here

  protected void destAllPlayers() {
    Iterator<LoginShell> x = new HashSet<LoginShell>(getObjectRegistry().getActivePlayerHandles()).iterator();
    while (x.hasNext()) {
      LoginShell shell = x.next();
      if (shell.getConnection().isActive()) {
        Player p = getObjectRegistry().getPlayerByHandle(shell);
        p.dest(false);
      }
    }
  }
View Full Code Here

  private final static Logger logger = Logger.getLogger(MudShell.class);

  public void run(Connection connection) {
    setConnection(connection);
    setExtendedTerminalIO((ExtendedTerminalIO) getConnection().getConnectionData().getEnvironment().get("terminalIO"));
    Player player = (Player) getConnection().getConnectionData().getEnvironment().get("player");
    LoginContext lc = (LoginContext) getConnection().getConnectionData().getEnvironment().get("loginContext");
    getInterpreter().doShellCommand("look", player);
    try {
      while (getObjectRegistry().getMudObject(player.getName()) != null) {
        handleRequest(player);
      }
    } catch (Exception e) {
      logger.error(e, e);
    } finally {
View Full Code Here

  protected Player loadPlayer(String username) throws CompilationFailedException, FileNotFoundException, ResourceException, ScriptException, InstantiationException {
    return getObjectLoader().loadPlayerData(username);
  }

  public Player tryToloadPlayer(String username) {
    Player player = null;
    try {
      player = loadPlayer(username);
    } catch (CompilationFailedException e) {
      logger.error(e, e);
    } catch (InstantiationException e) {
View Full Code Here

    }
  }

  public Player loadPlayerData(String username) throws CompilationFailedException, ResourceException, ScriptException, DataSourceException {
    logger.info("loading playerImpl object..");
    Player player = null;
    synchronized (this.getClass()) {
      load(getPlayerImpl());
      player = (Player) persistence.loadObject(PLAYER_STORE + username);
    }
    return player;
View Full Code Here

  }

  public Player createNewPlayer(String username) throws MudCloneException {
    logger.info("creating new player");
    MudObject obj = loadObject(getPlayerImpl().getHandle());
    Player player = (Player) cloneObject(obj, false);
    String upperName = username.substring(0, 1).toUpperCase() + username.substring(1);

    player.setName(upperName);
    player.addShortName(upperName);
    player.addShortName(username);

    return player;
  }
View Full Code Here

  }

  public void dest(MudObject object, boolean withExtremePrejudice) {
    logger.info("trying to dest:" + object + " wep? " + withExtremePrejudice);
    if (object instanceof Player) {
      Player player = castToPlayer(object);
      fireLeavingMessage(player);
      if (!withExtremePrejudice) {
        getMudObjectAttendant().savePlayerData(player);
      }
    }
View Full Code Here

TOP

Related Classes of org.groovymud.object.alive.Player

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.