-- The smallest mod: greets players and adds /hello and /where. mc.on("join", function(player) player:say("Welcome, " .. player.name .. "! Lua mods are running on this world.") end) mc.command("hello", { description = "Say hello" }, function(ctx) return "Hello, " .. ctx.player.name .. "!" end) mc.command("where", { description = "Show your coordinates" }, function(ctx) local x, y, z = ctx.player:block_pos() return string.format("You are at %d, %d, %d", x, y, z) end) mc.command("tp", { description = "Teleport: /tp ", usage = "/tp ", op = true }, function(ctx) local x, y, z = tonumber(ctx.args[1]), tonumber(ctx.args[2]), tonumber(ctx.args[3]) if not (x and y and z) then return "Usage: /tp (y = 0 puts you on the ground)" end if y <= 0 then mc.world.ensure_loaded(x, z, 1); y = mc.world.height(math.floor(x), math.floor(z)) + 1 end ctx.player:teleport(x + 0.5, y, z + 0.5) return string.format("Teleported to %d, %d, %d", x, y, z) end)