Skip to content

Commit

Permalink
feat: Only apply wartime flags to combatants, close #378
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Dec 14, 2023
1 parent 498c1a1 commit f01a5a3
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ private boolean cancelOperation(@NotNull Operation operation, @NotNull TownClaim
final Town town = townClaim.town();
final Claim claim = townClaim.claim();

// Apply wartime flags if the town is at war
// Apply wartime flags if the user is active in a town that is at war
if (plugin.getSettings().doTownWars() && plugin.getSettings().doTownRelations() &&
town.getCurrentWar().map(war -> war.getDefending() == town.getId()).orElse(false)) {
town.getCurrentWar().map(war -> war.getDefending() == town.getId() && operation.getUser()
.map(online -> war.isPlayerActive(online.getUuid()))
.orElse(false))
.orElse(false)) {
return plugin.getRulePresets().getWarRules().cancelOperation(operation.getType(), plugin.getFlags());
}

Expand Down

0 comments on commit f01a5a3

Please sign in to comment.