Package games.stendhal.server.entity.slot

Examples of games.stendhal.server.entity.slot.ChestSlot


        objects.add(objectInSlot);
      }
      slot.clear();
      removeSlot("content");

      final RPSlot newSlot = new ChestSlot(this);
      addSlot(newSlot);
     
      // Restore the stored items
      ItemTransformer transformer = new ItemTransformer();
      for (final RPObject rpobject : objects) {
        try {
          Item item = transformer.transform(rpobject);
         
          // log removed items
          if (item == null) {
            int quantity = 1;
            if (rpobject.has("quantity")) {
              quantity = rpobject.getInt("quantity");
            }
            logger.warn("Cannot restore " + quantity + " "
                + rpobject.get("name") + " of stored chest "
                + " because this item"
                + " was removed from items.xml");
            continue;
          }

          newSlot.add(item);
        } catch (final Exception e) {
          logger.error("Error adding " + rpobject + " to stored chest slot", e);
        }
      }
    }
View Full Code Here


  public Chest() {
    setRPClass(CHEST_RPCLASS_NAME);
    put("type", CHEST_RPCLASS_NAME);
    open = false;

    final RPSlot slot = new ChestSlot(this);
    addSlot(slot);
  }
View Full Code Here

    super(object);
    setRPClass(CHEST_RPCLASS_NAME);
    put("type", CHEST_RPCLASS_NAME);

    if (!hasSlot("content")) {
      final RPSlot slot = new ChestSlot(this);
      addSlot(slot);
    }

    update();
  }
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.slot.ChestSlot

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.