This commit is contained in:
Ryan Hamshire 2012-11-28 17:50:30 -08:00
parent c7c9fe9f07
commit a74a663f4b
6 changed files with 35 additions and 21 deletions

View File

@ -2,7 +2,7 @@ name: GriefPrevention
main: me.ryanhamshire.GriefPrevention.GriefPrevention
softdepend: [Vault, Multiverse-Core, My Worlds, MystCraft, Transporter]
dev-url: http://dev.bukkit.org/server-mods/grief-prevention
version: 7.0.1
version: 7.1
commands:
abandonclaim:
description: Deletes a claim.

View File

@ -553,13 +553,7 @@ public class BlockEventHandler implements Listener
{
if(!GriefPrevention.instance.config_fireSpreads && igniteEvent.getCause() != IgniteCause.FLINT_AND_STEEL && igniteEvent.getCause() != IgniteCause.LIGHTNING)
{
igniteEvent.setCancelled(true);
Block underBlock = igniteEvent.getBlock().getRelative(BlockFace.DOWN);
if(underBlock.getType() != Material.NETHERRACK)
{
igniteEvent.getBlock().setType(Material.AIR);
}
igniteEvent.setCancelled(true);
}
}
@ -573,10 +567,10 @@ public class BlockEventHandler implements Listener
{
spreadEvent.setCancelled(true);
Block underBlock = spreadEvent.getBlock().getRelative(BlockFace.DOWN);
Block underBlock = spreadEvent.getSource().getRelative(BlockFace.DOWN);
if(underBlock.getType() != Material.NETHERRACK)
{
spreadEvent.getBlock().setType(Material.AIR);
spreadEvent.getSource().setType(Material.AIR);
}
return;
@ -603,13 +597,6 @@ public class BlockEventHandler implements Listener
if(!GriefPrevention.instance.config_fireDestroys)
{
burnEvent.setCancelled(true);
Block underBlock = burnEvent.getBlock().getRelative(BlockFace.DOWN);
if(underBlock.getType() != Material.NETHERRACK)
{
burnEvent.getBlock().setType(Material.AIR);
}
return;
}

View File

@ -46,7 +46,10 @@ class DeliverClaimBlocksTask implements Runnable
try //distance squared will throw an exception if the player has changed worlds
{
//if he's not in a vehicle and has moved at least three blocks since the last check
if(!player.isInsideVehicle() && (lastLocation == null || lastLocation.distanceSquared(player.getLocation()) >= 9))
//and he's not being pushed around by fluids
if(!player.isInsideVehicle() &&
(lastLocation == null || lastLocation.distanceSquared(player.getLocation()) >= 9) &&
!player.getLocation().getBlock().isLiquid())
{
//if player is over accrued limit, accrued limit was probably reduced in config file AFTER he accrued
//in that case, leave his blocks where they are

View File

@ -76,6 +76,11 @@ class EntityEventHandler implements Listener
event.setCancelled(true);
}
else if(!GriefPrevention.instance.config_silverfishBreakBlocks && event.getEntityType() == EntityType.SILVERFISH)
{
event.setCancelled(true);
}
//don't allow the wither to break blocks, when the wither is determined, too expensive to constantly check for claimed blocks
else if(event.getEntityType() == EntityType.WITHER)
{

View File

@ -134,6 +134,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_silverfishBreakBlocks; //whether silverfish may break blocks
public boolean config_creaturesTrampleCrops; //whether or not non-player entities may trample crops
public boolean config_zombiesBreakDoors; //whether or not hard-mode zombies may break down wooden doors
@ -351,6 +352,7 @@ public class GriefPrevention extends JavaPlugin
this.config_smartBan = config.getBoolean("GriefPrevention.SmartBan", true);
this.config_endermenMoveBlocks = config.getBoolean("GriefPrevention.EndermenMoveBlocks", false);
this.config_silverfishBreakBlocks = config.getBoolean("GriefPrevention.SilverfishBreakBlocks", false);
this.config_creaturesTrampleCrops = config.getBoolean("GriefPrevention.CreaturesTrampleCrops", false);
this.config_zombiesBreakDoors = config.getBoolean("GriefPrevention.HardModeZombiesBreakDoors", false);
@ -591,6 +593,7 @@ public class GriefPrevention extends JavaPlugin
config.set("GriefPrevention.Siege.BreakableBlocks", breakableBlocksList);
config.set("GriefPrevention.EndermenMoveBlocks", this.config_endermenMoveBlocks);
config.set("GriefPrevention.SilverfishBreakBlocks", this.config_silverfishBreakBlocks);
config.set("GriefPrevention.CreaturesTrampleCrops", this.config_creaturesTrampleCrops);
config.set("GriefPrevention.HardModeZombiesBreakDoors", this.config_zombiesBreakDoors);
@ -1471,7 +1474,7 @@ public class GriefPrevention extends JavaPlugin
}
//otherwise if no permission to delve into another player's claims data
else if(!player.hasPermission("griefprevention.deleteclaims"))
else if(player != null && !player.hasPermission("griefprevention.deleteclaims"))
{
GriefPrevention.sendMessage(player, TextMode.Err, Messages.ClaimsListNoPermission);
return true;

View File

@ -1087,8 +1087,8 @@ class PlayerEventHandler implements Listener
//what's the player holding?
Material materialInHand = player.getItemInHand().getType();
//if it's bonemeal or a boat, check for build permission (ink sac == bone meal, must be a Bukkit bug?)
if(materialInHand == Material.INK_SACK || materialInHand == Material.BOAT)
//if it's bonemeal, check for build permission (ink sac == bone meal, must be a Bukkit bug?)
if(materialInHand == Material.INK_SACK)
{
String noBuildReason = GriefPrevention.instance.allowBuild(player, clickedBlock.getLocation());
if(noBuildReason != null)
@ -1100,6 +1100,22 @@ class PlayerEventHandler implements Listener
return;
}
else if(materialInHand == Material.BOAT)
{
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim);
if(claim != null)
{
String noAccessReason = claim.allowAccess(player);
if(noAccessReason != null)
{
GriefPrevention.sendMessage(player, TextMode.Err, noAccessReason);
event.setCancelled(true);
}
}
return;
}
//if it's a spawn egg, minecart, or boat, and this is a creative world, apply special rules
else if((materialInHand == Material.MONSTER_EGG || materialInHand == Material.MINECART || materialInHand == Material.POWERED_MINECART || materialInHand == Material.STORAGE_MINECART || materialInHand == Material.BOAT) && GriefPrevention.instance.creativeRulesApply(clickedBlock.getLocation()))
{