Allow Donkey and llama protection to be disabled (#406)
This commit is contained in:
parent
e2aae1d0f3
commit
3e1e058001
|
|
@ -44,6 +44,9 @@ import org.bukkit.entity.Tameable;
|
|||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.entity.WaterMob;
|
||||
import org.bukkit.entity.Llama;
|
||||
import org.bukkit.entity.Donkey;
|
||||
import org.bukkit.entity.Mule;
|
||||
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
|
@ -667,7 +670,9 @@ public class EntityEventHandler implements Listener
|
|||
|
||||
//horse protections can be disabled
|
||||
if(event.getEntity() instanceof Horse && !GriefPrevention.instance.config_claims_protectHorses) return;
|
||||
|
||||
if(event.getEntity() instanceof Donkey && !GriefPrevention.instance.config_claims_protectDonkeys) return;
|
||||
if(event.getEntity() instanceof Mule && !GriefPrevention.instance.config_claims_protectDonkeys) return;
|
||||
if(event.getEntity() instanceof Llama && !GriefPrevention.instance.config_claims_protectLlamas) return;
|
||||
//protected death loot can't be destroyed, only picked up or despawned due to expiration
|
||||
if(event.getEntityType() == EntityType.DROPPED_ITEM)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -94,6 +94,8 @@ public class GriefPrevention extends JavaPlugin
|
|||
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
|
||||
public boolean config_claims_protectDonkeys; //whether donkeys on a claim should be protected by that claim's rules
|
||||
public boolean config_claims_protectLlamas; //whether llamas 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_lockWoodenDoors; //whether wooden doors should be locked by default (require /accesstrust)
|
||||
public boolean config_claims_lockTrapDoors; //whether trap doors should be locked by default (require /accesstrust)
|
||||
|
|
@ -544,6 +546,8 @@ public class GriefPrevention extends JavaPlugin
|
|||
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);
|
||||
this.config_claims_protectDonkeys = config.getBoolean("GriefPrevention.Claims.ProtectDonkeys", true);
|
||||
this.config_claims_protectLlamas = config.getBoolean("GriefPrevention.Claims.ProtectLlamas", true);
|
||||
this.config_claims_preventButtonsSwitches = config.getBoolean("GriefPrevention.Claims.PreventButtonsSwitches", true);
|
||||
this.config_claims_lockWoodenDoors = config.getBoolean("GriefPrevention.Claims.LockWoodenDoors", false);
|
||||
this.config_claims_lockTrapDoors = config.getBoolean("GriefPrevention.Claims.LockTrapDoors", false);
|
||||
|
|
@ -798,6 +802,8 @@ public class GriefPrevention extends JavaPlugin
|
|||
outConfig.set("GriefPrevention.Claims.LockFenceGates", this.config_claims_lockFenceGates);
|
||||
outConfig.set("GriefPrevention.Claims.EnderPearlsRequireAccessTrust", this.config_claims_enderPearlsRequireAccessTrust);
|
||||
outConfig.set("GriefPrevention.Claims.ProtectHorses", this.config_claims_protectHorses);
|
||||
outConfig.set("GriefPrevention.Claims.ProtectDonkeys", this.config_claims_protectDonkeys);
|
||||
outConfig.set("GriefPrevention.Claims.ProtectLlamas", this.config_claims_protectLlamas);
|
||||
outConfig.set("GriefPrevention.Claims.InitialBlocks", this.config_claims_initialBlocks);
|
||||
outConfig.set("GriefPrevention.Claims.Claim Blocks Accrued Per Hour.Default", this.config_claims_blocksAccruedPerHour_default);
|
||||
outConfig.set("GriefPrevention.Claims.Max Accrued Claim Blocks.Default", this.config_claims_maxAccruedBlocks_default);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ import org.bukkit.entity.Tameable;
|
|||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.entity.minecart.PoweredMinecart;
|
||||
import org.bukkit.entity.minecart.StorageMinecart;
|
||||
import org.bukkit.entity.Llama;
|
||||
import org.bukkit.entity.Donkey;
|
||||
import org.bukkit.entity.Mule;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
|
@ -1171,7 +1174,10 @@ class PlayerEventHandler implements Listener
|
|||
|
||||
//allow horse protection to be overridden to allow management from other plugins
|
||||
if (!instance.config_claims_protectHorses && entity instanceof AbstractHorse ) return;
|
||||
|
||||
if (!instance.config_claims_protectDonkeys && entity instanceof Donkey) return;
|
||||
if (!instance.config_claims_protectDonkeys && entity instanceof Mule) return;
|
||||
if (!instance.config_claims_protectLlamas && entity instanceof Llama ) return;
|
||||
|
||||
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||
|
||||
//if entity is tameable and has an owner, apply special rules
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@ public class MetricsHandler
|
|||
addSimplePie("lock_trapdoors", plugin.config_claims_lockTrapDoors);
|
||||
|
||||
addSimplePie("protect_horses", plugin.config_claims_protectHorses);
|
||||
addSimplePie("protect_donkeys", plugin.config_claims_protectDonkeys);
|
||||
addSimplePie("protect_llamas", plugin.config_claims_protectLlamas);
|
||||
|
||||
addSimplePie("prevent_buttons_switches", plugin.config_claims_preventButtonsSwitches);
|
||||
addSimplePie("villager_trading_requires_trust", plugin.config_claims_villagerTradingRequiresTrust);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user