Fire protection is back.

Found a way to make it cheaper - we'll see how the new cost looks on
production servers.
This commit is contained in:
ryanhamshire 2016-04-13 21:05:19 -07:00
parent 9e8376a6a6
commit 26484e71e7
2 changed files with 21 additions and 27 deletions

View File

@ -87,7 +87,6 @@ public class GriefPrevention extends JavaPlugin
public boolean config_claims_preventTheft; //whether containers and crafting blocks are protectable public boolean config_claims_preventTheft; //whether containers and crafting blocks are protectable
public boolean config_claims_protectCreatures; //whether claimed animals may be injured by players without permission public boolean config_claims_protectCreatures; //whether claimed animals may be injured by players without permission
public boolean config_claims_protectFires; //whether open flint+steel flames should be protected - optional because it's expensive
public boolean config_claims_protectHorses; //whether horses on a claim should be protected by that claim's rules public boolean config_claims_protectHorses; //whether horses on a claim should be protected by that claim's rules
public boolean config_claims_preventButtonsSwitches; //whether buttons and switches are protectable public boolean config_claims_preventButtonsSwitches; //whether buttons and switches are protectable
public boolean config_claims_lockWoodenDoors; //whether wooden doors should be locked by default (require /accesstrust) public boolean config_claims_lockWoodenDoors; //whether wooden doors should be locked by default (require /accesstrust)
@ -514,7 +513,6 @@ public class GriefPrevention extends JavaPlugin
this.config_claims_preventTheft = config.getBoolean("GriefPrevention.Claims.PreventTheft", true); this.config_claims_preventTheft = config.getBoolean("GriefPrevention.Claims.PreventTheft", true);
this.config_claims_protectCreatures = config.getBoolean("GriefPrevention.Claims.ProtectCreatures", true); this.config_claims_protectCreatures = config.getBoolean("GriefPrevention.Claims.ProtectCreatures", true);
this.config_claims_protectFires = config.getBoolean("GriefPrevention.Claims.ProtectFires", false);
this.config_claims_protectHorses = config.getBoolean("GriefPrevention.Claims.ProtectHorses", true); this.config_claims_protectHorses = config.getBoolean("GriefPrevention.Claims.ProtectHorses", true);
this.config_claims_preventButtonsSwitches = config.getBoolean("GriefPrevention.Claims.PreventButtonsSwitches", true); this.config_claims_preventButtonsSwitches = config.getBoolean("GriefPrevention.Claims.PreventButtonsSwitches", true);
this.config_claims_lockWoodenDoors = config.getBoolean("GriefPrevention.Claims.LockWoodenDoors", false); this.config_claims_lockWoodenDoors = config.getBoolean("GriefPrevention.Claims.LockWoodenDoors", false);
@ -755,7 +753,6 @@ public class GriefPrevention extends JavaPlugin
outConfig.set("GriefPrevention.Claims.LockTrapDoors", this.config_claims_lockTrapDoors); outConfig.set("GriefPrevention.Claims.LockTrapDoors", this.config_claims_lockTrapDoors);
outConfig.set("GriefPrevention.Claims.LockFenceGates", this.config_claims_lockFenceGates); outConfig.set("GriefPrevention.Claims.LockFenceGates", this.config_claims_lockFenceGates);
outConfig.set("GriefPrevention.Claims.EnderPearlsRequireAccessTrust", this.config_claims_enderPearlsRequireAccessTrust); outConfig.set("GriefPrevention.Claims.EnderPearlsRequireAccessTrust", this.config_claims_enderPearlsRequireAccessTrust);
outConfig.set("GriefPrevention.Claims.ProtectFires", this.config_claims_protectFires);
outConfig.set("GriefPrevention.Claims.ProtectHorses", this.config_claims_protectHorses); outConfig.set("GriefPrevention.Claims.ProtectHorses", this.config_claims_protectHorses);
outConfig.set("GriefPrevention.Claims.InitialBlocks", this.config_claims_initialBlocks); outConfig.set("GriefPrevention.Claims.InitialBlocks", this.config_claims_initialBlocks);
outConfig.set("GriefPrevention.Claims.BlocksAccruedPerHour", this.config_claims_blocksAccruedPerHour); outConfig.set("GriefPrevention.Claims.BlocksAccruedPerHour", this.config_claims_blocksAccruedPerHour);

View File

@ -1590,14 +1590,9 @@ class PlayerEventHandler implements Listener
PlayerData playerData = null; PlayerData playerData = null;
if(action == Action.LEFT_CLICK_BLOCK && clickedBlock != null) if(action == Action.LEFT_CLICK_BLOCK && clickedBlock != null)
{ {
//exception for blocks on a specific watch list Block adjacentBlock = clickedBlock.getRelative(event.getBlockFace());
if(!this.onLeftClickWatchList(clickedBlockType) && !GriefPrevention.instance.config_mods_accessTrustIds.Contains(new MaterialInfo(clickedBlock.getTypeId(), clickedBlock.getData(), null))) byte lightLevel = adjacentBlock.getLightFromBlocks();
{ if(lightLevel == 15 && adjacentBlock.getType() == Material.FIRE)
//and an exception for putting our fires
if(GriefPrevention.instance.config_claims_protectFires && event.getClickedBlock() != null)
{
Block adjacentBlock = event.getClickedBlock().getRelative(event.getBlockFace());
if(adjacentBlock.getType() == Material.FIRE)
{ {
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId()); if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim); Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim);
@ -1615,8 +1610,10 @@ class PlayerEventHandler implements Listener
} }
} }
} }
}
//exception for blocks on a specific watch list
if(!this.onLeftClickWatchList(clickedBlockType) && !GriefPrevention.instance.config_mods_accessTrustIds.Contains(new MaterialInfo(clickedBlock.getTypeId(), clickedBlock.getData(), null)))
{
return; return;
} }
} }