What is the issue? I'm a Minecraft server admin/ server host / plugin developer, but find it an absolute annoyance to have to update my own personal plugins on every new release of the core game. It wasn't always like this, I've had plugins work across 20 versions without breaking in the past. To have to sit by and update 40 plugins once every month is, as you can imagine, an unneeded annoyance in my life considering I've never had to do this in the past.
What is causing the issue? Upon each new release, they require you to use different imports in your compiled jar files, thus forcibly breaking any outdated (but possibly still working) jar files. Believe me. I can read an error log and know when I need to actually go out and download a new update. I don't need to be protected from myself right now. It's just a game, I don't have much riding on it.
So what do I want to do about it? To this end, I'd like to make a simple program that automatically updates all my plugins for me. (Plugins come in the form of packaged .jar files.) It needs to do the following:
- Get a list of all jar files in X_Folder
- for each jar file, get all classes encased.
- for each class file, search for any instance of Y_STRING and replace it with Z_STRING.
- make sure everything gets put back into the jar files correctly.
- done.
Question? How would I code the class file editing method? I don't even know how to begin.
Disclaimer Sorry for sounding like I haven't even begun working on this. I just, don't have any experience with byte code manipulation. I've seen a few examples, but haven't seen anything about renaming imports yet. Hopefully someone here can help me. Thank you!