Events
1. Welcome Message
Section titled “1. Welcome Message”mc.on("player.join", function(e) mc.broadcast(e.player.displayName .. " joined the server!")end)2. Bad Word Filter
Section titled “2. Bad Word Filter”local badWords = {"badword1", "badword2", "badword3"}
mc.on("player.chat", function(e) for _, word in ipairs(badWords) do if e.message:lower():find(word) then e.player:sendMessage("Watch your language!") e:cancel() -- the message is not sent return end endend, { priority = "high" })3. Block Break Protection
Section titled “3. Block Break Protection”mc.on("block.break", function(e) if e.block == "minecraft:bedrock" then e.player:sendMessage("You cannot break bedrock!") e:cancel() endend)4. TNT Placement Prevention
Section titled “4. TNT Placement Prevention”mc.on("block.place", function(e) if e.block == "minecraft:tnt" then e.player:sendMessage("TNT is disabled on this server!") e:cancel() endend)5. Audit Log That Sees Cancelled Actions
Section titled “5. Audit Log That Sees Cancelled Actions”Runs last and also receives events that other handlers cancelled:
mc.on("block.break", function(e) local status = e.cancelled and "denied" or "ok" print(("%s broke %s at %d %d %d: %s"):format(e.player.name, e.block, e.pos.x, e.pos.y, e.pos.z, status))end, { priority = "lowest", receiveCancelled = true })