Skip to content

Commit

Permalink
Add message denying capital cities the ability to toggle their peaceful
Browse files Browse the repository at this point in the history
status, when the feature is enabled.
  • Loading branch information
LlmDl committed Oct 11, 2021
1 parent ee88589 commit 2ec01e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion resources/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6830,4 +6830,5 @@ v0.92.0.11:
- Closes #5360.
- New Config Option: global_nation_settings.capitals_cannot_be_neutral
- Default: false
- If true the capital city of nation cannot be neutral/peaceful.
- If true the capital city of nation cannot be neutral/peaceful.
- Bump language file to 0.128.
9 changes: 7 additions & 2 deletions resources/lang/en-US.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Towny
version: 0.127
version: 0.128
language: english
author: ElgarL
website: 'http://townyadvanced.github.io/'
Expand Down Expand Up @@ -1583,4 +1583,9 @@ msg_purge_complete: 'Resident purge complete: %s deleted.'
#Message to the Town, shown when a town is given bonus blocks.
msg_you_have_been_given_bonus_blocks: 'You have been given %s bonus townblocks.'
#Message shown when a town cannot purchase any more bonus blocks.
msg_err_you_cannot_purchase_any_more_bonus_blocks: 'Your town cannot purchase any more bonus blocks. Maximum amount reached.'
msg_err_you_cannot_purchase_any_more_bonus_blocks: 'Your town cannot purchase any more bonus blocks. Maximum amount reached.'

#Added in 0.128

#Message shown to a capital city which is being denied the ability to toggle peaceful on.
msg_err_capital_cannot_be_peaceful: 'Capital cities cannot toggle peaceful status.'
3 changes: 3 additions & 0 deletions src/com/palmergames/bukkit/towny/command/TownCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,9 @@ public static void townToggle(CommandSender sender, String[] split, boolean admi
boolean peacefulState = choice.orElse(!town.isNeutral());
double cost = TownySettings.getTownNeutralityCost();

if (TownySettings.nationCapitalsCantBeNeutral() && town.isCapital())
throw new TownyException(Translatable.of("msg_err_capital_cannot_be_peaceful"));

if (town.isNeutral() && peacefulState) throw new TownyException(Translatable.of("msg_town_already_peaceful"));
else if (!town.isNeutral() && !peacefulState) throw new TownyException(Translatable.of("msg_town_already_not_peaceful"));

Expand Down

0 comments on commit 2ec01e4

Please sign in to comment.