Package games.stendhal.server.entity.mapstuff.sign

Source Code of games.stendhal.server.entity.mapstuff.sign.PopupImage

/* $Id: PopupImage.java,v 1.3 2010/04/26 05:17:10 nhnb Exp $ */
/***************************************************************************
*                    (C) Copyright 2003-2010 - Stendhal                   *
***************************************************************************
***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
***************************************************************************/
package games.stendhal.server.entity.mapstuff.sign;

import games.stendhal.common.constants.Actions;
import games.stendhal.server.core.events.UseListener;
import games.stendhal.server.entity.RPEntity;
import games.stendhal.server.events.ExamineEvent;

/**
* A sign (or transparent area) which is placed on the ground and can be looked at closely.
*/
public class PopupImage extends Sign implements UseListener {
  private String image;
  private String title;
  private String caption;

  /**
   * Creates a new PopupImage
   *
   * @param image the image to display
   * @param title the title
   * @param caption text to display along the image
   */
  public PopupImage(final String image, final String title, final String caption) {
    put(Actions.ACTION, Actions.LOOK_CLOSELY);
    this.image = image;
    this.title = title;
    this.caption = caption;
  }

  public boolean onUsed(RPEntity user) {
    user.addEvent(new ExamineEvent("examine/" + image, title, caption));
    return true;
  }

}
TOP

Related Classes of games.stendhal.server.entity.mapstuff.sign.PopupImage

TOP
Copyright © 2018 www.massapi.com. 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.