Jump to content

Recommended Posts

Posted

Hello everybody. Here I am again with another topic.

Here you will learn about a few things in l2j.

It would be a bit annoying if I made a new topic for each guide, so I decided to compile them in this one. Let's begin?

 


 

Chapter 1: Voiced Commands

 

All of us know the Voiced Commands.

Simple commands for players that start with the dot (.)

 

So, let's see how to make a simple one!

Let's begin with the well known license (That part can be skipped, but let's do it for fun xD)

/*
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/

 

You can also replace it with your own "license".

Let's continue setting the package.

Since the Voicedcommands are made in the voicedcommandhandlers, the package will always be the same. Which means that the package will be:

package net.sf.l2j.gameserver.handler.voicedcommandhandlers;

 

Okay we are done with this.

Now let's continue with the imports.

You have two options: You will either set the imports now, if you know what you'll use or leave it for later (you'll write what you want and import the proper stuff manually).

 

We'll work with the online voiced command in order to show you a few things (you all know what it does, it shows the ammount of Online players). Even if I know what we'll write, I won't add the imports now, to show you about the imports.

 

Okay, let's add your name as authors now, in order to show who wrote the code!

/**
* @author YourNameHere
*/

You just have to insert your name instead of the "YourNameHere".

 

Let's start the main stuff!

You have to set the class as public and show that it implements the "IVoicedCommandHandler".

So, the form will be like this:

public class OnlinePlayers implements IVoicedCommandHandler

For other codes, the form will be the same, although the "OnlinePlayers" must be replaced with your new voicedcommand.

 

Let's start writing. You all know how! {

Now, let's set the voicedcommands that will be made in this file.

how to do this? Simple. First decide what the command will be. Then show it in this form:

private static final String[] VOICED_COMMANDS ={"on"};

 

Instead of "on" you will need to write your command. Don't delete the "" though!

 

Now let's write what will happen when a player presses the command.

In this case, once the player presses the command he will see the ammount of players online.

So:

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
        {
	        if (command.startsWith("on"))
	        {
	            showPlayers(activeChar, target);		
	        }
	        return true;
               }

Don't forget! Instead of "on" you have to add your own command, and instead of the action I set (showPlayers) you have to set your own.

 

We would have to end our code with this:

public String[] getVoicedCommandList()
{
	return VOICED_COMMANDS;
}

 

Although, in this code we have to explain what the action above is.

Since the "showPlayers" doesn't exist, we have to "Explain" what it is and what it does.

So, in this case we set the void and make it to send some systemmessages to the player, in order to inform him about the ammount of online players.

So it will be:

public void showPlayers (L2PcInstance player, String target)
{

	{
          	        sm = new SystemMessage(SystemMessageId.S1_S2);	
          	        sm.addString("players are online.");
          	        sm.addNumber(L2World.getInstance().getAllPlayers().size());
          	        player.sendPacket(sm);

	}
}

 

In the end we just close it with a "}".

Now it's time to set the imports!

Let's see what we used.

In our imports we always use the IVoicedCommandHandler, so

import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;

Next, we used the L2World in order to see how many players are online.

So,

import net.sf.l2j.gameserver.model.L2World;

Don't forget the L2PcInstance, for the activeChar (the online active player).

import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

And in the end we used systemmessages to tell him how many players were online.

So we import these two:

import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;

Use the function "Organise Imports" and the code is ready!

Now save and close your file!

 

We are not done yet, though!

There is something left!

We have to register our code!

 

In Gracia it will be done on the MasterHandler file, so it will be registered on the VoicedCommands part like that:

VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new OnlinePlayers());

There's no need to import the location of the file, since it imports automaticaly every file at that folder.

 

In Interlude it will be different. You will have to go at Gameserver.java file, open it and add the import.

This file will be imported like:

import net.sf.l2j.gameserver.handler.voicedcommandhandlers.OnlinePlayers;

And now comes the registeration.

Find the VoicedCommands part, and register the new command like:

_voicedCommandHandler.registerVoicedCommandHandler(new OnlinePlayers());

 

And we're done!

That's how you created a brand new Voiced Command! =]

 

 

Chapter 2: Configurations

 

All of us know the "Config" file. Custom/non modifications are being added there. The reason though is not to add custom features, but to make our lifes easier! Configs are made in order to handle specified settings from simple modifcations. For example, you can simply add a custom TvT Event. You add the teleporting coordinates, you enable it, you set the reward, etc. But if you want to change these settings, in the future many times, you will get pissed off if you don't find the values easily. The solution? You make them configurable. In the configs, you can just change a few numbers or a "True" to "False" (and vice versa) and change the whole server in no time! So we will now see easily, how to make our own configuration. We will make a simple one. My goal is not to teach you what each thing in Config.java does, or how to make every single value configurable. What I want to do, is to show you what Configurations are, and how to start Configuring stuff. Let's begin!

 

First of all, we find what we want to set configurable.

I picked the OnlinePlayers VoicedCommands that we created in a previous guide!

So, let's see.

We will set the use of the class configurable.

What do I mean?

We will create a config that if we set to "True", will enable the use of the VoicedCommand, otherwise (if set to "False) will disable it.

We first create the configuration at the Config.java file, located in net.sf.l2j

Open the file and search for

/**define L2JMODS */

Under this, we have to set the new boolean.. (If you don't know what booleans are, then read the last part of my l2j guide in the L2j Section).

So, let's add this:

public static boolean ENABLE_OUR_CODE;

Instead of ENABLE_OUR_CODE, you can set another name, like ENABLE_ONLINE_VC.

Now, let's search for

Properties L2JModSettings

.

You'll see some configurations about Champion Mobs, etc.

You will have to place the new configuration under those (for example).

So let's add this:

ENABLE_OUR_CODE = Boolean.parseBoolean(L2JModSettings.getProperty("EnableTheCode", "True"));

 

You can replace again the ENABLE_OUR_CODE with something you like, although it must be the same with the one you set above. The "EnableTheCode" is what will be shown at the properties file. About the "True" value we set, you don't have to worry. The feature will be enabled/disabled depending ONLY to the value you will set at the properties file (In this case, l2jmods).

 

So we are done with the java part of the configuration.

Now, let's find the properties file (l2jmods) and add the new configuration.

Open the file and add in the end this:

EnableTheCode = True

You can set it either to true or false. Absolutely your decision.

 

The last part! We have to set this at a place where the code we added before (the custom voiced command, in this case) will be affected. What does this mean? We must find the proper place to add the configuration! In our case, we will go at the place where we registered the command! (MasterHandler for Gracia and Gameserver for Interlude).

Above the code with which we registered the command (this code:

_voicedCommandHandler.registerVoicedCommandHandler(new OnlinePlayers());

Above it, we add the configuration.

if(Config.ENABLE_OUR_CODE)

 

And that's it!

What did we finally do? We created a configuration for the OnlinePlayers voiced command.

If we set the value to "True" the command will be ok. If we set it to "False" the command will be disabled!

 

 

 

What did we learn today? How to create a new VoicedCommand, and how to make Configurations!

I did my best to explain everything in an informal way, so it can be understood by newbies.

If there is something you'd like to learn, or something you didn't understand, feel free to ask here!

Don't spam please.

 

Best Regards,

Coyote™.

 

PS: More guides like these will come soon, if I find free time.

 

To be Continued...

http://www.maxcheaters.com/forum/index.php?topic=123823.0

Posted

FUUUUUUUUUUUU ~~~

 

 

stolen ideas ajajajajajaj gg noob :D

 

Naah, there is just no space left in here.

http://www.maxcheaters.com/forum/index.php?topic=92146.0

 

So I continue them like that xD

Posted

Naah, there is just no space left in here.

http://www.maxcheaters.com/forum/index.php?topic=92146.0

 

So I continue them like that xD

from mine topic in greek section i meant :D

 

 

anyway make sure you will continue them , because noobs keep creating - using preconfs

Posted

anyway make sure you will continue them , because noobs keep creating - using preconfs

 

I will keep creating guides..

I just need free time, and the next days I doubt if I have some..

I'll continue them soon though, don't worry..

Posted

hahah the license and author part is funny.. well u have some good guides Coyote.. will help alot of nabs here that have no clue what they doing :P

i plan on making a full detailed guide "coding an event from scratch" and i will be coding a ctf or dm there.. but probably i wont soon since im a lazy ass.. xD

 

edit: btw u maybe wanna add somewhere in the guide that in epilogue instead of "net.sf.l2j" u need to put "com.l2jserver" (or something like that.. i dont have it in front of me right now)

Posted

hahah the license and author part is funny.. well u have some good guides Coyote.. will help alot of nabs here that have no clue what they doing :P

i plan on making a full detailed guide "coding an event from scratch" and i will be coding a ctf or dm there.. but probably i wont soon since im a lazy ass.. xD

 

Well, thanks and good luck with your future guide!

Posted

As a newbie in java, i have a question. What exactly is this part doing?

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)

 

It is the boolean that, let's say, shows the command and its use.

It shows that if the player presses ".on" then the action below happens.

  • 2 months later...
Posted

i can't add new command becaus my VoicedCommandHandler.java it look like this:

 

package net.sf.l2j.gameserver.handler;

import java.util.Map;
import java.util.logging.Logger;

import javolution.util.FastMap;
import net.sf.l2j.Config;

public class VoicedCommandHandler
{
private static Logger _log = Logger.getLogger(ItemHandler.class.getName());

private static VoicedCommandHandler _instance;

private Map<String, IVoicedCommandHandler> _datatable;

public static VoicedCommandHandler getInstance()
{
	if (_instance == null)
	{
		_instance = new VoicedCommandHandler();
	}
	return _instance;
}

private VoicedCommandHandler()
{
	_datatable = new FastMap<String, IVoicedCommandHandler>();
}

public void registerVoicedCommandHandler(IVoicedCommandHandler handler)
{
	String[] ids = handler.getVoicedCommandList();
	for (int i = 0; i < ids.length; i++)
	{
		if (Config.DEBUG) _log.fine("Adding handler for command "+ids[i]);
		_datatable.put(ids[i], handler);
	}
}

public IVoicedCommandHandler getVoicedCommandHandler(String voicedCommand)
{
	String command = voicedCommand;
	if (voicedCommand.indexOf(" ") != -1) {
		command = voicedCommand.substring(0, voicedCommand.indexOf(" "));
	}
	if (Config.DEBUG)
		_log.fine("getting handler for command: "+command+
				" -> "+(_datatable.get(command) != null));
	return _datatable.get(command);
}

    public int size()
    {
        return _datatable.size();
    }
}

what can i do?

Posted

i can't add new command becaus my VoicedCommandHandler.java it look like this:

 

package net.sf.l2j.gameserver.handler;

import java.util.Map;
import java.util.logging.Logger;

import javolution.util.FastMap;
import net.sf.l2j.Config;

public class VoicedCommandHandler
{
private static Logger _log = Logger.getLogger(ItemHandler.class.getName());

private static VoicedCommandHandler _instance;

private Map<String, IVoicedCommandHandler> _datatable;

public static VoicedCommandHandler getInstance()
{
	if (_instance == null)
	{
		_instance = new VoicedCommandHandler();
	}
	return _instance;
}

private VoicedCommandHandler()
{
	_datatable = new FastMap<String, IVoicedCommandHandler>();
}

public void registerVoicedCommandHandler(IVoicedCommandHandler handler)
{
	String[] ids = handler.getVoicedCommandList();
	for (int i = 0; i < ids.length; i++)
	{
		if (Config.DEBUG) _log.fine("Adding handler for command "+ids[i]);
		_datatable.put(ids[i], handler);
	}
}

public IVoicedCommandHandler getVoicedCommandHandler(String voicedCommand)
{
	String command = voicedCommand;
	if (voicedCommand.indexOf(" ") != -1) {
		command = voicedCommand.substring(0, voicedCommand.indexOf(" "));
	}
	if (Config.DEBUG)
		_log.fine("getting handler for command: "+command+
				" -> "+(_datatable.get(command) != null));
	return _datatable.get(command);
}

    public int size()
    {
        return _datatable.size();
    }
}

what can i do?

 

Add them in gameserver

serch for:

_log.config("VoicedCommandHandler: Loaded " + _voicedCommandHandler.size() + " handlers.");

and add before:

_voicedCommandHandler.registerVoicedCommandHandler(new Wedding());

Replace Wedding with your VoicedCommand Name Save & Exit and you are done :D

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

    • Special Offer until 31 November, only 70euros.
    • We have the best prices for Adena on L2Reborn. discord - adver745645
    • Played the first 20 lvls in the OBT, very promising indeed. Quests seemed to be working fine for the most part although there's no need for the repetitive quests in the start since with x3 rates (x4 with premium which is pretty cheap tbh) adena from mobs outperforms the repetitive quests since you outlevel them in the early stage before you finish the quest, one time quests are good though and that's where is the juice. Idk how the og elixir was since I was a kid but this is definetely going to be much easier than your usual x1-2 no buffs server since GK is free for the first 40 lvls and you get basic 6 basic normal buffs even after low levels, that's not a bad thing for a lot of people though. Will be there on the opening.  
    • This post originally appeared on MmoGah. As the global release of Aion 2 draws near, players are eagerly preparing to dive into this highly anticipated MMORPG. One of the most important decisions you’ll make is choosing the right class, as it will define your experience in both solo and group content. Aion 2 introduces eight distinct classes, each with unique gameplay mechanics, strengths, and roles. Whether you’re a seasoned veteran or a newcomer, understanding these classes is essential to finding the one that suits your preferred playstyle. This guide provides a comprehensive overview of all eight classes, tips for selecting your ideal role, and recommendations for different types of players. Aion 2’s class system offers a variety of options across tanks, damage dealers, healers, and hybrid supports. Here’s a quick breakdown of the roles: - Tank Classes: Templar - Physical DPS Classes: Gladiator, Assassin, Ranger - Magical DPS Classes: Sorcerer - Hybrid Classes: Spiritmaster, Chanter - Healer Class: Cleric Each class has been carefully designed to excel in specific scenarios, whether it’s PvP, PvE, solo leveling, or large-scale faction battles. Pro Tip: As you embark on your journey, remember that having Aion 2 Kinah can greatly enhance your experience, so consider acquiring it to make the most of your adventure.   Class Breakdown Templar – The Indomitable Tank The Templar is the quintessential tank, specializing in defense and crowd control. With high durability and reliable aggro management, this class is invaluable in group content and large-scale battles. Strengths: - Exceptional survivability  - Top-tier aggro control  - Disruption tools for PvP  Playstyle: Templars thrive on the frontlines, soaking up damage and protecting allies. They are perfect for players who enjoy leading the charge and maintaining battlefield control. Gladiator – The Melee Powerhouse The Gladiator strikes a balance between offense and defense, offering strong AoE damage and decent survivability. This class excels in fast-paced melee combat and open-world PvP. Strengths: - High AoE damage  - Lifesteal-style abilities for sustain  - Versatile in both PvE and PvP  Playstyle:  Gladiators are ideal for players who enjoy dynamic melee combat with a mix of durability and damage. Assassin – The Stealthy Burst Specialist Assassins are masters of stealth and mobility. Known for their high single-target burst damage, they dominate in duels and small-scale PvP encounters. Strengths: - Exceptional burst damage  - Stealth mechanics for ambushes  - High mobility for quick disengagement Playstyle: This class is perfect for players who prefer fast-paced, tactical gameplay with an emphasis on sneaky kills. Ranger – The Precision Archer Rangers excel at dealing consistent physical damage from a distance. With excellent crowd control abilities and strong kiting potential, they are a solid choice for both PvE and PvP. Strengths:  - Safe ranged damage  - Strong crowd control tools  - Great for solo play  Playstyle: Rangers suit players who enjoy staying at range, controlling enemies, and executing precise attacks. Sorcerer – The Magical Artillery Sorcerers are pure magic damage dealers with devastating AoE spells and crowd control abilities. They are capable of turning the tide of battle with their massive burst potential. Strengths: - Highest magical burst damage  - Excellent AoE capabilities  - Crowd control via slows and immobilizes  Playstyle: Sorcerers are perfect for players who enjoy dealing immense magical damage while controlling enemies from a distance. Spiritmaster – The Tactical Summoner The Spiritmaster brings strategic depth to combat by combining summons, debuffs, and utility spells. This class is highly versatile and excels in both solo and group settings. Strengths: - Elemental summons with unique abilities  - Strong debuffs for PvP dominance  - Great solo leveling potential  Playstyle: Spiritmasters are best suited for players who enjoy strategic gameplay and multitasking in battle. Cleric – The Essential Healer The Cleric is the backbone of any group, providing powerful healing, cleansing, and defensive buffs. This class is indispensable in dungeons and raids. Strengths: - Reliable direct and AoE healing  - Cleansing abilities to remove debuffs  - Vital for group survival  Playstyle: Clerics are ideal for players who take pride in supporting their team and ensuring everyone stays alive. Chanter – The Hybrid Support The Chanter blends melee combat with healing and party-wide buffs. This versatile class can fill multiple roles in a group, making it a valuable addition to any team. Strengths: - Strong party buffs  - Solid healing capabilities  - Decent melee damage Playstyle: Chanters are perfect for players who want to contribute both offensively and defensively while supporting their team.   Choosing the Right Class What’s Your Playstyle? To help narrow down your choice, consider what you enjoy most in an MMORPG: • If you like tanking and leading the charge, choose Templar. • If you like melee combat with high durability, choose Gladiator.  • If you like stealthy gameplay with burst damage, choose Assassin.  • If you like ranged combat with precision, choose Ranger.   • If you like Massive magical damage, choose Sorcerer. • If you like tactical utility with summons, choose Spiritmaster. • If you like healing and supporting teammates, choose Cleric.  • If you like hybrid support with melee combat, choose Chanter. Beginner-Friendly Classes If you’re new to MMORPGs or unsure where to start, these classes offer straightforward mechanics: 1. Templar – Durable, beginner-friendly tank. 2. Cleric – Essential healer with clear roles in group content. Solo vs. Group Play Some classes excel in solo play, while others shine in groups: - Best Solo Classes: Gladiator, Ranger, Spiritmaster (good sustain and flexibility). - Best Group Classes: Templar (tank), Cleric (healer), Chanter (support). PvP Recommendations For competitive players who enjoy PvP: - 1v1/Small-Scale PvP: Assassin (stealth burst) or Sorcerer (burst + CC).  - Large-Scale PvP: Spiritmaster (debuffs) or Templar (frontline disruption). Team Composition Tips Building a balanced party is crucial in Aion 2. Consider these combinations for optimal synergy: - Tank + DPS + Healer: Templar + Sorcerer + Cleric (classic setup).  - Buff-Oriented Group: Gladiator + Chanter + Cleric (durability + support).    Final Thoughts Aion 2 offers a rich variety of classes tailored to different playstyles. Whether you prefer tanking, dealing damage, or supporting your team, there’s a class that fits your preferences. To summarize: - For beginners: Start with Templar or Cleric. - For high damage: Choose Gladiator, Assassin, or Sorcerer. - For strategic gameplay: Go with Spiritmaster. - For support roles: Opt for Cleric or Chanter. Still undecided? Share your preferred playstyle—solo adventuring, competitive PvP, or cooperative group play—and you’ll find the perfect class to begin your journey in Aion 2!  
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock