Jump to content

[GUIDE]Lineage 2 java basics


Intrepid

Recommended Posts

first you need some program to work with java.

you need:

 

java jdk: http://java.sun.com/javase/downloads/index.jsp

eclipse: http://www.maxcheaters.com/forum/index.php?topic=22102.0 (Guide how to install it and set it up)

maven: http://maven.apache.org/download.html

 

install them.(for easier use copy maven to c:/maven folder)

 

When you finish open the eclipse and start to work:)

Its really simple server maker teams have their own SVN repository thats the url where you download their DP.

Go to window->show window->others...->SVN->SVN repository now a window appear in eclipse.

right click in the window go to new->repository location

in the popup window you need to enter the svn link.The SVN links are:

 

l2jfree: svn://www.l2jfree.com/repo/l2j-free

L2j: http://www.l2jserver.com/svn/ (core svn) http://www.l2jdp.com/svn/ (DP svn)

L2emu: http://svn.assembla.com/svn/L2Emu/

 

I use l2jfree server pack so the guide based on l2jfree!

Now when you press ok you see the server pack in the SVN window.

The newest pack is in the trunk folder.We want the core and datapack right click on it and checkout.

Now its downloaded you see the downloaded pack in the package explorer window.

 

ABOUT COMPILING

Datapack:Really simple right click on Build.xml->Run as->1 Ant build.

Core:l2jfree use maven so you need to compile it with maven.(Other pack use Build.xml to core too)

Compile l2jfree core:

before you compile you need to do 2 things.

1st open control panel->system->special->variables

You need to add new system variable for java jdk.Add these lines to user and system variables.

Variable name:JAVA_HOME

Varible path:C:\Program Files\Java\jdk1.6.0_11

Now restart your PC.

Open maven\bin\mvn.bat with notepad go to line 157 and write this:

old one:%MAVEN_JAVA_EXE% %MAVEN_OPTS% -classpath %CLASSWORLDS_JAR%

new one:%MAVEN_JAVA_EXE% %MAVEN_OPTS% "-Xmx1024m" -classpath %CLASSWORLDS_JAR%

Now compile the core:

open a command line(start->run->cmd)

go to your core folder(for example the core is c:\workspace\l2jfree-core)

type cd C:\

type cd workspace

type cd l2jfree-core

Now you need to compile:

type C:\maven\bin\mvn clean:clean

thats delete the excisting compile(Target folder)if you have.

type C:\maven\bin\mvn assembly:assembly -Dmaven.test.skip=true

thats build your core and place it to l2jfree-core\target folder.

HOW TO MAKE JAVA MODIFICATIONS:

VOICED COMMAND:

You have the voiced commands in the com.l2jfree.gameserver.handler.voicedcommand folder

Voiced commands ingame starts with . for example .info

Insert the Info.java for example to voiced commands folder thats the first step.

After that you need to register it.

Open voicedcommandhandler.java

Search for the private VoiceCommandHandler() section there you can register your command

To register the .info command for example type this under the last registered command.

registerVoicedCommandHandler(new info());

Compile your core and you are done.

ITEM HANDLERS:

You have the item handlers in the com.l2jfree.gameserver.handler.itemhandler folder

The itemhandlers ingame works like for example you click on it and it summon your pet.

Same like the voiced commands just insert the java file into the itemhandler folder.

Registering in itemhandler.java

Go to private ItemHandler() section

and register your command under the last command like

registerItemHandler(new example());

Compile your core and you are done.

 

REGISTER NEW SQL COLUMN IN A TABLE AT JAVA:

open the L2PCinstance.java (com.l2jfree.gameserver.model.actor.instance)

to register it you need 2 easy step.

1st you see SQL string definitions named with the name of sql table.

For example look at // Character Character SQL String Definitions:

Lets an example you have a patch for vitality system but you need to register a new column at character table.

You see update and restore you need to insert your colums name into these two line like this:

trust_level=? WHERE charId=?"; thats the end of the update line if you want to insert a new one(example vitality)write this.

trust_level=?, vitality=? WHERE charId=?";

Now look at the restore line

trust_level FROM characters WHERE charId=?"; thats the end of the line to insert vitality column write this.

trust_level,vitality FROM characters WHERE charId=?";

Now thats ok you need to set a statement.

Search for the private void storeCharBase() section at L2PCinstance

you find statement's here go to statement.setInt(52, getObjectId());

Thats the end of it its gat the characters objectid(at which character the tables effect applyes)

Now insert vitality here.Insert above statement.setInt(52, getObjectId()); this:

statement.setInt(52, getvitality()); and rename the statement.setInt(52, getObjectId()); to statement.setInt(53, getObjectId());

compile your core and your done.

 

HOW TO MAKE CONFIG OPTIONS:

You can make config options for everything what you want i show you a simple.

You want to create config Option for a voiced command.

Go to voicedcommandhandler.java where you register the command.

Use this syntax for registering with config option:

		if (Config.ALLOW_EXAMPLE)
	{
		registerVoicedCommandHandler(new yourcommand());

	}

Thats the first step now open the Config.java (com.l2jfree)

You want to register it for example at other.properties.

Search for other.properties the section is ending with this line:

// *******************************************************************************************

// *******************************************************************************************

Above that search for the latest option press enter at the and of the line now you have a new line

For a false/true config you need to use public static boolean so to register the example use this:

