Option to globaly allow use of spawner egg (#91)

If enabled, players are allowed to place mob spawn eggs inn all claims (including admin claims).
This commit is contained in:
Erik1988 2017-02-19 20:32:33 +01:00 committed by RoboMWM
parent b8a5cb79d1
commit b81e802b79
2 changed files with 7 additions and 3 deletions

View File

@ -90,6 +90,7 @@ public class GriefPrevention extends JavaPlugin
public ConcurrentHashMap<World, ClaimsMode> config_claims_worldModes;
private boolean config_creativeWorldsExist; //note on whether there are any creative mode worlds, to save cpu cycles on a common hash lookup
public boolean config_claims_preventGlobalMonsterEggs; //whether monster eggs can be placed regardless of trust.
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_protectHorses; //whether horses on a claim should be protected by that claim's rules
@ -213,6 +214,7 @@ public class GriefPrevention extends JavaPlugin
private String databaseUrl;
private String databaseUserName;
private String databasePassword;
//reference to the economy plugin, if economy integration is enabled
public static Economy economy = null;
@ -527,6 +529,7 @@ public class GriefPrevention extends JavaPlugin
this.config_seaLevelOverride.put(worlds.get(i).getName(), seaLevelOverride);
}
this.config_claims_preventGlobalMonsterEggs = config.getBoolean("GriefPrevention.Claims.PreventGlobalMonsterEggs", true);
this.config_claims_preventTheft = config.getBoolean("GriefPrevention.Claims.PreventTheft", true);
this.config_claims_protectCreatures = config.getBoolean("GriefPrevention.Claims.ProtectCreatures", true);
this.config_claims_protectHorses = config.getBoolean("GriefPrevention.Claims.ProtectHorses", true);
@ -783,8 +786,9 @@ public class GriefPrevention extends JavaPlugin
return;
}
outConfig.set("GriefPrevention.Claims.PreventTheft", this.config_claims_preventTheft);
outConfig.set("GriefPrevention.Claims.PreventGlobalMonsterEggs", this.config_claims_preventGlobalMonsterEggs);
outConfig.set("GriefPrevention.Claims.PreventTheft", this.config_claims_preventTheft);
outConfig.set("GriefPrevention.Claims.ProtectCreatures", this.config_claims_protectCreatures);
outConfig.set("GriefPrevention.Claims.PreventButtonsSwitches", this.config_claims_preventButtonsSwitches);
outConfig.set("GriefPrevention.Claims.LockWoodenDoors", this.config_claims_lockWoodenDoors);

View File

@ -1730,7 +1730,7 @@ class PlayerEventHandler implements Listener
Material materialInHand = itemInHand.getType();
//if it's bonemeal, armor stand, spawn egg, etc - check for build permission (ink sac == bone meal, must be a Bukkit bug?)
if(clickedBlock != null && (materialInHand == Material.INK_SACK || materialInHand == Material.ARMOR_STAND || materialInHand == Material.MONSTER_EGG || materialInHand == Material.END_CRYSTAL))
if(clickedBlock != null && (materialInHand == Material.INK_SACK || materialInHand == Material.ARMOR_STAND || (materialInHand == Material.MONSTER_EGG && GriefPrevention.instance.config_claims_preventGlobalMonsterEggs) || materialInHand == Material.END_CRYSTAL))
{
String noBuildReason = instance.allowBuild(player, clickedBlock.getLocation(), clickedBlockType);
if(noBuildReason != null)