Jump to content
  • 0

Help to add codes. Newbie on java and eclipse.


Question

Posted

I'm starting on this.

I know enough to be able to make my website with php, html and css. I also know linux to maintain a server but I don't know anything about java and its compilation.

 

Can anyone help me learn how to add this type of code to a server? I'm using L2jMobius, but I have no idea or concept of how to start to add codes.
Do I need to add it before compiling? Can it be added once the datapack is compiled? How do I know where I should add it?

 

I would appreciate any kind of information, please!

 

I wanna to add some codes nex collection, like TvT events, etc:

 

 

See you guys and thanks for all the help are in the forum!

6 answers to this question

Recommended Posts

  • 0
Posted

First of all you need to understand that there is no ultimate guide "how to", server sources has some similar things but it also has some differences that you will be hard to adapt without skills. Saying skills I mean not only java skills, the most required ones is understanding lineage 2 core processes task-scheduling and client-server networking  communication.

 

You need to:

-learn some core information about Java language

-learn some lessons about java programming to understand what is java classes, packages, imports etc.

-learn how to edit java source code with some IDE (one of them eclipse)

-learn how to compile java source code (with ant for example)

 

Then for the best way you need to get most popular sources form thread above and try to integrate that scripts like for native, I mean as I can see that mostly provided scripts are for acis, so take acis sources and ty to integrate or find something directly for mobius etc.

 

Doing all this you will need to understand three things

First - How player communicates with server

What is action bypasses (when player clicks some link in HTML) and where your server handles it (find RequestBypassToServer packet and learn how its working)

What is user/voice/admin commands (when player writes some in chat with "." or "/" or "//") and where your server handles it (find VoiceCommandHandler and learn how its working)

 

Second - How server doing core logic

If addon has some logic that not depends on direct user action it will mostly required some scheduled task (some logic that will be runs periodically), so you need to  find some ThreadPoolManager and Runnable usages and understand how its working

Maybe you will need some data storage, so you will need to find how server working with database (try to find how server executes SQL requests, SELECT, INSERT, UPDATE)

 

Third - How server communicates back to player

You need to find how server sends packets to player, find some sendPacket() method and its usages, for example Say2 packet (its when server sends some chat message to client) etc

 

Unfortunately there is no easy way, some sources will be easier to adapt cuz of similarity between sources some will be harder

 

  • 0
Posted (edited)
2 hours ago, lvlkoo said:

First of all you need to understand that there is no ultimate guide "how to", server sources has some similar things but it also has some differences that you will be hard to adapt without skills. Saying skills I mean not only java skills, the most required ones is understanding lineage 2 core processes task-scheduling and client-server networking  communication.

 

You need to:

-learn some core information about Java language

-learn some lessons about java programming to understand what is java classes, packages, imports etc.

-learn how to edit java source code with some IDE (one of them eclipse)

-learn how to compile java source code (with ant for example)

 

Then for the best way you need to get most popular sources form thread above and try to integrate that scripts like for native, I mean as I can see that mostly provided scripts are for acis, so take acis sources and ty to integrate or find something directly for mobius etc.

 

Doing all this you will need to understand three things

First - How player communicates with server

What is action bypasses (when player clicks some link in HTML) and where your server handles it (find RequestBypassToServer packet and learn how its working)

What is user/voice/admin commands (when player writes some in chat with "." or "/" or "//") and where your server handles it (find VoiceCommandHandler and learn how its working)

 

Second - How server doing core logic

If addon has some logic that not depends on direct user action it will mostly required some scheduled task (some logic that will be runs periodically), so you need to  find some ThreadPoolManager and Runnable usages and understand how its working

Maybe you will need some data storage, so you will need to find how server working with database (try to find how server executes SQL requests, SELECT, INSERT, UPDATE)

 

Third - How server communicates back to player

You need to find how server sends packets to player, find some sendPacket() method and its usages, for example Say2 packet (its when server sends some chat message to client) etc

 

Unfortunately there is no easy way, some sources will be easier to adapt cuz of similarity between sources some will be harder

 

 

First of all thank you for your answer!

 

I understand a little about programming. Enough to create dynamic websites with PHP, bash, etc. That is, I know the general programming syntax.

It's been several hours and I think I'm understanding a little more how java would work.

So far I have understood that in the different codes that are published I have to add/modify the code in the "index" files that are indicated. All this in eclipse before compiling, on java directory.

I'm trying to add one of these:

https://maxcheaters.com/topic/216955-tvt-ctf-and-dm-for-acis/
https://maxcheaters.com/topic/206016-tvt-event-reworked-tvtjoin-tvtleave-tvtstatus/


Now I find small difficulties:

 

- In L2jMobius there are no "net.sf.l2j.*" files because they are "org.l2jmobius". When I add an import what I do is modify that part of the line and eclipse indicates that it is correct. The problem comes from the fact that there are files that do not come on Mobius. For example *.gameserver.model.actor.instance.L2PcInstance.java.

I downloaded from https://bitbucket.org/MobiusDev/l2j_mobius.git

 

- Due to the above I have decided to use L2jAcis (I have read that it has many errors for not pvp server). Specifically this: https://gitlab.com/Tryskell/acis_public .The problem is that it also doesn't have the java files called L2*, like L2PcInstance.

 

