Add permission for command blocks

This commit is contained in:
Mariell Hoversholm
2020-05-16 10:05:30 +02:00
parent 1b13d5c85e
commit 2a6962e59e
5 changed files with 63 additions and 20 deletions

View File

@@ -110,9 +110,9 @@
+ this.player.connection.send(tileentity.getUpdatePacket());
+ }
+ // CraftBukkit end
return;
}
+ return;
+ }
+
+ // CraftBukkit start
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, pos, direction, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
+ if (event.isCancelled()) {
@@ -123,10 +123,10 @@
+ if (tileentity != null) {
+ this.player.connection.send(tileentity.getUpdatePacket());
+ }
+ return;
+ }
return;
}
+ // CraftBukkit end
+
if (this.isCreative()) {
this.destroyAndAck(pos, sequence, "creative destroy");
return;
@@ -214,7 +214,7 @@
}
}
@@ -242,10 +341,65 @@
@@ -242,19 +341,78 @@
public boolean destroyBlock(BlockPos pos) {
BlockState iblockdata = this.level.getBlockState(pos);
@@ -281,7 +281,10 @@
BlockEntity tileentity = this.level.getBlockEntity(pos);
Block block = iblockdata.getBlock();
@@ -255,6 +409,10 @@
- if (block instanceof GameMasterBlock && !this.player.canUseGameMasterBlocks()) {
+ if (block instanceof GameMasterBlock && !this.player.canUseGameMasterBlocks() && !(block instanceof net.minecraft.world.level.block.CommandBlock && (this.player.isCreative() && this.player.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission
this.level.sendBlockUpdated(pos, iblockdata, iblockdata, 3);
return false;
} else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) {
return false;
} else {