TownyAdvanced / Towny

Towny Advanced Minecraft plugin for Bukkit/Spigot.
https://townyadvanced.github.io
Other
518 stars 356 forks source link

Suggestion: Ability to pay for "overclaim shield" #7008

Closed CorruptedGreed closed 8 months ago

CorruptedGreed commented 11 months ago

Please explain your feature request to the best of your abilities:

Overclaim shield

Add a toggleable upkeep option that would coincide with overclaim, acting as a "shield" to compensate for towns being over their limit. It would be dependent on how many townblocks a town is over its limit, and charge a proportional upkeep cost. This would allow towns to remain immune from takeoverclaim by another town, as long as they successfully pay the upkeep from last new day.

Disclaimer: All config variable and parameter names are a figment of my imagination, as they may be atrocious to the common developer’s eyes

The difference from normal upkeep

This option is different from the existing overclaim upkeep, which has a static cost. It introduces overclaimshield.upkeep.amount and overclaimshield.upkeep.blocks, which are proportional to each other. If upkeep.amount is set to 3, and upkeep.blocks is set to 8, then the price would be 3 money for every 8 townblocks over the town's limit.

For example: If a town is at 100/88 townblocks, they’d pay 6 money (3 money/8 townblocks = 6 money cost for 12 townblocks) a towny day. With upkeep.amount set to 1, they would only have to pay 2 money (for being charged 1 * 2 units of upkeep).

The current upkeep also deletes towns entirely if the upkeep penalty is not paid, which is incompatible with a less harsh approach of mitigating claim size dependent on the demand for the claimed area. A potential concern: Mayors of towns that are over their limit may have enough resources to maintain significant amounts of land using the shield feature. In this case (different from traditional static upkeep) servers can use the amount and block variables to configure an ideal "price per townblocks" for their server. This allows for flexibility between how much a server wants its mayors to recruit residents, and how much to pay regularly in alternative to prevent overclaim.

Usage

It would add a command for mayors /t toggle overclaimshield. Mayors would be prompted with a message on how much overclaim shield costs (showcasing how many upkeep.blocks per upkeep.amount) along with the calculated price for their town at that moment. After they choose to toggle, their town is slated to be charged for overclaim shield at however much their limit is over by once the next new day happens. After the new day, their town gets an overclaim-protected badge in their status screen. They would continue to make the appropriate payments every new day unless they toggle off.

In the event of the town having insufficient money at new day, their overclaim shield will be disabled. Mayors could have the following warning message presented to them on log-in/vault withdrawal/resident removal as a warning:

WARNING: Your town will lose its overclaim shield the next new day due to lack of money in your vault. You need [calculated money amount] in your town vault for protecting [chunks over limit] over your limit before the next new day. You currently have [money in vault].

Potential ways about implementation

I don't know which way would be easier, but this could be added through one of two following ways:

  1. Have [TakeoverClaim Available] still present on ChunkNotification, however just send an error message informing user that the town has overclaim shield active, preventing overclaim.

  2. Rework overclaim so that [TakeoverClaim Available] is not shown to players at all if the town has overclaim-protected flag (this is probably the better option)


Summarization of changes

LlmDl commented 11 months ago

Mentioned this on discord but also leaving it here for the record: