Package commands.admin

Source Code of commands.admin.AdminGmChat

package commands.admin;

import l2p.extensions.scripts.ScriptFile;
import l2p.gameserver.handler.AdminCommandHandler;
import l2p.gameserver.handler.IAdminCommandHandler;
import l2p.gameserver.model.L2Player;
import l2p.gameserver.serverpackets.Say2;
import l2p.gameserver.tables.GmListTable;

public class AdminGmChat implements IAdminCommandHandler, ScriptFile
{
  private static enum Commands
  {
    admin_gmchat,
    admin_snoop
  }

  public boolean useAdminCommand(Enum comm, String[] wordList, String fullString, L2Player activeChar)
  {
    Commands command = (Commands) comm;
    if(!activeChar.getPlayerAccess().CanAnnounce)
    {
      return false;
    }
    switch(command)
    {
      case admin_gmchat:
        try
        {
          String text = fullString.replaceFirst(Commands.admin_gmchat.name(), "");
          Say2 cs = new Say2(0, 9, activeChar.getName(), text);
          GmListTable.broadcastToGMs(cs);
        }
        catch(StringIndexOutOfBoundsException e)
        {
        }
        break;
      case admin_snoop:
      {
        /**
         L2Object target = activeChar.getTarget();
         if(target == null)
         {
         activeChar.sendMessage("You must select a target.");
         return false;
         }
         if(!target.isPlayer)
         {
         activeChar.sendMessage("Target must be a player.");
         return false;
         }
         L2Player player = (L2Player) target;
         player.addSnooper(activeChar);
         activeChar.addSnooped(player);
         */
      }
    }
    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.AdminGmChat

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.