Sign in to follow this  
Alexgopen

Most requests require modding server.jar

Recommended Posts

Has anyone had any luck with this yet? So far I've been unable to get a working successfully recompiled server.jar with any changes I made.

Share this post


Link to post
Share on other sites

I did it only to test out the process myself, and it worked for that.  Others I know have changed small things like the default starting inventory etc.


Share this post


Link to post
Share on other sites

Would you be up for posting how/where you failed Alex, so others can learn too?


Share this post


Link to post
Share on other sites

Others I know have changed small things like the default starting inventory etc.

 

Would be great if methods for doing this were shared.

  • Like 2

Share this post


Link to post
Share on other sites

Alright i got the digging working like mining where it places the dirt on the ground.


 


Process of making most mods seems to be:


 


Decompile server.jar


Copy class you want to edit to your IDE of choice


Include all required libraries


Edit the decompiled class's code to correct mistakes made by the decompiler (comparing booleans to ints, renaming variables, missing brackets, etc)


Make your changes to class for your mod, recompile your .java file to .class


Copy your new .class into the correct directory in server.jar


Launch your server and enjoy your new mod

Share this post


Link to post
Share on other sites

Not familiar with Java namespaces but surely it has a way to override classes without having to do it all in one source


file?  Pretty much a fundamental principle of object oriented programming.


Share this post


Link to post
Share on other sites

Here is what I did.


 


Do not use jd-gui to decompile, you will just have hundreds of errors on recompile...


 


 


So what worked.  eclipse and ce are free, just download them:


  • decompile with CE

  • used eclipse to load in the reference libraries (server.jar, common.jar)  and all the files in the lib directory

  • load in your decompiled class (now a .java) that you want to edit.

  • rename the container object thing (don't know the term) in eclipse to match the com.wurmonline.server.(whatever it is) (this is the header of where the .java you brought in is.  if you don't rename it, there is an error.  maybe a java person can explain it better, it just has to be done and I did what others told me to do)

  • then you are basically done with the code, eclipse defaults to autocompile so go to the folder for it and it will have the .class file.

  • take that class file and put it back into the server.jar replacing the old one.

  • Like 1

Share this post


Link to post
Share on other sites
So what worked.  eclipse and ce are free, just download them:

  • decompile with CE

 

I can't seem to find "CE" can you link to the specific software you are speaking about?

Share this post


Link to post
Share on other sites

 

Here is what I did.

 

Do not use jd-gui to decompile, you will just have hundreds of errors on recompile...

 

 

So what worked.  eclipse and ce are free, just download them:

  • decompile with CE

used eclipse to load in the reference libraries (server.jar, common.jar)  and all the files in the lib directory

load in your decompiled class (now a .java) that you want to edit.

rename the container object thing (don't know the term) in eclipse to match the com.wurmonline.server.(whatever it is) (this is the header of where the .java you brought in is.  if you don't rename it, there is an error.  maybe a java person can explain it better, it just has to be done and I did what others told me to do)

then you are basically done with the code, eclipse defaults to autocompile so go to the folder for it and it will have the .class file.

take that class file and put it back into the server.jar replacing the old one.

 

 

Yeah I was using jd-gui initially but switched to procyon when jg-gui was unable to decompile a bunch of methods that I had to change to allow deeding near the start deed or non allied deeds.  Our pvp server is not set to be like epic or challenge, because we didn't want the curve, but as such you aren't allowed to deed within 100 tiles of another deed unless you share an alliance.  Seems to be working alright except for in classes with embedded sql, because I'm not exactly sure how to compile those correctly yet.  Haven't gotten that far in my databases course :P

 

All I wanted to do was set boolean allianceOnly = false in Villages.class, but the server just crashes on start when I reinsert this class after decompiling, even if I make no changes. x-x

Edited by Alexgopen

Share this post


Link to post
Share on other sites

Some have said they are making a framework, once that is in place it will let you make changes without digging into the code, so just have to wait a bit for things to develop more.


Share this post


Link to post
Share on other sites

I can't seem to find "CE" can you link to the specific software you are speaking about?

 

I have no luck finding this "CE" either.

Share this post


Link to post
Share on other sites

I have no luck finding this "CE" either.

 

I asked on IRC - I was given this: http://sourceforge.net/projects/classeditor/files/classeditor/2.23/

 

I can't get it to actually open any .jar files though, and there isn't much support available for it.. It just says "Reading Class C:\...server.jar" and does nothing else. I can however create a new .jar and the features seem to work.

 

JD-GUI is definitely opening these class files instantly but are creating recomp issues.

Share this post


Link to post
Share on other sites

I asked on IRC - I was given this: http://sourceforge.net/projects/classeditor/files/classeditor/2.23/

 

I can't get it to actually open any .jar files though, and there isn't much support available for it.. It just says "Reading Class C:\...server.jar" and does nothing else. I can however create a new .jar and the features seem to work.

 

JD-GUI is definitely opening these class files instantly but are creating recomp issues.

 

I was using JD-GUI initially, but it would have many many decompilation errors, and usually decompiled parts of classes wrong, which then required me to manually go in and correct errors.  It would often fail to decompile entire methods however, which I then could not fix manually, because I couldn't know what they were supposed to do. 

 

I ended up switching to a different decompiler called procyon. It works much better and has very very few errors in the code after decompiling.  I'd say about 95% of the classes fully decompile correctly when using procyon, as opposed to maybe around 30% without decompilation errors from JD-GUI. 

 

I'd highly recommend using procyon as it's the best decompiler I've found so far, and upon asking other programmer friends of mine what decompiler they thought was the best, they also stated procyon.  If anyone finds one that works better than procyon, or know of another one that they think is the best, feel free to share.  There's still a small fraction of the server jar that it has trouble with. 

 

 

Edit: seeing as we're intended to use decompilers to edit the code and write mods, we might as well just be given source code in the first place *hint hint*

Edited by Alexgopen
  • Like 1

Share this post


Link to post
Share on other sites

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
Sign in to follow this