This commit is contained in:
Ryan Hamshire committed 2012-11-28 17:50:30 -08:00
1 parent c7c9fe9f07
commit a74a663f4b
6 files changed
+34 -20

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ name: GriefPrevention
main: me.ryanhamshire.GriefPrevention.GriefPrevention main: me.ryanhamshire.GriefPrevention.GriefPrevention
softdepend: [Vault, Multiverse-Core, My Worlds, MystCraft, Transporter] softdepend: [Vault, Multiverse-Core, My Worlds, MystCraft, Transporter]
dev-url: http://dev.bukkit.org/server-mods/grief-prevention dev-url: http://dev.bukkit.org/server-mods/grief-prevention
version: 7.0.1 version: 7.1
commands: commands:
abandonclaim: abandonclaim:
description: Deletes a claim. description: Deletes a claim.
@@ -554,12 +554,6 @@ public class BlockEventHandler implements Listener
if(!GriefPrevention.instance.config_fireSpreads && igniteEvent.getCause() != IgniteCause.FLINT_AND_STEEL && igniteEvent.getCause() != IgniteCause.LIGHTNING) if(!GriefPrevention.instance.config_fireSpreads && igniteEvent.getCause() != IgniteCause.FLINT_AND_STEEL && igniteEvent.getCause() != IgniteCause.LIGHTNING)
{ {
igniteEvent.setCancelled(true); igniteEvent.setCancelled(true);
Block underBlock = igniteEvent.getBlock().getRelative(BlockFace.DOWN);
if(underBlock.getType() != Material.NETHERRACK)
{
igniteEvent.getBlock().setType(Material.AIR);
}
} }
} }
@@ -573,10 +567,10 @@ public class BlockEventHandler implements Listener
{ {
spreadEvent.setCancelled(true); spreadEvent.setCancelled(true);
Block underBlock = spreadEvent.getBlock().getRelative(BlockFace.DOWN); Block underBlock = spreadEvent.getSource().getRelative(BlockFace.DOWN);
if(underBlock.getType() != Material.NETHERRACK) if(underBlock.getType() != Material.NETHERRACK)
{ {
spreadEvent.getBlock().setType(Material.AIR); spreadEvent.getSource().setType(Material.AIR);
} }
return; return;
@@ -603,13 +597,6 @@ public class BlockEventHandler implements Listener
if(!GriefPrevention.instance.config_fireDestroys) if(!GriefPrevention.instance.config_fireDestroys)
{ {
burnEvent.setCancelled(true); burnEvent.setCancelled(true);
Block underBlock = burnEvent.getBlock().getRelative(BlockFace.DOWN);
if(underBlock.getType() != Material.NETHERRACK)
{
burnEvent.getBlock().setType(Material.AIR);
}
return; return;
} }
@@ -46,7 +46,10 @@ class DeliverClaimBlocksTask implements Runnable
try //distance squared will throw an exception if the player has changed worlds 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 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 //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 //in that case, leave his blocks where they are
@@ -76,6 +76,11 @@ class EntityEventHandler implements Listener
event.setCancelled(true); 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 //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) else if(event.getEntityType() == EntityType.WITHER)
{ {
@@ -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_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_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_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 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_smartBan = config.getBoolean("GriefPrevention.SmartBan", true);
this.config_endermenMoveBlocks = config.getBoolean("GriefPrevention.EndermenMoveBlocks", false); 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_creaturesTrampleCrops = config.getBoolean("GriefPrevention.CreaturesTrampleCrops", false);
this.config_zombiesBreakDoors = config.getBoolean("GriefPrevention.HardModeZombiesBreakDoors", 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.Siege.BreakableBlocks", breakableBlocksList);
config.set("GriefPrevention.EndermenMoveBlocks", this.config_endermenMoveBlocks); config.set("GriefPrevention.EndermenMoveBlocks", this.config_endermenMoveBlocks);
config.set("GriefPrevention.SilverfishBreakBlocks", this.config_silverfishBreakBlocks);
config.set("GriefPrevention.CreaturesTrampleCrops", this.config_creaturesTrampleCrops); config.set("GriefPrevention.CreaturesTrampleCrops", this.config_creaturesTrampleCrops);
config.set("GriefPrevention.HardModeZombiesBreakDoors", this.config_zombiesBreakDoors); 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 //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); GriefPrevention.sendMessage(player, TextMode.Err, Messages.ClaimsListNoPermission);
return true; return true;
@@ -1087,8 +1087,8 @@ class PlayerEventHandler implements Listener
//what's the player holding? //what's the player holding?
Material materialInHand = player.getItemInHand().getType(); 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 it's bonemeal, check for build permission (ink sac == bone meal, must be a Bukkit bug?)
if(materialInHand == Material.INK_SACK || materialInHand == Material.BOAT) if(materialInHand == Material.INK_SACK)
{ {
String noBuildReason = GriefPrevention.instance.allowBuild(player, clickedBlock.getLocation()); String noBuildReason = GriefPrevention.instance.allowBuild(player, clickedBlock.getLocation());
if(noBuildReason != null) if(noBuildReason != null)
@@ -1100,6 +1100,22 @@ class PlayerEventHandler implements Listener
return; 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 //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())) 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()))
{ {