Skip to content

Custom menu command handlers for your .menu

Featured Replies

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

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.