Files
op-block-protection.sk
Code
1 24
op-block-protection.sk
# Op Block Protection
# Author: Generated by Kodari
# Version: 1.0
# Description: Prevents non-operators from breaking specific protected blocks
options:
prefix: &c[Protection]&r
permission-message: &cYou don't have permission to break this block! Only operators can break protected blocks.
# Event triggered when any player breaks a block
on break:
# Check if the broken block is one of the protected types
if event-block is light blue concrete, prismarine, prismarine bricks, tuff bricks, chiseled tuff bricks, deepslate brick slab, deepslate brick stairs, cobblestone, polished diorite, smooth stone, deepslate, polished tuff wall, lodestone, basalt, polished andesite, diorite, deepslate bricks, mossy stone bricks, mossy cobblestone, white banner, polished tuff, polished tuff stairs, tuff, stone brick stairs, cyan terracotta, gravel, iron bars, andesite, lever, andesite wall, stone brick wall, cracked stone bricks, andesite stairs, lantern or tuff brick slab:
# Check if the player is NOT an operator
if player is not op:
# Cancel the block break event
cancel event
# Send denial message to the player
send "{@prefix} {@permission-message}" to player
# Confirmation message when script loads
on script load:
send "{@prefix} &aOp Block Protection loaded successfully!" to console
send "{@prefix} &7Protecting 35 block types from non-operators" to console