world.afterEvents.playerInteractWithBlock.subscribe((data) => {
// instead of data.block.typeId > data.block.type.id
if (data.block.type.id === "minecraft:anvil" && !data.player.hasTag("admin")) {
data.cancel = true
data.player.playSound('random.break')
data.player.sendMessage('§4§lWait!§r§c Only admins can use these!')
}
})
#not canceling
1 messages · Page 1 of 1 (latest)
how do you want to close an UI with playerInteractWithBlock
ohh you mean the anvil ui, wait
im working on it
world.beforeEvents.playerInteractWithBlock.subscribe((data) => {
const player = data.player
if (data.block.type.id === "minecraft:anvil" && !player.hasTag("admin")) {
data.cancel = true
player.playSound('random.break')
player.sendMessage('§4§lWait!§r§c Only admins can use these!')
}
})
you.. used afterEvents
Youree welcome
sure?
huh
@foggy fjord here
world.beforeEvents.playerInteractWithBlock.subscribe((data) => {
const player = data.player
if (data.block.type.id === "minecraft:anvil" && !player.hasTag("admin")) {
data.cancel = true
system.run(() => {
player.playSound('random.break')
player.sendMessage('§4§lWait!§r§c Only admins can use these!')
})
}
})