public static boolean ALLOW_EXAMPLE;

Now search for public static void loadOtherConfig() (thats load the configuration of the other.properties)

Search for catch (Exception e) above that you see config options in other syntax.

Search for the latest option and press enter.In the new line register the config like this:

ALLOW_EXAMPLE = Integer.parseBoolean(otherSettings.getProperty("Example.properties", "default value false or true"));

Now thats ok lets write the config.

Open the properties file(Other in my example)

go to the end of it and press enter.

Example = false or true

If you want to write about the config option make it like this

# -----------

# Allow example

# -----------

Example = false or true

 

HOW TO CREATE/APPLY DIFF PATCH:

apply diff patch:

right click on the core->team->apply patch than select your destination.

if you get error for a diff dont apply it open it with notepad and with search function add it to the right place.

make diff patch:

right click on the edited file->team->create patch here you can choose copy to clipboard and then paste or save it to a file.

 

Credits to ALEX2008GR for the eclipse guide!And for me to that guide!

 

[move]When i have time i try to keep it updated whit other java basics :)[/move]

Link to comment
Share on other sites

updated create and apply diff patches.

 

nice Guide..

 

+1 for that...

 

keep sharing ;)

 

Thanks for karma:)

 

Br0 this is awesome ... ;D i love you  :P also i'm w8ting for the photo :)

 

Keep up m8 !!!!

 

Edit:It will be added at my collection  :)

 

As i said on msn my vista has its own life when he dont want photos i dont make photos:D

Link to comment
Share on other sites

lol 1st time from july (when i register)i see this post...

interpid It's very helpfull omG!

I try to do my best:)

Also i have some very good project i'm working on i think if its ready i share it(like automated 1v1 event engine and others)

Link to comment
Share on other sites

I try to do my best:)

Also i have some very good project i'm working on i think if its ready i share it(like automated 1v1 event engine and others)

hmmm...

at school my pc proffesor say me that many codes of java

want open/close what i mean?

e.g. at html u cant make two path about left/right align

you must open

<div align="left">text

and then close

</div>

and the the right align

the java has this?

and if it easy give via pm your msn :P

Link to comment
Share on other sites

In java it's { }

 

public void NameOfMethidHere()
{
      Code goes here
}

and if u make it at code? like

{ code goes here }

any difference?

Link to comment
Share on other sites

No difference, it's about what you like, but it's easier the way I do it, especially if you have more lines within the { }

i know that..

at html all code i make to another line from text...

it's easily to understand when is the error if u have...

anyway thnx!

 

dont tell me nQQb :D

i'm at first steps with java :D

and if u want to know my age?

you laugh :P

i'm 14 years old...

4 feb i'll become 15

 

Link to comment
Share on other sites

  • 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.

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

    • Hi! If you love TikTok music and want to download it, use SaveTikTok. Just copy the TikTok video link, paste it on the site, and download your favorite tracks and videos quickly. I think this is a great opportunity. I also really like to use Instagram. I wonder if there is such a function. I will tell you how to get likes on Instagram very quickly. So I wish you success in achieving popularity. Enjoy them anytime, on any device!nytime, on any device!
    • U dont kbow what happened with dumanist I send him files he downloaded and then asked for refund, i got all proofs at whatsapp, why he never open a topic, fucking idiot u are 😆 There are no fake updates me and him made all fixes, we dont have to prove something.. especially when you told him that cache is wrong and this is why it crashes while you have half of the code unclosed connections in mail system.. as i said gtfo, pay your programmer to make your fixes! Cause for scripts changing stats you are more than good.. as i said.. bulgarian whore, lick everyone!  There are no fake updates me and him made all fixes, we dont have to prove something.. especially when you told him that cache is wrong and this is why it crashes while you have half of the code unclosed connections in mail system.. as i said gtfo, pay your programmer to make your fixes! Cause for scripts changing stats you are more than good.. as i said.. bulgarian whore, lick everyone!       Also the truth is i helped in many codes inside the pack! But the most percentage is zoumhs work! If he is the one making it or someone else its non of your bussiness he doesnt have profit from this! He is clever to make subscriptions that way he can find all issues , while u just ask 100 per fixes 😅🤣     If u are that great, why u lick trevorj and why back in the days begging gustavo to make you stuff!  Just enjoy your life and leave zoumhs alone! To do his hobby! You are just a toxic and jealous rat! All your "clients" speak with the best for you 🤣🤣🤣      
    • So since interlude chronicle when a monster attacks you , it auto targets the monster , i need to disable it , like on C1-C4 was.   Im using vanganth extender also have sources ,but have no idea wheare to take a look.    
    • I have a rebirth engine on my server and it works great, except after the first rebirth... When taking 2nd+++ Rebirth it does NOT give any rewards... If someone could PM me I would appreciate it, I dont want to post the code here until it is fixed... This can be closed, stupidly enough you have to repeat the rewards for every separate rebirth instead of just the one item you want them all to give....
    • You telling me that ZOUMHS fixing things in the source code xD, please don't try to be funny. When are you going to tell the truth? just fake updates 🙂   ps What happened to the deleted posts from me and the evidence of how much FAKE you are? Another person who thinks like me. Let's see who will be quicker to delete the posts.  I admit, i cant live without you 🙂 But please stop changing your nicknames because i no longer know who is who.      
  • 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