Jump to content

Recommended Posts

Posted

Ok . Everyone know how to create these commands like .command , but now i want to say how to create thats /command . I think it look much better  ;)

 


 

This guide is for L2J files , if somone want make it for other pack , should change imports .

 

Ok . As We know...in newest L2J rev , we have handlers in DataPack ( .java files ) so we dont must compile them in core to make them working .

 


 

Ok . For example we want to create command and when we use it , it will show us window with our text .

 

1 . First step :

 

You should open :

data\scripts\handlers\usercommandhandlers

 

2. Second Step :

 

Create new .java file . For example ServerInfo.java

 

3. Third Step :

 

- Ok , We have our .java file . So now We must open this file and start writing :

 

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/

 

We know , this is GNU license , dont forget to paste it in our file .

 


 

- Then We must import some classes needed for shown html window in game , so :

 

package handlers.usercommandhandlers;

import net.sf.l2j.gameserver.handler.IUserCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;

 


 

Ok , we have imported needed classes from core , now we must create our class :

 

public class ServerInfo implements IUserCommandHandler
{
private static final int[] COMMAND_IDS =
{
	121
};

 

Now all should ask...omg but what is that ? What its this ID ( 121 in this example ) . The answer is simple :

 

This is ID form our client . We can define this in : commandname-e.dat file . Ok , download FileEdit and open this fille , we should have somethink like that :

 

whdw91.jpg

 

- Ok , first column if for command number ( 1,2,3,4,5,5 ... )

- Secound column is for command ID - yes we need it in our class ( I'ill show it again , where we will put ID ) :

 

 

private static final int[] COMMAND_IDS =

{

121

};

 


 

Ok , we want to add that command : /serverinfo , so we must put :

 

- 122 in first column , becouse last one was 121 .. ( we are smarts - yeah  ;) )

- 121 in secound column , becouse last one was 120 ... ok this is our comman ID , we must this into our class ( look upper , to show where put this ... )

- And in third column we must add :

 

a,serverinfo\0

 

Now when we use /serverinfo in game , server will try to use command with 121 ID

 

So it look like this :

 

1248un6.jpg

 

- Close and save file , this is it  ;)

 


 

Now add to our script this :

 

/**

*

* @see net.sf.l2j.gameserver.handler.IUserCommandHandler#useUserCommand(int, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance)

*/

public boolean useUserCommand(int id, L2PcInstance activeChar)

{

if (id != COMMAND_IDS[0])

return false;

                NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);

                npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Your Text Here</body></html>");

                activeChar.sendPacket(npcHtmlMessage);

                return true;

        }

 

/**

*

* @see net.sf.l2j.gameserver.handler.IUserCommandHandler#getUserCommandList()

*/

public int[] getUserCommandList()

{

return COMMAND_IDS;

}

}

 


 

Done , our ServerInfo.java should look that :

 

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.usercommandhandlers;

import net.sf.l2j.gameserver.handler.IUserCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;

/**
* Support for /serverinfo command
* Added by Matim
*/
public class ServerInfo implements IUserCommandHandler
{
private static final int[] COMMAND_IDS =
{
	121
};

/**
 * 
 * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#useUserCommand(int, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance)
 */
public boolean useUserCommand(int id, L2PcInstance activeChar)
{
	if (id != COMMAND_IDS[0])
		return false;
                NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0); 
                npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Your team won the event. Look in your inventory, there should be your reward.</body></html>"); 
                activeChar.sendPacket(npcHtmlMessage); 
                return true;
        }

/**
 * 
 * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#getUserCommandList()
 */
public int[] getUserCommandList()
{
	return COMMAND_IDS;
}
}

 


 

Now we must add our script to MasterHandler.java in \data\scripts\handlers folder

 

- Open this file : And find these lines , in first column :

 

import handlers.usercommandhandlers.ChannelDelete;
import handlers.usercommandhandlers.ChannelLeave;
import handlers.usercommandhandlers.ChannelListUpdate;
import handlers.usercommandhandlers.ClanPenalty;
import handlers.usercommandhandlers.ClanWarsList;
import handlers.usercommandhandlers.DisMount;
import handlers.usercommandhandlers.Escape;
import handlers.usercommandhandlers.InstanceZone;
import handlers.usercommandhandlers.Loc;
import handlers.usercommandhandlers.Mount;
import handlers.usercommandhandlers.OlympiadStat;
import handlers.usercommandhandlers.PartyInfo;
import handlers.usercommandhandlers.Time;

 

and add our :

 

import handlers.usercommandhandlers.ServerInfo;

 


 

Now find this column :

 

	private static void loadUserHandlers()
{
	UserCommandHandler.getInstance().registerUserCommandHandler(new ClanPenalty());
	UserCommandHandler.getInstance().registerUserCommandHandler(new ClanWarsList());
	UserCommandHandler.getInstance().registerUserCommandHandler(new DisMount());
	UserCommandHandler.getInstance().registerUserCommandHandler(new Escape());
	UserCommandHandler.getInstance().registerUserCommandHandler(new InstanceZone());
	UserCommandHandler.getInstance().registerUserCommandHandler(new Loc());
	UserCommandHandler.getInstance().registerUserCommandHandler(new Mount());
	UserCommandHandler.getInstance().registerUserCommandHandler(new PartyInfo());
	UserCommandHandler.getInstance().registerUserCommandHandler(new Time());
	UserCommandHandler.getInstance().registerUserCommandHandler(new OlympiadStat());
	UserCommandHandler.getInstance().registerUserCommandHandler(new ChannelLeave());
	UserCommandHandler.getInstance().registerUserCommandHandler(new ChannelDelete());
	UserCommandHandler.getInstance().registerUserCommandHandler(new ChannelListUpdate());
	UserCommandHandler.getInstance().registerUserCommandHandler(new ServerInfo());
	_log.config("Loaded " + UserCommandHandler.getInstance().size() + " UserHandlers");
}

 

And add this :

 

UserCommandHandler.getInstance().registerUserCommandHandler(new ServerInfo());

 

(under : UserCommandHandler.getInstance().registerUserCommandHandler(new ChannelListUpdate()); )

 


 

Save , and restart Your server , done now type /serverinfo in game  ;)

 

Credits goes to me

  • Like 1
Posted

Very nice guide, for niewbie...

 

Keep it up!

 

p.s: This have client modding so... illegal ... .info or .infoserver etc is much better no need client modding ;)

Posted

OMG Great share I was looking for a guide like this , cause I only know how to edit commands from Banking.java but couldn't find a way to crate a seperate *.java file.

Thanks again.

Posted

you made us laugh so much

it's hard to find good server's without cilent modding

 

Us? how many ppl are you? are like all in one?

 

1 Waring stay on topic!

 

As i said is very good guide for starter .... but is client moding so... illegal... If you don't agree go expres your opinion at www.NcSoft.com.

Posted

Man ...i fully agree with that what are you talking about , but as i said ..this is for thats people who need and want use it..same like custom items.

  • 2 weeks later...

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.




  • Posts

    • From Salvation onwards I think you need a patched nwindow.dll that allows such modifications, try to see if you get what you need here: https://drive.google.com/drive/u/1/folders/1LLbQFGf8KlR-O0Iv5umfF-pwZgrDh9bd
    • hello everyone! I am wanting to save the files (Ini. - Data - ) of the EP5 Client: Salvation... But they generate the error "corrupt files"... I tried several versions of L2FileEditor without good results. I need help! Thank you!
    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
    • small update: dc robe set sold   wts adena 1kk = 1.5$ 
  • Topics

×
×
  • Create New...