Package commands.admin

Source Code of commands.admin.AdminTarget

package commands.admin;

import l2p.extensions.scripts.ScriptFile;
import l2p.gameserver.handler.AdminCommandHandler;
import l2p.gameserver.handler.IAdminCommandHandler;
import l2p.gameserver.model.L2Object;
import l2p.gameserver.model.L2Player;
import l2p.gameserver.model.L2World;

@SuppressWarnings("unused")
public class AdminTarget implements IAdminCommandHandler, ScriptFile
{
  private static enum Commands
  {
    admin_target
  }

  public boolean useAdminCommand(Enum comm, String[] wordList, String fullString, L2Player activeChar)
  {
    Commands command = (Commands) comm;
    if(!activeChar.getPlayerAccess().CanViewChar)
    {
      return false;
    }
    try
    {
      String targetName = wordList[1];
      L2Object obj = L2World.getPlayer(targetName);
      if(obj != null && obj.isPlayer())
      {
        obj.onAction(activeChar, false);
      }
      else
      {
        activeChar.sendMessage("Player " + targetName + " not found");
      }
    }
    catch(IndexOutOfBoundsException e)
    {
      activeChar.sendMessage("Please specify correct name.");
    }
    return true;
  }

  public Enum[] getAdminCommandEnum()
  {
    return Commands.values();
  }

  public void onLoad()
  {
    AdminCommandHandler.getInstance().registerAdminCommandHandler(this);
  }

  public void onReload()
  {
  }

  public void onShutdown()
  {
  }
}
TOP

Related Classes of commands.admin.AdminTarget

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.