Package org.groovymud.object

Examples of org.groovymud.object.MudObject


      con.getInventoryHandler().setRegistry(this);
      con.getInventoryHandler().relinkContent(con);
    }

    if (obj.getId() != null) {
      MudObject old = getMudObject(obj.getId());
      if (old != null) {
        old.dest(false);
      }
    }
    if (isAliveInstance(obj)) {
      Alive alive = castToAlive(obj);
      if (alive.getTerminalOutput() == null) {
View Full Code Here


  }

  public void addAllMudObjects(Set<MudObject> objects) {
    Iterator<MudObject> hashIterator = objects.iterator();
    while (hashIterator.hasNext()) {
      MudObject next = (MudObject) hashIterator.next();
      addMudObject(next);
    }
  }
View Full Code Here

      Iterator<Set<MudObject>> x = values.iterator();
      while (x.hasNext()) {
        Set<MudObject> next = x.next();
        Iterator<MudObject> hashIter = next.iterator();
        while (hashIter.hasNext()) {
          MudObject mo = hashIter.next();
          if (alive == (mo instanceof Alive)) {
            allObjects.add(mo);
          }
        }
      }
View Full Code Here

      while (moi.hasNext()) {
        Set<MudObject> set = getMudObjectHashSets().get(moi.next());
        if (set != null) {
          Iterator<MudObject> setI = set.iterator();
          while (setI.hasNext()) {
            MudObject x = setI.next();
            if (alive == (x instanceof Alive)) {

              String id = x.getName();
              if (x.getName() == null) {
                id = x.getId();
              }
              addMudObjectToMap(id, x, objs);
            }
          }
        }
View Full Code Here

   *            index of object to remove
   * @return the removed object
   */
  public MudObject removeMudObject(String objectName, int index) {
    List<MudObject> list = new ArrayList<MudObject>(getMudObjectHashSets().get(objectName));
    MudObject obj = null;
    obj = list.get(index);

    removeMudObject(obj);

    return (MudObject) obj;
View Full Code Here

    }
    return handles;
  }

  public MudObject cloneObject(String handle) throws MudCloneException {
    MudObject o = getObjectRegistry().getMudObject(handle);
    if (o == null) {
      o = loadObject(handle);
    }
    o = cloneObject(o, true);
    getObjectRegistry().register(o, handle);
View Full Code Here

    getObjectRegistry().register(o, handle);
    return o;
  }

  public MudObject findOrClone(ObjectLocation loc) throws MudCloneException {
    MudObject obj = getObjectRegistry().getMudObject(loc.getHandle());
    if (obj == null) {
      load(loc);
      obj = cloneObject(loc.getHandle());
    }
    return obj;
View Full Code Here

  protected MudObject cloneObject(MudObject o, boolean register) throws MudCloneException {
    if (o == null) {
      throw new IllegalArgumentException("object cannot be null");
    }
    Exception anException = null;
    MudObject copy = null;
    try {
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      persistence.serialize(o, out);
      InputStream in = new ByteArrayInputStream(out.toByteArray());
      copy = persistence.deserializeObject(in);
View Full Code Here

   *            location - representing where the object can be found in the
   *            spring container
   * @throws MudCloneException
   */
  private MudObject loadObject(String handle) throws MudCloneException {
    MudObject obj = null;
    for (DomainManager<MudObject> domainManager : domainManagers) {

      if (domainManager.contains(handle)) {
        obj = domainManager.getObject(handle);
        break;
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);
View Full Code Here

TOP

Related Classes of org.groovymud.object.MudObject

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.