Package games.stendhal.client.entity

Examples of games.stendhal.client.entity.EntityChangeListener


   */
  public void addEntity(final IEntity entity) {
    MapObject object = null;
   
    if (entity instanceof User) {
      entity.addChangeListener(new EntityChangeListener() {
        public void entityChanged(final IEntity entity, final Object property) {
          if (property == IEntity.PROP_POSITION) {
            positionChanged(entity.getX(), entity.getY());
          }
        }
      });
      positionChanged(entity.getX(), entity.getY());
     
      object = new PlayerMapObject(entity);
    } else if (entity instanceof Player) {
      object = new PlayerMapObject(entity);
    } else if (entity instanceof Portal) {
      final Portal portal = (Portal) entity;

      if (!portal.isHidden()) {
        mapObjects.put(entity, new PortalMapObject(entity));
      }
    } else if (entity instanceof HousePortal) {
      object = new PortalMapObject(entity);
    } else if (entity instanceof WalkBlocker) {
      object = new WalkBlockerMapObject(entity);
    } else if (entity instanceof DomesticAnimal) {
      // Only own pets and sheep are drawn but this is checked in the map object so the user status is always up to date
      object = new DomesticAnimalMapObject((DomesticAnimal)entity);
    } else if (supermanMode && User.isAdmin()) {
      if (entity instanceof RPEntity) {
        object = new RPEntityMapObject(entity);
      } else {
        object = new MovingMapObject(entity);
      }
    }
   
    if (object != null) {
      mapObjects.put(entity, object);
     
      // changes to objects that should trigger a refresh
      if (object instanceof MovingMapObject) {
        entity.addChangeListener(new EntityChangeListener() {
          public void entityChanged(final IEntity entity, final Object property) {
            if ((property == IEntity.PROP_POSITION)
                || (property == RPEntity.PROP_GHOSTMODE)
                || (property == RPEntity.PROP_GROUP_MEMBERSHIP)) {
              needsRefresh = true;
View Full Code Here


      final Player player = (Player) entity;

      choosePlayerColor(player);
     
      // Follow the ghost mode changes of other players
      entity.addChangeListener(new EntityChangeListener() {
        public void entityChanged(final IEntity entity, final Object property) {
          if ((property == RPEntity.PROP_GHOSTMODE) || (property == RPEntity.PROP_GROUP_MEMBERSHIP)) {
            choosePlayerColor(player);
          }
        }
View Full Code Here

TOP

Related Classes of games.stendhal.client.entity.EntityChangeListener

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.