Skip to content

Commit

Permalink
More permissions checks when modifying blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlgorithmX2 committed Jun 2, 2018
1 parent eaaeaa8 commit cf3603e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/java/mod/chiselsandbits/network/packets/PacketChisel.java
Expand Up @@ -148,6 +148,16 @@ public int doAction(
}
}

if ( world.getMinecraftServer() != null && world.getMinecraftServer().isBlockProtected( world, pos, player.getPlayer() ) )
{
continue;
}

if ( !world.isBlockModifiable( player.getPlayer(), pos ) )
{
continue;
}

if ( world.getBlockState( pos ).getBlock().isReplaceable( world, pos ) && place.usesBits() )
{
world.setBlockToAir( pos );
Expand Down Expand Up @@ -211,10 +221,10 @@ else if ( extracted != null )
BitInventoryFeeder feeder = new BitInventoryFeeder( who, world );
for ( final EntityItem ei : spawnlist )
{
feeder.addItem(ei);
feeder.addItem( ei );
ItemBitBag.cleanupInventory( who, ei.getEntityItem() );
}

if ( place.usesBits() )
{
ItemBitBag.cleanupInventory( who, bitPlaced != null ? bitPlaced : new ItemStack( ChiselsAndBits.getItems().itemBlockBit, 1, OreDictionary.WILDCARD_VALUE ) );
Expand Down

0 comments on commit cf3603e

Please sign in to comment.