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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...