Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add admin town command upkeep toggle #6052

Merged
merged 2 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 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.154
version: 0.155
language: english
author: ElgarL
website: 'http://townyadvanced.github.io/'
Expand Down Expand Up @@ -1751,4 +1751,8 @@ msg_purchased_blocks_unset: 'The town %s has had their purchased townblocks remo
msg_purchased_blocks_changed: 'The town %s has been given %s bought townblocks, they currently have %s bought townblocks.'

#Added in 0.154
msg_comptype_upkeep: 'Upkeep'
msg_comptype_upkeep: 'Upkeep'

# Added in 0.155
# Message shown when toggling town upkeep admin setting
msg_town_upkeep_setting_set_to: 'The town %s has had their upkeep setting set to %s.'
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public class TownyAdminCommand extends BaseCommand implements CommandExecutor {
"forcemerge"
);
private static final List<String> adminTownToggleTabCompletes = Stream.concat(TownCommand.townToggleTabCompletes.stream(),
Arrays.asList("forcepvp", "unlimitedclaims").stream()).collect(Collectors.toList());
Arrays.asList("forcepvp", "unlimitedclaims", "upkeep").stream()).collect(Collectors.toList());

private static final List<String> adminNationTabCompletes = Arrays.asList(
"add",
Expand Down Expand Up @@ -1333,6 +1333,11 @@ public void parseAdminTownCommand(String[] split) throws TownyException {
town.setHasUnlimitedClaims(choice.orElse(!town.hasUnlimitedClaims()));
town.save();
TownyMessaging.sendMsg(sender, Translatable.of("msg_town_unlimitedclaims_setting_set_to", town.getName(), town.hasUnlimitedClaims()));
} else if (split[2].equalsIgnoreCase("upkeep")) {

town.setHasUpkeep(choice.orElse(!town.hasUpkeep()));
town.save();
TownyMessaging.sendMsg(sender, Translatable.of("msg_town_upkeep_setting_set_to", town.getName(), town.hasUpkeep()));
} else
TownCommand.townToggle(sender, StringMgmt.remArgs(split, 2), true, town);

Expand Down