Package zones

Source Code of zones.EpicZone

/*
* 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 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package zones;

import lineage2.gameserver.listener.zone.OnZoneEnterLeaveListener;
import lineage2.gameserver.model.Creature;
import lineage2.gameserver.model.Player;
import lineage2.gameserver.model.Zone;
import lineage2.gameserver.network.serverpackets.components.CustomMessage;
import lineage2.gameserver.scripts.ScriptFile;
import lineage2.gameserver.utils.Location;
import lineage2.gameserver.utils.ReflectionUtils;

/**
* @author Mobius
* @version $Revision: 1.0 $
*/
public class EpicZone implements ScriptFile
{
  /**
   * Field _zoneListener.
   */
  private static ZoneListener _zoneListener;
 
  /**
   * Method onLoad.
   * @see lineage2.gameserver.scripts.ScriptFile#onLoad()
   */
  @Override
  public void onLoad()
  {
    _zoneListener = new ZoneListener();
    Zone zone = ReflectionUtils.getZone("[queen_ant_epic]");
    zone.addListener(_zoneListener);
  }
 
  /**
   * Method onReload.
   * @see lineage2.gameserver.scripts.ScriptFile#onReload()
   */
  @Override
  public void onReload()
  {
  }
 
  /**
   * Method onShutdown.
   * @see lineage2.gameserver.scripts.ScriptFile#onShutdown()
   */
  @Override
  public void onShutdown()
  {
  }
 
  /**
   * @author Mobius
   */
  public class ZoneListener implements OnZoneEnterLeaveListener
  {
    /**
     * Method onZoneEnter.
     * @param zone Zone
     * @param cha Creature
     * @see lineage2.gameserver.listener.zone.OnZoneEnterLeaveListener#onZoneEnter(Zone, Creature)
     */
    @Override
    public void onZoneEnter(Zone zone, Creature cha)
    {
      if ((zone.getParams() == null) || !cha.isPlayable() || cha.getPlayer().isGM())
      {
        return;
      }
      if (cha.getLevel() > zone.getParams().getInteger("levelLimit"))
      {
        if (cha.isPlayer())
        {
          cha.getPlayer().sendMessage(new CustomMessage("scripts.zones.epic.banishMsg", (Player) cha));
        }
        cha.teleToLocation(Location.parseLoc(zone.getParams().getString("tele")));
      }
    }
   
    /**
     * Method onZoneLeave.
     * @param zone Zone
     * @param cha Creature
     * @see lineage2.gameserver.listener.zone.OnZoneEnterLeaveListener#onZoneLeave(Zone, Creature)
     */
    @Override
    public void onZoneLeave(Zone zone, Creature cha)
    {
    }
  }
}
TOP

Related Classes of zones.EpicZone

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.