Skip to content

Commit

Permalink
fix a bug that allows network tool to rotate blocks without the permi…
Browse files Browse the repository at this point in the history
…ssion.
  • Loading branch information
xsun2001 committed Feb 18, 2018
1 parent 27feccc commit 3cc48fe
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/java/appeng/items/tools/ToolNetworkTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ public boolean serverSideToolLogic( final ItemStack is, final EntityPlayer p, fi
}

final Block b = w.getBlock( x, y, z );

if( b != null )
if( ForgeEventFactory.onPlayerInteract( p,
b.isAir( w, x, y, z ) ? PlayerInteractEvent.Action.RIGHT_CLICK_AIR : PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK,
x, y, z, side, w ).isCanceled() )
return false;

if( b != null && !p.isSneaking() )
{
final TileEntity te = w.getTileEntity( x, y, z );
Expand Down Expand Up @@ -192,11 +199,7 @@ public boolean serverSideToolLogic( final ItemStack is, final EntityPlayer p, fi
}
else
{
if( b != null )
if( !ForgeEventFactory.onPlayerInteract( p,
b.isAir( w, x, y, z ) ? PlayerInteractEvent.Action.RIGHT_CLICK_AIR : PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK,
x, y, z, side, w ).isCanceled() )
b.onBlockActivated( w, x, y, z, p, side, hitX, hitY, hitZ );
b.onBlockActivated( w, x, y, z, p, side, hitX, hitY, hitZ );
}
}
else
Expand Down

0 comments on commit 3cc48fe

Please sign in to comment.