Skip to content

Commit

Permalink
Added a new setting under War events 'towns_are_neutral'. If set to
Browse files Browse the repository at this point in the history
false, all towns not in nations are attackable during a war event.
  • Loading branch information
ElgarL committed Mar 19, 2012
1 parent c1c53ae commit c7044a7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1226,4 +1226,5 @@ v0.79.1.3:
- Death events in non-towny worlds are no longer tracked for war or death payments.
v0.79.1.4:
- First beta of SQL database handling (MYSQL only at the moment).
- Add support for h2/sqlite SQL formats.
- Add support for h2/sqlite SQL formats.
- Added a new setting under War events 'towns_are_neutral'. If set to false, all towns not in nations are attackable during a war event.
3 changes: 3 additions & 0 deletions src/com/palmergames/bukkit/config/ConfigNodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ public enum ConfigNodes {
"############################################################", ""),
WARTIME_NATION_CAN_BE_NEUTRAL("war.nation_can_be_neutral","true",
"#This setting allows you disable the ability for a nation to pay to remain neutral during a war."),

WAR_EVENT("war.event", "",
"", "",
"############################################################",
Expand All @@ -574,6 +575,8 @@ public enum ConfigNodes {
"# The remaining half is paid to the town which took the most town blocks, and lost the least.",
""),
WAR_EVENT_WARNING_DELAY("war.event.warning_delay","30"),
WAR_EVENT_TOWNS_NEUTRAL("war.event.towns_are_neutral","true",
"#If false all towns not in nations can be attacked during a war event."),
WAR_EVENT_REMOVE_ON_MONARCH_DEATH("war.event.remove_on_monarch_death","false", "", "# If true and the monarch/king dies the nation is removed from the war."),
WAR_EVENT_BLOCK_GRIEFING("war.event.allow_block_griefing","true", "# If enabled players will be able to break/place blocks in enemy plots during a war."),

Expand Down
4 changes: 4 additions & 0 deletions src/com/palmergames/bukkit/towny/TownySettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,10 @@ public static int getWarTimeWarningDelay() {
return getInt(ConfigNodes.WAR_EVENT_WARNING_DELAY);
}

public static boolean isWarTimeTownsNeutral() {
return getBoolean(ConfigNodes.WAR_EVENT_TOWNS_NEUTRAL);
}

public static boolean isAllowWarBlockGriefing() {
return getBoolean(ConfigNodes.WAR_EVENT_BLOCK_GRIEFING);
}
Expand Down
17 changes: 12 additions & 5 deletions src/com/palmergames/bukkit/towny/object/CachePermissions.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,19 @@ public TownBlockStatus getStatusCache(Player player, WorldCoord worldCoord) {

try {
// War Time switch rights
if (isWarTime() && TownySettings.isAllowWarBlockGriefing())
try {
if (!resident.getTown().getNation().isNeutral() && !town.getNation().isNeutral())
return TownBlockStatus.WARZONE;
} catch (NotRegisteredException e) {
if (isWarTime()) {
if (TownySettings.isAllowWarBlockGriefing()) {
try {
if (!resident.getTown().getNation().isNeutral() && !town.getNation().isNeutral())
return TownBlockStatus.WARZONE;
} catch (NotRegisteredException e) {

}
}
//If this town is not in a nation and we are set to non neutral status during war.
if (!TownySettings.isWarTimeTownsNeutral() && !town.hasNation())
return TownBlockStatus.WARZONE;
}

// Town Owner Override
try {
Expand Down

0 comments on commit c7044a7

Please sign in to comment.