Added Permission Checks for Pretty much all the tools.

This commit is contained in:
AlgorithmX2 2014-08-28 22:32:53 -05:00
parent a0f5f9dcd5
commit fbab9f15ee
5 changed files with 20 additions and 3 deletions

View file

@ -17,6 +17,7 @@ import appeng.api.implementations.items.IAEWrench;
import appeng.api.networking.IGridHost;
import appeng.api.parts.IPartHost;
import appeng.api.parts.SelectedPart;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.INetworkToolAgent;
import appeng.client.ClientHelper;
import appeng.container.AEBaseContainer;
@ -110,6 +111,9 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
{
if ( side >= 0 )
{
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
return false;
Block b = w.getBlock( x, y, z );
if ( b != null && !p.isSneaking() )
{

View file

@ -35,6 +35,7 @@ import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.block.misc.BlockPaint;
import appeng.block.networking.BlockCableBus;
import appeng.client.render.items.ToolColorApplicatorRender;
@ -226,6 +227,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
else
paintBall = null;
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
return false;
if ( paintBall != null && paintBall.getItem() instanceof ItemSnowball )
{
ForgeDirection oside = ForgeDirection.getOrientation( side );

View file

@ -21,6 +21,7 @@ import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.util.DimensionalCoord;
import appeng.block.misc.BlockTinyTNT;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
@ -193,7 +194,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
if ( w.getBlock( x, y, z ).getMaterial() == Material.lava || w.getBlock( x, y, z ).getMaterial() == Material.water )
{
if ( w.canMineBlock( p, x, y, z ) )
if ( Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
{
onItemUse( item, p, w, x, y, z, 0, 0.0F, 0.0F, 0.0F );
}

View file

@ -35,6 +35,7 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.CommonHelper;
@ -265,6 +266,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
int y = pos.blockY + side.offsetY;
int z = pos.blockZ + side.offsetZ;
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
return;
Block whatsThere = w.getBlock( x, y, z );
if ( whatsThere == AEApi.instance().blocks().blockPaint.block() )
{
@ -398,7 +402,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
float hardness = b.getBlockHardness( w, pos.blockX, pos.blockY, pos.blockZ ) * 9.0f;
if ( hardness >= 0.0 )
{
if ( penitration > hardness )
if ( penitration > hardness && Platform.hasPermissions( new DimensionalCoord( w, pos.blockX, pos.blockY, pos.blockZ ), p ) )
{
hasDestroyedSomething = true;
penitration -= hardness;

View file

@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.implementations.items.IAEWrench;
import appeng.api.util.DimensionalCoord;
import appeng.core.features.AEFeature;
import appeng.items.AEBaseItem;
import appeng.transformer.annotations.integration.Interface;
@ -28,8 +29,11 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
public boolean onItemUseFirst(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
Block b = world.getBlock( x, y, z );
if ( b != null && !player.isSneaking() )
if ( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
{
if ( Platform.isClient() )
return true;
ForgeDirection mySide = ForgeDirection.getOrientation( side );
if ( b.rotateBlock( world, x, y, z, mySide ) )
{