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

@@ -26,3 +26,12 @@
if (powered != flag1) {
blockEntity.setPowered(powered);
if (powered) {
@@ -141,7 +152,7 @@
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
BlockEntity tileentity = world.getBlockEntity(pos);
- if (tileentity instanceof CommandBlockEntity && player.canUseGameMasterBlocks()) {
+ if (tileentity instanceof CommandBlockEntity && (player.canUseGameMasterBlocks() || (player.isCreative() && player.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission
player.openCommandBlock((CommandBlockEntity) tileentity);
return InteractionResult.SUCCESS;
} else {