Skip to content

Commit

Permalink
Merge pull request #438 from joserobjr/town-delete
Browse files Browse the repository at this point in the history
Change: Mayor will not be allowed to delete a town with sold plots
  • Loading branch information
krwminer committed Dec 27, 2015
2 parents 96a2262 + 0085164 commit 803f69c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/mytown/commands/CommandsAssistant.java
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,13 @@ public static CommandResponse leaveDeleteCommand(ICommandSender sender, List<Str
EntityPlayer player = (EntityPlayer) sender;

if (town.residentsMap.get(res).getType() == Rank.Type.MAYOR) {
for(Plot plot: town.plotsContainer) {
if(!plot.ownersContainer.contains(res)) {
res.sendMessage(getLocal().getLocalization("mytown.notification.town.delete.with-plots"));
return CommandResponse.DONE;
}
}

town.notifyEveryone(getLocal().getLocalization("mytown.notification.town.deleted", town.getName(), res.getPlayerName()));
int refund = 0;
for (TownBlock block : town.townBlocksContainer) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/mytown/localization/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ mytown.cmd.err.claim.tooClose=&cYou are too close to town %s. Please leave at le
mytown.cmd.err.resident.maxTowns=&cYou cannot create/join any more towns, you have hit the maximum amount of towns you can be in
mytown.notification.town.created=&aTown %s created
mytown.notification.town.deleted=&cTown %s deleted
mytown.notification.town.deleted.withplots=&cYou cannot delete towns with plots that you don't own
mytown.notification.nation.created=Nation %s created
mytown.notification.nation.deleted=Nation %s deleted

Expand Down

0 comments on commit 803f69c

Please sign in to comment.