Jump to content

Recommended Posts

Posted

Index: trunk/Eclipse-Game/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/flag.java
===================================================================
--- trunk/Eclipse-Game/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/flag.java	(revision 0)
+++ trunk/Eclipse-Game/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/flag.java	(revision 0)
@@ -0,0 +1,48 @@
+package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
+
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
+
+/** 
+ * @Author s
+ */
+
+public class flag implements IVoicedCommandHandler
+{
+	private static final String[]	VOICED_COMMANDS	= 
+	{
+	"noflag"	
+	};
+
+	public boolean useVoicedCommand(String command, L2PcInstance activeChar,
+			String target) 
+	{
+		if (command.equalsIgnoreCase("noflag"))
+		{
+			if (activeChar.getPvpFlag() == 0)
+			{
+				activeChar.sendMessage("You cannot use this command at this moment.");
+				activeChar.sendPacket(new ActionFailed());
+				return false;
+			}
+			else if (activeChar.isDead() || activeChar.isFakeDeath() || activeChar.isAlikeDead() || activeChar.isFestivalParticipant() || activeChar.isInJail() || activeChar.atEvent || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isFlying() || activeChar.isInDuel())
+			{
+				activeChar.sendMessage("You cannot use this command at this moment.");
+				activeChar.sendPacket(new ActionFailed());
+				return false;
+			}
+			else if (activeChar.getPvpFlag() != 0)
+		   {
+			activeChar.setPvpFlag(0);
+			activeChar.sendMessage("You are not flagged anymore.");
+		   }
+		}
+		return true;
+	}
+
+	public String[] getVoicedCommandList()
+	{
+		return VOICED_COMMANDS;
+	}
+}
Index: trunk/Eclipse-Game/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- trunk/Eclipse-Game/java/net/sf/l2j/gameserver/GameServer.java	(revision 237)
+++ trunk/Eclipse-Game/java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -200,6 +200,7 @@
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.trade;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.pm;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Info;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.flag;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Cl;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.karma;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stat;
@@ -615,6 +616,8 @@
            _voicedCommandHandler.registerVoicedCommandHandler(new Info());
        
        _voicedCommandHandler.registerVoicedCommandHandler(new karma());
+       
+       _voicedCommandHandler.registerVoicedCommandHandler(new flag());

                 
		_log.config("VoicedCommandHandler: Loaded " + _voicedCommandHandler.size() + " handlers.");

 

credits: s

Guest
This topic is now closed to further replies.


×
×
  • Create New...