NullPvPFlag.java
/*
* 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, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
/**
*
* @Author Revenger
*
*/
public class NullPvPFlag implements IVoicedCommandHandler
{
private static final String[] VOICED_COMMANDS = { "null_pvp_flag" };
public boolean useVoicedCommand(String command, L2PcInstance activeChar,String target)
{
if (command.equalsIgnoreCase("null_pvp_flag"))
{
if (activeChar.getPvpFlag() != 0 )
{
activeChar.setPvpFlag(0);
}
else if (activeChar.isParalyzed() || activeChar.isRooted() || activeChar.isDead()
|| activeChar.isAlikeDead() || activeChar.isConfused() || activeChar.isBetrayed()
|| activeChar.isFakeDeath() || activeChar.isFlying() || activeChar.isMounted()
|| activeChar.isInDuel() || activeChar.isInOlympiadMode() || activeChar.inObserverMode()
|| activeChar.isInJail())
{
activeChar.sendMessage("You Cannot Use This Command Right Now!");
return false;
}
}
return true;
}
public String[] getVoicedCommandList()
{
return VOICED_COMMANDS;
}
}
Además, añadir las lineas en el MasterHandler.java