From 3cc48fec60054d18d7e0387002d7dcb9271ff741 Mon Sep 17 00:00:00 2001 From: xsun2001 <1563770452@qq.com> Date: Sun, 18 Feb 2018 20:47:13 +0800 Subject: [PATCH] fix a bug that allows network tool to rotate blocks without the permission. --- .../java/appeng/items/tools/ToolNetworkTool.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/appeng/items/tools/ToolNetworkTool.java b/src/main/java/appeng/items/tools/ToolNetworkTool.java index 647469561d6..28637cf8f62 100644 --- a/src/main/java/appeng/items/tools/ToolNetworkTool.java +++ b/src/main/java/appeng/items/tools/ToolNetworkTool.java @@ -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 ); @@ -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