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


  • Posts

    • Bought the interface source for the 557 protocol from him. Everything works as described, no issues so far. Smooth deal, would recommend.
    • Add try version of protocol 563 https://drive.google.com/file/d/1l1QnyFGXxX_c98FNUgXHFmDsIzZCrVc6/view?usp=drive_link
    • WTS Adena Stock 2.6kkk Titan 78 Sub Sagitarius 76 nobless Hirophant 78 Sub Cardinal 78 nobless   discord : nhr0711
    • We are not another "open-close" project. LOE is a long-term Essence server that has been live for over a year — NewAge x2 is our brand-new world, and it will never be wiped. 🗺 STAGED WORLD PROGRESSION Here is what kills most servers: no-lifers hit the cap in three days, everyone else logs in to a finished race. On LOE the world unlocks stage by stage, every ~2 weeks — new locations, new bosses, new gear ceiling. The server grows as one. Start on day one or day ten — you are still in the race. ✨ WHAT MAKES US DIFFERENT Subclass system on Essence — a full dedicated questline, unique for this platform. Your build, your rules. Talent system — three branches: tank, damage, farm. Two players, same class, different characters. Hero skills and deep character customization. Fair progression — power comes from playing, not from a credit card. x2 rates — the classic Essence pace without the grind wall. 📚 WE DOCUMENTED EVERYTHING 25,000+ items, every class with full skill tables, monsters, drop rates, quests, locations. Check the server before you even download it: loe.promo/wiki — no other project gives you this. 📋 SERVER INFO Platform: Lineage 2 Essence · Rates: x2 Open Beta: July 24 — test the stages and the subclass questline before launch Grand Opening: July 31, 20:00 GMT+3 Site & wiki in English — international players welcome 🔒 YOUR NICKNAME IS BEING TAKEN RIGHT NOW Reservation is already open. On the 31st the crowd arrives — the name you have carried through every server for years may simply be gone. Lock it in 30 seconds: Equal start for everyone. See you in Elcardia — July 31, 20:00 GMT+3. Questions? Drop them below — the team reads this thread daily.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..