Jump to content

Custom menu command handlers for your .menu


Recommended Posts

It is also a requirement for my other share:

Note: Inorder to get a better idea of what is happening check the above share to  see how it works.

 

credits: me.

 

RequestBypassToServer.java

	else if (_command.startsWith("menu_") || _command.startsWith("_menu"))
      {
       UsermenuHandler.getInstance().handleCommands(getClient(), _command);
      }

 

UsermenuHandler.java

package net.sf.l2j.gameserver.custom.usermenu.managers;
 
 
import net.sf.l2j.gameserver.custom.usermenu.menuhandlers.NewsHandler;
 
import net.sf.l2j.gameserver.model.actor.instance.Player;
import net.sf.l2j.gameserver.network.L2GameClient;
 
 
/**
 * @author LordPanic
 *
 */
public class UsermenuHandler
{
	protected UsermenuHandler(){
 
	}
 
	public static UsermenuHandler getInstance()
	{
		return SingletonHolder._instance;
	}
 
 
	public void handleCommands(L2GameClient client, String command)
	{
		final Player activeChar = client.getActiveChar();
		if (activeChar == null)
			return;
 
		if(command.startsWith("_menuNewsPage") || command.startsWith("_menuNewsPost")) {
			NewsHandler.getInstance().parseCmd(command, activeChar);
		}
			else {
			activeChar.sendMessage("The command: " + command + " isn't implemented.");
			activeChar.sendMessage("error KAPPA");
			}
	}
 
	private static class SingletonHolder
	{
		protected static final UsermenuHandler _instance = new UsermenuHandler();
	}
 
}

 

Edited by LordPanic
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...