Better config control over villager protections.
Now disabling creature protections allows players to injure villagers without permission in land claims, and whether trading with villagers requires permission is now an option in the config file, with default on.
This commit is contained in:
parent
8ff15fbd00
commit
d861688c04
|
|
@ -662,6 +662,9 @@ class EntityEventHandler implements Listener
|
||||||
|| subEvent.getEntityType() == EntityType.ARMOR_STAND
|
|| subEvent.getEntityType() == EntityType.ARMOR_STAND
|
||||||
|| subEvent.getEntityType() == EntityType.VILLAGER)
|
|| subEvent.getEntityType() == EntityType.VILLAGER)
|
||||||
{
|
{
|
||||||
|
//allow for disabling villager protections in the config
|
||||||
|
if(subEvent.getEntityType() == EntityType.VILLAGER && !GriefPrevention.instance.config_claims_protectCreatures) return;
|
||||||
|
|
||||||
//decide whether it's claimed
|
//decide whether it's claimed
|
||||||
Claim cachedClaim = null;
|
Claim cachedClaim = null;
|
||||||
PlayerData playerData = null;
|
PlayerData playerData = null;
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ public class GriefPrevention extends JavaPlugin
|
||||||
public int config_claims_maxClaimsPerPlayer; //maximum number of claims per player
|
public int config_claims_maxClaimsPerPlayer; //maximum number of claims per player
|
||||||
public boolean config_claims_respectWorldGuard; //whether claim creations requires WG build permission in creation area
|
public boolean config_claims_respectWorldGuard; //whether claim creations requires WG build permission in creation area
|
||||||
public boolean config_claims_portalsRequirePermission; //whether nether portals require permission to generate. defaults to off for performance reasons
|
public boolean config_claims_portalsRequirePermission; //whether nether portals require permission to generate. defaults to off for performance reasons
|
||||||
|
public boolean config_claims_villagerTradingRequiresTrust; //whether trading with a claimed villager requires permission
|
||||||
|
|
||||||
public int config_claims_initialBlocks; //the number of claim blocks a new player starts with
|
public int config_claims_initialBlocks; //the number of claim blocks a new player starts with
|
||||||
public double config_claims_abandonReturnRatio; //the portion of claim blocks returned to a player when a claim is abandoned
|
public double config_claims_abandonReturnRatio; //the portion of claim blocks returned to a player when a claim is abandoned
|
||||||
|
|
@ -506,6 +507,7 @@ public class GriefPrevention extends JavaPlugin
|
||||||
this.config_claims_maxClaimsPerPlayer = config.getInt("GriefPrevention.Claims.MaximumNumberOfClaimsPerPlayer", 0);
|
this.config_claims_maxClaimsPerPlayer = config.getInt("GriefPrevention.Claims.MaximumNumberOfClaimsPerPlayer", 0);
|
||||||
this.config_claims_respectWorldGuard = config.getBoolean("GriefPrevention.Claims.CreationRequiresWorldGuardBuildPermission", true);
|
this.config_claims_respectWorldGuard = config.getBoolean("GriefPrevention.Claims.CreationRequiresWorldGuardBuildPermission", true);
|
||||||
this.config_claims_portalsRequirePermission = config.getBoolean("GriefPrevention.Claims.PortalGenerationRequiresPermission", false);
|
this.config_claims_portalsRequirePermission = config.getBoolean("GriefPrevention.Claims.PortalGenerationRequiresPermission", false);
|
||||||
|
this.config_claims_villagerTradingRequiresTrust = config.getBoolean("GriefPrevention.Claims.VillagerTradingRequiresPermission", true);
|
||||||
String accessTrustSlashCommands = config.getString("GriefPrevention.Claims.CommandsRequiringAccessTrust", "/sethome");
|
String accessTrustSlashCommands = config.getString("GriefPrevention.Claims.CommandsRequiringAccessTrust", "/sethome");
|
||||||
|
|
||||||
this.config_spam_enabled = config.getBoolean("GriefPrevention.Spam.Enabled", true);
|
this.config_spam_enabled = config.getBoolean("GriefPrevention.Spam.Enabled", true);
|
||||||
|
|
@ -728,6 +730,7 @@ public class GriefPrevention extends JavaPlugin
|
||||||
outConfig.set("GriefPrevention.Claims.MaximumNumberOfClaimsPerPlayer", this.config_claims_maxClaimsPerPlayer);
|
outConfig.set("GriefPrevention.Claims.MaximumNumberOfClaimsPerPlayer", this.config_claims_maxClaimsPerPlayer);
|
||||||
outConfig.set("GriefPrevention.Claims.CreationRequiresWorldGuardBuildPermission", this.config_claims_respectWorldGuard);
|
outConfig.set("GriefPrevention.Claims.CreationRequiresWorldGuardBuildPermission", this.config_claims_respectWorldGuard);
|
||||||
outConfig.set("GriefPrevention.Claims.PortalGenerationRequiresPermission", this.config_claims_portalsRequirePermission);
|
outConfig.set("GriefPrevention.Claims.PortalGenerationRequiresPermission", this.config_claims_portalsRequirePermission);
|
||||||
|
outConfig.set("GriefPrevention.Claims.VillagerTradingRequiresPermission", this.config_claims_villagerTradingRequiresTrust);
|
||||||
outConfig.set("GriefPrevention.Claims.CommandsRequiringAccessTrust", accessTrustSlashCommands);
|
outConfig.set("GriefPrevention.Claims.CommandsRequiringAccessTrust", accessTrustSlashCommands);
|
||||||
|
|
||||||
outConfig.set("GriefPrevention.Spam.Enabled", this.config_spam_enabled);
|
outConfig.set("GriefPrevention.Spam.Enabled", this.config_spam_enabled);
|
||||||
|
|
|
||||||
|
|
@ -1125,7 +1125,7 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
|
|
||||||
//if the entity is an animal, apply container rules
|
//if the entity is an animal, apply container rules
|
||||||
if(GriefPrevention.instance.config_claims_preventTheft && (entity instanceof Animals || entity.getType() == EntityType.VILLAGER))
|
if((GriefPrevention.instance.config_claims_preventTheft && entity instanceof Animals) || (entity.getType() == EntityType.VILLAGER && GriefPrevention.instance.config_claims_villagerTradingRequiresTrust))
|
||||||
{
|
{
|
||||||
//if the entity is in a claim
|
//if the entity is in a claim
|
||||||
Claim claim = this.dataStore.getClaimAt(entity.getLocation(), false, null);
|
Claim claim = this.dataStore.getClaimAt(entity.getLocation(), false, null);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user