The-Fireplace-Minecraft-Mods / Clans

A Minecraft land protection and PVP mod
https://www.curseforge.com/minecraft/mc-mods/clans
GNU General Public License v3.0
5 stars 10 forks source link

Fix claim formula and disband not reflecting amounts properly #277

Closed ghost closed 2 years ago

ghost commented 2 years ago

The issue is, if you've set a formula like "10000*c", you would expect the c to be the current chunk you're claiming, so if it's the first one, it should be c=1. With the old code it's c=0, so the first claim is free.

The issue with disband is that it doesn't decrement the chunk count, when paying back the player per chunk and when the fomula uses chunks, the amount isn't the correct one. Which means the amount the player receives is not the one they invested. You create funds out of nothing with the "10000*c" formula this way, it doesn't make sense.

A fix for the chunk count when sending the clans info to the player is added to compensate for the new changes, because otherwise it will show one chunk ahead.

Fix issue: https://github.com/The-Fireplace-Minecraft-Mods/Clans/issues/274

The-Fireplace commented 2 years ago

I think I'm going to try something a little more robust to address this issue instead of manipulating the claim count strangely. I appreciate the explanation and the code example of where it was going wrong, that helped me get a fix together quicker.

The-Fireplace commented 2 years ago

My solution, in case you're curious https://github.com/The-Fireplace-Minecraft-Mods/Clans/commit/7e7e085692573d169a0a1d077aad3203021dc0cc

ghost commented 2 years ago

I think I'm going to try something a little more robust to address this issue instead of manipulating the claim count strangely.

I'm really happy that you did, because I wasn't completely confident in my solution. :laughing:

This was just what I got, trying to understand the code and trying not to bloat my solution.

My solution, in case you're curious https://github.com/The-Fireplace-Minecraft-Mods/Clans/commit/7e7e085692573d169a0a1d077aad3203021dc0cc

Thank you for looking into it and making a commit! Your solution looks good, I tested it and it seems to work as it should.