we are now ignoring canceled events

This commit is contained in:
Redecouverte 2011-02-22 02:49:20 +01:00
parent e15b01bac5
commit d2ca8bffc4
2 changed files with 57 additions and 0 deletions

View File

@ -60,6 +60,12 @@ public WorldGuardBlockListener(WorldGuardPlugin plugin) {
*/ */
@Override @Override
public void onBlockDamage(BlockDamageEvent event) { public void onBlockDamage(BlockDamageEvent event) {
if(event.isCancelled())
{
return;
}
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!plugin.itemDurability && event.getDamageLevel() == BlockDamageLevel.BROKEN) { if (!plugin.itemDurability && event.getDamageLevel() == BlockDamageLevel.BROKEN) {
@ -108,6 +114,12 @@ public void onBlockDamage(BlockDamageEvent event) {
*/ */
@Override @Override
public void onBlockFlow(BlockFromToEvent event) { public void onBlockFlow(BlockFromToEvent event) {
if(event.isCancelled())
{
return;
}
World world = event.getBlock().getWorld(); World world = event.getBlock().getWorld();
Block blockFrom = event.getBlock(); Block blockFrom = event.getBlock();
Block blockTo = event.getToBlock(); Block blockTo = event.getToBlock();
@ -171,6 +183,12 @@ public void onBlockFlow(BlockFromToEvent event) {
*/ */
@Override @Override
public void onBlockIgnite(BlockIgniteEvent event) { public void onBlockIgnite(BlockIgniteEvent event) {
if(event.isCancelled())
{
return;
}
IgniteCause cause = event.getCause(); IgniteCause cause = event.getCause();
Block block = event.getBlock(); Block block = event.getBlock();
//Player player = event.getPlayer(); //Player player = event.getPlayer();
@ -251,7 +269,14 @@ public void onBlockIgnite(BlockIgniteEvent event) {
* *
* @param event Relevant event details * @param event Relevant event details
*/ */
@Override
public void onBlockBurn(BlockBurnEvent event) { public void onBlockBurn(BlockBurnEvent event) {
if(event.isCancelled())
{
return;
}
if (plugin.disableFireSpread) { if (plugin.disableFireSpread) {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -279,6 +304,12 @@ public void onBlockBurn(BlockBurnEvent event) {
*/ */
@Override @Override
public void onBlockPhysics(BlockPhysicsEvent event) { public void onBlockPhysics(BlockPhysicsEvent event) {
if(event.isCancelled())
{
return;
}
int id = event.getChangedTypeId(); int id = event.getChangedTypeId();
if (id == 13 && plugin.noPhysicsGravel) { if (id == 13 && plugin.noPhysicsGravel) {
@ -302,7 +333,14 @@ public void onBlockPhysics(BlockPhysicsEvent event) {
* *
* @param event Relevant event details * @param event Relevant event details
*/ */
@Override
public void onBlockInteract(BlockInteractEvent event) { public void onBlockInteract(BlockInteractEvent event) {
if(event.isCancelled())
{
return;
}
Block block = event.getBlock(); Block block = event.getBlock();
LivingEntity entity = event.getEntity(); LivingEntity entity = event.getEntity();
@ -346,6 +384,12 @@ public void onBlockInteract(BlockInteractEvent event) {
*/ */
@Override @Override
public void onBlockPlace(BlockPlaceEvent event) { public void onBlockPlace(BlockPlaceEvent event) {
if(event.isCancelled())
{
return;
}
Block blockPlaced = event.getBlock(); Block blockPlaced = event.getBlock();
Player player = event.getPlayer(); Player player = event.getPlayer();
World world = blockPlaced.getWorld(); World world = blockPlaced.getWorld();
@ -391,6 +435,7 @@ public void onBlockPlace(BlockPlaceEvent event) {
*/ */
@Override @Override
public void onBlockRightClick(BlockRightClickEvent event) { public void onBlockRightClick(BlockRightClickEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (plugin.useRegions && event.getItemInHand().getTypeId() == plugin.regionWand) { if (plugin.useRegions && event.getItemInHand().getTypeId() == plugin.regionWand) {
@ -427,6 +472,7 @@ public void onBlockRightClick(BlockRightClickEvent event) {
*/ */
@Override @Override
public void onBlockRedstoneChange(BlockRedstoneEvent event) { public void onBlockRedstoneChange(BlockRedstoneEvent event) {
World world = event.getBlock().getWorld(); World world = event.getBlock().getWorld();
Block blockTo = event.getBlock(); Block blockTo = event.getBlock();

View File

@ -171,6 +171,11 @@ public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
@Override @Override
public void onEntityDamage(EntityDamageEvent event) { public void onEntityDamage(EntityDamageEvent event) {
if(event.isCancelled())
{
return;
}
if (event instanceof EntityDamageByProjectileEvent) { if (event instanceof EntityDamageByProjectileEvent) {
this.onEntityDamageByProjectile((EntityDamageByProjectileEvent) event); this.onEntityDamageByProjectile((EntityDamageByProjectileEvent) event);
return; return;
@ -230,6 +235,12 @@ public void onEntityDamage(EntityDamageEvent event) {
@Override @Override
public void onEntityExplode(EntityExplodeEvent event) { public void onEntityExplode(EntityExplodeEvent event) {
if(event.isCancelled())
{
return;
}
if (event.getEntity() instanceof LivingEntity) { if (event.getEntity() instanceof LivingEntity) {
if (plugin.blockCreeperBlockDamage) { if (plugin.blockCreeperBlockDamage) {
event.setCancelled(true); event.setCancelled(true);