Special Custom Class Development

I need a couple pointers on setting up custom classes in special circumstances. The special circumstances are as follows: Using a custom class in vassal where the class extends an existing class and must override external members of the original package that are “protected”. Normally, this is not possible, but @Brent_Easton has indicated that I can bring over a whole package into my custom class file in order to make my custom class a member of the package. I could therefore override whatever I needed in the package members. Presumably, this would supplant the original package with the modified package at runtime. The only problem is, this whole procedure is a new idea to me and I’m not sure what needs to be done to pull it off.

Hi Harald,

The first place to start is to fork the vassal-module-template repository. This will have a maven pom.xml all set up and ready to go, you shouldn’t have to change it. With an IDE like Intellij, just open the pom.xml and maven will do the rest. The pom.xml is already set up pointing to the latest Vassal source and the dependencies you need.

Thinking about it further, I don’t believe it is possible any longer to over-ride code in core Vassal with the same classes in custom code. It was a security loophole. Instead, you need to replace VASSAL components referenced in the buildfile with copied versions of your own.

From the Vassal source, copy the folder VASSAL/build/module/turn over to the my_custom_component folder in your new module template. Change the package declarations in the new source from VASSAL.build.module.turn to my_custom_component.turn.

Then, in your buildfile of the module, change any occurence of VASSAL.build.module.turn to my_custom_component.turn.

After copying the my_custom_component folder from the target/classes folder into your module, plus the new buildfile, you should be ready go, running your custom version of the turn tracker.

If the changes you need end up incorporated into base vassal, you can just reverse the process to revert to a Vanilla turn tracker.

BEaston,

I really appreciate you taking the time to step through this for me. I’m going to make another pass at it and see what happens. It would be nice to get this figured out.

Best regards,
Harald

1 Like

Incidentally, when you have a moment (take your time) do you have a Vassal use-case for a (Maven) WAR Overlay? Is this a technique we might use?

Sorry, I have no idea what that means or how we would use it. I just read an article about it and I still have no clue! Happy to be educated :slight_smile:

Heh, no worries, that’s about where I am with it. Before you got back to me I was hunting around for some clue about how to get done what I needed and that was the only thing that looked like it could fit the bill.
-Cheers

BEASTon rocks! This worked like a charm. Thank you very much! :+1:

1 Like