Jump to content

Recommended Posts

Posted

New Away + Back Command System. Is really simple and nice.

 

How it works:

Version 1: When you type .away: You get a Green title " *Away * ", this commands also informs the players that you are away , also it costs 500Milion. Just to avoid spam

 

Version 2: Added Some useful protections. Changed Announcements text + Message to player.

 

Version 1: When you type .back: Away title is removed, also this command " .back " informs the players that you are back .back is free.

 

Version 2: Added Some useful protections. Changed Announcements text + Message to player.

 

 

Patch:

Version 2.

### Eclipse Workspace Patch 1.0
#P L2JEclipse-Private
Index: trunk/Eclipse-Game/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/away.java
===================================================================
--- trunk/Eclipse-Game/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/away.java	(revision 0)
+++ trunk/Eclipse-Game/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/away.java	(revision 0)
@@ -0,0 +1,114 @@
+package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
+
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+public class away implements IVoicedCommandHandler
+{
+    private static final String[] VOICED_COMMANDS = { "away", "back" };
+
+    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+    {
+        if (command.equalsIgnoreCase("away"))
+        {
+            else if(activeChar.isInJail())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in Jail!");
+                return false;
+            }
+            else if(activeChar.isInOlympiadMode())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in the Olympiad now.");
+                return false;
+            }
+            else if(activeChar.atEvent)
+            {
+                activeChar.sendMessage("You cannot use this command while you are in an event.");
+                return false;
+            }
+            else  if (activeChar.isInDuel())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in a duel!");
+                return false;
+            }
+            else if (activeChar.inObserverMode())
+            {
+               activeChar.sendMessage("You cannot use this command while you are in Observer Mode.");
+            }
+            else if (activeChar.isFestivalParticipant())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in a festival.");
+                return false;
+            }
+            else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in the dimensional rift.");
+                return false;
+            }
+            
+        	if(activeChar.getInventory().getItemByItemId(57) != null && activeChar.getInventory().getItemByItemId(57).getCount() >= 500000000)
+            {
+            activeChar.getInventory().destroyItemByItemId("Away", 57, 500000000, activeChar, activeChar.getTarget());
+			Announcements.getInstance().announceToAll("AWAY: " + activeChar + " is away");
+            activeChar.sendMessage("You are away from keyboard, 500Milion adena dissapeared, players informed.");
+            activeChar.getAppearance().setTitleColor(0xFF000);
+            activeChar.setTitle("*Away*"); // Title text when somebody is away.
+            activeChar.broadcastUserInfo();
+            }
+        }
+    
+        else
+        	
+        if (command.equalsIgnoreCase("back"))
+        {
+            else if(activeChar.isInJail())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in Jail!");
+                return false;
+            }
+            else if(activeChar.isInOlympiadMode())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in the Olympiad now.");
+                return false;
+            }
+            else if(activeChar.atEvent)
+            {
+                activeChar.sendMessage("You cannot use this command while you are in an event.");
+                return false;
+            }
+            else  if (activeChar.isInDuel())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in a duel!");
+                return false;
+            }
+            else if (activeChar.inObserverMode())
+            {
+               activeChar.sendMessage("You cannot use this command while you are in Observer Mode.");
+            }
+            else if (activeChar.isFestivalParticipant())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in a festival.");
+                return false;
+            }
+            else if (activeChar.isInParty() && activeChar.getParty().isInDimensionalRift())
+            {
+                activeChar.sendMessage("You cannot use this command while you are in the dimensional rift.");
+                return false;
+            }
+            
+            Announcements.getInstance().announceToAll("BACK: " + activeChar + " is back.");
+            activeChar.sendMessage("You are back. Players informed.");
+            activeChar.setTitle(" ");
+            activeChar.broadcastUserInfo();
+        }
+        return true;
+         		
+    }
+    
+    public String[] getVoicedCommandList()
+    {
+        return VOICED_COMMANDS;
+    }
+
+}
\ No newline at end of file
Index: trunk/Eclipse-Game/java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- trunk/Eclipse-Game/java/net/sf/l2j/gameserver/GameServer.java	(revision 223)
+++ trunk/Eclipse-Game/java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -199,6 +199,7 @@
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.TvT;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.trade;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.pm;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.away;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Info;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Cl;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.karma;
@@ -616,6 +617,7 @@
       
       _voicedCommandHandler.registerVoicedCommandHandler(new karma());

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

 

Credits: ehh me.

  • 1 year later...
Posted

you should delete: Announcements.getInstance().announceToAll("BACK: " + activeChar + " is back.");

and add to chatPM.java or something like that code that will not allow to pm players which are away

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock