config to prevent ravagers from breaking blocks in claims

Defaults to true to remain consistent with behavior of preventing
enderman from taking blocks and entities from trampling crops

Closes #530

Also intellij is insistent on replacing tabs
This commit is contained in:
RoboMWM 2019-07-29 21:48:33 -07:00
parent 99a676a6d1
commit cdeac80635
2 changed files with 94 additions and 82 deletions

View File

@ -144,7 +144,10 @@ public class EntityEventHandler implements Listener
else if(!GriefPrevention.instance.config_rabbitsEatCrops && event.getEntityType() == EntityType.RABBIT)
{
event.setCancelled(true);
} else if(event.getEntityType() == EntityType.WITHER && GriefPrevention.instance.config_claims_worldModes.get(event.getBlock().getWorld()) != ClaimsMode.Disabled)
}
else if(GriefPrevention.instance.config_claims_worldModes.get(event.getBlock().getWorld()) != ClaimsMode.Disabled)
{
if (event.getEntityType() == EntityType.WITHER)
{
Claim claim = this.dataStore.getClaimAt(event.getBlock().getLocation(), false, null);
if (claim == null || !claim.areExplosivesAllowed || !GriefPrevention.instance.config_blockClaimExplosions)
@ -153,14 +156,18 @@ public class EntityEventHandler implements Listener
}
}
else if (!GriefPrevention.instance.config_claims_ravagersBreakBlocks && event.getEntityType() == EntityType.RAVAGER)
{
event.setCancelled(true);
}
//don't allow crops to be trampled, except by a player with build permission
else if (event.getTo() == Material.DIRT && event.getBlock().getType() == Material.FARMLAND)
{
if (event.getEntityType() != EntityType.PLAYER)
{
event.setCancelled(true);
}
else
} else
{
Player player = (Player) event.getEntity();
Block block = event.getBlock();
@ -170,6 +177,7 @@ public class EntityEventHandler implements Listener
}
}
}
}
//Prevent breaking lilypads via collision with a boat. Thanks Jikoo.
else if (event.getEntity() instanceof Vehicle && !event.getEntity().getPassengers().isEmpty()) {
@ -229,6 +237,7 @@ public class EntityEventHandler implements Listener
}
}
}
}
//Used by "sand cannon" fix to ignore fallingblocks that fell through End Portals
//This is largely due to a CB issue with the above event

View File

@ -187,6 +187,7 @@ public class GriefPrevention extends JavaPlugin
public boolean config_smartBan; //whether to ban accounts which very likely owned by a banned player
public boolean config_endermenMoveBlocks; //whether or not endermen may move blocks around
public boolean config_claims_ravagersBreakBlocks; //whether or not ravagers may break blocks in claims
public boolean config_silverfishBreakBlocks; //whether silverfish may break blocks
public boolean config_creaturesTrampleCrops; //whether or not non-player entities may trample crops
public boolean config_rabbitsEatCrops; //whether or not rabbits may eat crops
@ -583,6 +584,7 @@ public class GriefPrevention extends JavaPlugin
String accessTrustSlashCommands = config.getString("GriefPrevention.Claims.CommandsRequiringAccessTrust", "/sethome");
this.config_claims_supplyPlayerManual = config.getBoolean("GriefPrevention.Claims.DeliverManuals", true);
this.config_claims_manualDeliveryDelaySeconds = config.getInt("GriefPrevention.Claims.ManualDeliveryDelaySeconds", 30);
this.config_claims_ravagersBreakBlocks = config.getBoolean("GriefPrevention.Claims.RavagersBreakBlocks", true);
this.config_claims_firespreads = config.getBoolean("GriefPrevention.Claims.FireSpreadsInClaims", false);
this.config_claims_firedamages = config.getBoolean("GriefPrevention.Claims.FireDamagesInClaims", false);
@ -834,6 +836,7 @@ public class GriefPrevention extends JavaPlugin
outConfig.set("GriefPrevention.Claims.CommandsRequiringAccessTrust", accessTrustSlashCommands);
outConfig.set("GriefPrevention.Claims.DeliverManuals", config_claims_supplyPlayerManual);
outConfig.set("GriefPrevention.Claims.ManualDeliveryDelaySeconds", config_claims_manualDeliveryDelaySeconds);
outConfig.set("GriefPrevention.Claims.RavagersBreakBlocks", config_claims_ravagersBreakBlocks);
outConfig.set("GriefPrevention.Claims.FireSpreadsInClaims", config_claims_firespreads);
outConfig.set("GriefPrevention.Claims.FireDamagesInClaims", config_claims_firedamages);