I have found this dapatack that does have the L2* (https://github.com/exvo23/l2jacis400). I find it strange that the Tryskell (Acis official) doesn't have L2* files and exvo23 does.

 

I dont understand this with Acis.

 

Basically I want to build a server compiled by me and not pre-built by other people. I want TvT and little else. The idea is a server x20 not retail but without pvp style and without buffer/gmshop.


Thank you very much again for your answer! I will try to continue learning, although I am somewhat lost with so many dapatack and codes for each one.

 

 

 

 

 

Edited by gripao
  • 0
Posted
54 minutes ago, gripao said:

he problem comes from the fact that there are files that do not come on Mobius. For example *.gameserver.model.actor.instance.L2PcInstance.java.

 

This is one of kind of differences that I described in first reply.

L2PcInstance in acis and Player in mobius

https://bitbucket.org/MobiusDev/l2j_mobius/src/master/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java

There could be a lot such diffs like class names, method names, variable names. This names could be very similar like sendClientPacket() in one sources and sendPacketToClient() in another, only understanding in lineage core logic and logical thinking could help to indicate how to adapt scripts between sources. Also don't forget to use IDE features like search, code analysis etc. this could help to understand which class method should be user to replace 

  • 0
Posted
21 hours ago, lvlkoo said:

 

This is one of kind of differences that I described in first reply.

L2PcInstance in acis and Player in mobius

https://bitbucket.org/MobiusDev/l2j_mobius/src/master/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/actor/Player.java

There could be a lot such diffs like class names, method names, variable names. This names could be very similar like sendClientPacket() in one sources and sendPacketToClient() in another, only understanding in lineage core logic and logical thinking could help to indicate how to adapt scripts between sources. Also don't forget to use IDE features like search, code analysis etc. this could help to understand which class method should be user to replace 

 

Hello! Thanks again!

 

Once I have decided to use Acis, I find that the version 401 that is published in gitlab does not have the L2PcInstance file either.

Do you know what it is? How could I get the original source code of the latest version of acis that does use L2PcInstance?

 

I download 401 from there: https://gitlab.com/Tryskell/acis_public

I downloaded 382 from there, too, and dont have L2PcInstance: https://gitlab.com/Tryskell/acis_public/-/tree/452cd109c3bce48416f74bba4daa8c3cf5dfc0a0

Same for 370 from 2019: https://gitlab.com/Tryskell/acis_public/-/tree/0f463e0ddc735955aea1c45d3faf3f0c2cea8aa9/aCis_gameserver

 

I am doing something wrong?

 

Why this have L2PcInstance? https://github.com/exvo23/l2jacis400

I tried to used but give me 2s total time when building aCis_datapack. aCis_gameserver build succesful.

 

Sorry for asking too much!! Thanks 😄

  • 0
Posted
2 hours ago, gripao said:

 

Hello! Thanks again!

 

Once I have decided to use Acis, I find that the version 401 that is published in gitlab does not have the L2PcInstance file either.

Do you know what it is? How could I get the original source code of the latest version of acis that does use L2PcInstance?

 

I download 401 from there: https://gitlab.com/Tryskell/acis_public

I downloaded 382 from there, too, and dont have L2PcInstance: https://gitlab.com/Tryskell/acis_public/-/tree/452cd109c3bce48416f74bba4daa8c3cf5dfc0a0

Same for 370 from 2019: https://gitlab.com/Tryskell/acis_public/-/tree/0f463e0ddc735955aea1c45d3faf3f0c2cea8aa9/aCis_gameserver

 

I am doing something wrong?

 

Why this have L2PcInstance? https://github.com/exvo23/l2jacis400

I tried to used but give me 2s total time when building aCis_datapack. aCis_gameserver build succesful.

 

Sorry for asking too much!! Thanks 😄

In acis L2PcInstance = Player

And many other things are just renamed.

Just check other similar files and compare what changed.

 

 

 

  • 0
Posted (edited)

If you see L2PcInstance on aCis, you shouldn't touch that with a stick. It can't be rev 400, it is before rev 367.

 

https://acis.i-live.eu/index.php?topic=30.msg49015;topicseen#msg49015

 

Many cleanups were done on aCis cycle 36 (360-369) to standardize names and make it friendlier/clearer. About that particular case of model.actor.instance, you got the complete explanation of changes in the dedicated changeset.

 

I made a lot of cleanup, which goes from classes to methods rename. Nowadays, those changes are listed under "Organization", in the changesets. That cleanup stabilized few years ago, and nowadays I got limited ideas of re-organization, meaning the pack structure will stay almost the same, now.

 

If you check aCis Creature class (L2Character on other packs), you will see it is roughly 2 times shorter than other packs. It's another type of cleaning, splitting the class in more little, dedicated classes (in that exemple, the move, attack and cast logics were moved to dedicated classes).

 

So, shortly said, I did numerous re-organizations, consisting to :

  • give proper naming convention to standardize method/class naming.
  • generate package to gather stuff (eg. the enums got their own package).
  • split complex classes in less complex classes (and generate package related to it)

Unfortunately, it means you have to adapt your customs if they were shared from another pack - which isn't a real problem, since anyway, 90% of shared diff patches aren't able to be applied directly.

 

If your diff patch can be applied directly, it means (pick 1) :

  • You were extremely lucky and the dude did the patch based on the exact same revision than you use (which is uncommon, moreover if the share is old)
  • You use a dead pack - shortly said, no editions were made during a big amount of time on extremely common classes, such as Player/L2PcInstance.

 

Edit : it got the old knownlist system too, which was deleted in rev 362 - so it's extremely old. In general, don't pick a pack from another source, you got no guarantee it's safe to be used (addition of keylogger/miner/virus/backdoors).

 

In a general matter, don't pick anything coded by a BR/RU. BR are scam masters (I couldn't meet 1 correct BR in 12y of coding), RU got 0 accuracy and 0 code description (but everything will "work").

Edited by Tryskell

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
Answer this question...

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



×
×
  • Create New...