Package org.groovymud.object

Examples of org.groovymud.object.Container


  protected File createFile(String username) {
    return new File(mudSpacePlayerLocation + username + ".xml");
  }

  public void movePlayerToLocation(Player player) throws InstantiationException, FileNotFoundException, CompilationFailedException {
    Container room;
    logger.info("moving player to location.");
    ObjectLocation location = player.getContainerLocation();

    room = (Container) getObjectRegistry().getMudObject(location.getBeanId());
    if (room == null) {
      logger.info("loading container");
      room = (Container) load(location);
    }
    if (room == null) {
      throw new InstantiationException("container was null!");
    }
    logger.info("adding player to container");
    room.addMudObject(player);
  }
View Full Code Here


      final ArgHolder argHolder = new ArgHolder();

      argHolder.parse(nextCommand, player);

      Container container = player.getCurrentContainer();
      boolean commandRun = false;
      MudObject containerMO = (MudObject) container;
      if (containerMO != null) {
        // the object means to do the action with the container, it
        // holds a list of
View Full Code Here

   */
  public void register(MudObject obj) {
    obj.setRegistry(this);
    obj.setInterpreter(getCommandInterpreter());
    if (isContainerInstance(obj)) {
      Container con = castToContainer(obj);
      con.getInventoryHandler().setRegistry(this);
      con.getInventoryHandler().relinkContent(con);
    }

    if (obj.getId() != null) {
      MudObject old = getMudObject(obj.getId());
      if (old != null) {
View Full Code Here

  }

  protected synchronized void findNewContainer(ScopedEvent arg) {
    MovementEvent event = (MovementEvent) arg;
    Alive movingObject = event.getMovingObject();
    Container foundContainer = (Container) getMudObject(event.getRoomLocation().getBeanId());
    if (foundContainer == null) {
      Exception anException = null;
      try {
        foundContainer = (Container) getMudObjectAttendant().load(event.getRoomLocation());
      } catch (CompilationFailedException e) {
View Full Code Here

      for (MudObject mudObject : mos) {
        mudObject.setInterpreter(getRegistry().getCommandInterpreter());
        mudObject.setRegistry(getRegistry());

        if (mudObject instanceof Container) {
          Container container = castToContainer(mudObject);
          container.getInventoryHandler().setRegistry(getRegistry());
          container.getInventoryHandler().relinkContent(container);
        }

        mudObject.setCurrentContainer(obj); // relink container data
        if (mudObject instanceof Observable) {
          ((Observable) mudObject).addObserver(obj);
View Full Code Here

    }
    return player;
  }

  public void moveToLocation(MudObject player) throws InstantiationException, FileNotFoundException, CompilationFailedException, MudCloneException {
    Container room = null;
    logger.info("moving player to location.");
    ObjectLocation location = player.getContainerLocation();
    room = (Container) getObjectRegistry().getMudObject(location.getHandle());
    if (room == null) {
      logger.info("loading container..");
      load(location);
      room = (Container) cloneObject(location.getHandle());
    }

    if (room == null) {
      throw new InstantiationException("container was null!");
    }
    logger.info("adding player to container");
    room.addMudObject(player);
  }
View Full Code Here

  public void register(MudObject obj, String handle) {
    obj.setRegistry(this);
    obj.setInterpreter(getCommandInterpreter());

    if (isContainerInstance(obj)) {
      Container con = castToContainer(obj);
      relinkContent(con);
    }

    if (isAliveInstance(obj)) {
      Alive alive = castToAlive(obj);
View Full Code Here

      for (MudObject mudObject : mos) {
        mudObject.setInterpreter(getCommandInterpreter());
        mudObject.setRegistry(this);

        if (mudObject instanceof Container) {
          Container container = castToContainer(mudObject);
          relinkContent(container);
        }

        mudObject.setCurrentContainer(obj); // relink container data
        if (mudObject instanceof Observable) {
View Full Code Here

  protected synchronized void findNewContainer(ScopedEvent arg) {
    MovementEvent event = (MovementEvent) arg;
    Alive movingObject = event.getMovingObject();
    Exception anException = null;
    Container foundContainer = null;
    try {
      foundContainer = castToContainer(getMudObjectAttendant().findOrClone(event.getRoomLocation()));
    } catch (MudCloneException e) {
      logger.error(e, e);
      anException = e;
View Full Code Here

  }

  public void register(MudObject obj) {

    if (isContainerInstance(obj)) {
      Container con = castToContainer(obj);
      con.getInventoryHandler().relinkContent(con);
    }

    if (obj.getId() != null) {
      MudObject old = getMudObject(obj.getId());
      if (old != null) {
View Full Code Here

TOP

Related Classes of org.groovymud.object.Container

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.