Spleef
Let’s build a chat command that creates a Spleef arena.
Chat command
Put in an ||player:on chat command|| and rename it to spleef.
player.onChat("spleef", function () {
})Fill a lava layer
Place a ||blocks:fill|| in side ||player:on chat command|| to create a layer of lava in the ground between
the player position ~0 ~-1 ~0 and ten blocks away north and west ~10 ~-1 ~10.
The ||blocks:fill|| takes two locations in the world and fills that area with Lava.
By default, it takes coordinates relative to the player, that is what the ~ means in slash commands.
- ~0 ~-1 ~0 means 0 blocks west, 1 block down (-1 up), 0 block north.
- ~10 ~-1 ~10 means 10 blocks west, 1 block down (-1 up), 10 block north.
player.onChat("spleef", function () {
    blocks.fill(
        LAVA,
        pos(0, -1, 0),
        pos(10, -1, 10),
        FillOperation.Replace
    )
})Add some snow
Put in another ||blocks:fill|| to create a layer of snow in the air between
the player position ~0 ~4 ~0 and ten blocks away north and west ~10 ~4 ~10.
~0 ~4 ~0 means 0 blocks west, 4 block up, 0 block north. ~10 ~4 ~10 means 10 blocks west, 4 block up, 10 block north.
player.onChat("spleef", function () {
    blocks.fill(
        LAVA,
        pos(0, -1, 0),
        pos(10, -1, 10),
        FillOperation.Replace
    )
    blocks.fill(
        SNOW,
        pos(0, 4, 0),
        pos(10, 4, 10),
        FillOperation.Replace
    )
})Try chat command
Go to Minecraft, press t to open the chat and enter spleef.
GREIFING ALERT!!! This mod will grief your blocks. Ask your friends before griefing their worlds.
Variable arena size
Add a number parameter to the ||player:on chat command|| called num1. In Blocks, click on the (+) symbol to add the parameter.
Replace the number 10 with the ||variables:num1|| variable.
So far, the arena created is just 10x10… boring! By using the ||variables:num1|| variable instead, the user can select the size of every game.
player.onChat("spleef", function (num1) {
    blocks.fill(
        LAVA,
        pos(0, -1, 0),
        pos(num1, -1, num1),
        FillOperation.Replace
    )
    blocks.fill(
        SNOW,
        pos(0, 4, 0),
        pos(num1, 4, num1),
        FillOperation.Replace
    )
})Try a different size
Got to Minecraft and enter spleef 25 in the chat.
Teleport the players
Place a ||mobs:teleport to position|| at the end to select all players and teleport them to ~num1/2 ~5 ~num1/2.
player.onChat("spleef", function (num1) {
    blocks.fill(
        LAVA,
        pos(0, -1, 0),
        pos(num1, -1, num1),
        FillOperation.Replace
    )
    blocks.fill(
        SNOW,
        pos(0, 4, 0),
        pos(num1, 4, num1),
        FillOperation.Replace
    )
    mobs.teleportToPosition(
        mobs.target(ALL_PLAYERS),
        pos(num1 / 2, 5, num1 / 2)
    )
})Set Survival Mode
Finally, put in a ||gameplay:set game mode|| to switch all players to survival mode.
player.onChat("spleef", function (num1) {
    blocks.fill(
        LAVA,
        pos(0, -1, 0),
        pos(num1, -1, num1),
        FillOperation.Replace
    )
    blocks.fill(
        SNOW,
        pos(0, 4, 0),
        pos(num1, 4, num1),
        FillOperation.Replace
    )
    mobs.teleportToPosition(
        mobs.target(ALL_PLAYERS),
        pos(num1 / 2, 5, num1 / 2)
    )
    gameplay.setGameMode(
        SURVIVAL,
        mobs.target(ALL_PLAYERS)
    )
}) 
            