How many times you reload your script during development? If the answer is many, I suggest you take a look at this little tool.
ScriptPublisher helps you copy over the files from your project directory to the corresponding script directory on your L2J-driven server and reload it using telnet commands. For telnet to work properly, it requires telnet to be activated in Telnet.properties.
ScriptPublisher works based on 3 tasks:
- collect the arguments passed to it and perform a simple sanity check
- execute the copy task
- execute the telnet task if the copy task was successful
I defined an external tool in Eclipse. This tool is a launch configuration.
There you specify the location (in this case you need to specify the location to the java.exe file, which will execute the jar), working directory (where your ScriptPublisher.jar file is) and arguments. In my case the arguments look like this:
Code: Select all
-jar ScriptPublisher.jar script ${project_source} ${server_source} custom\scripts\communityboard CommunityBoardScript.java true 127.0.0.1 54321
- -jar means, that we are executing a jar file
- ScriptPublisher.jar is the program itself (it's a runnable jar, which give you further information on command line)
- script states what kind of element will be reloaded; currently "script" is the only value allowed, but "skills", "items" etc. might be added later in order to ease the reloading of corresponding XMLs
- {project_source} is the project folder, which contains your scripts in question (e.g. C:\dev\ScriptProject\src)
- {server_source} is the server root folder; further folders are appended automatically
- custom\scripts\communityboard folder structure for your script (should be the same as the package your script is in)
- CommunityBoardScript.java filename of the class, which extends L2Script and contains main method; this is used when reloading script via telnet
- true means, that we want to reload HTML files afterwards, too
- 127.0.0.1 telnet host
- 54321 telnet port
you may append a password if you have one set for telnet access
Further more ScriptPublisher has a few JUnit4 tests - they ensure the functionality of the Task classes. I use Mockito for easier mocking and verification of objects - however: the coverage is rather bad, because I was rather lazy. I still hope it works for you.
If you need more in-depth help, try executing "java -jar ScriptPublisher.jar" on the command line. It will give you some more information about the arguments as well as the values.
I also include a simple "how-to-use" file as well as an example launch configuration.
Feel free to ask any questions you have.
Questions:
- does that work on Linux, too? No as I screwed up the slashes - might correct that later if someone wants to use it on a linux-based machine.
- I don't use telnet - can this program still be useful for me? Yes! It can copy the files and folders for you. For that to work, just enter reload type, project- and server-source folders and the script folder and don't enter telnet-related information at all.
GIT-repository: https://github.com/divStar/ScriptPublisher
binary version: https://github.com/divStar/ScriptPublis ... lisher.jar (click on "Raw" to download)