0% found this document useful (0 votes)
4 views1 page

Minecraft Base Teleport Commands

The document contains a Minecraft server script that allows players to set a base location using the command ';setbase', teleport to that base with ';tpbase', and open a GUI menu with the command ';menu'. The script captures player commands, updates the base coordinates, and provides feedback to the player. It utilizes the ActionFormData class to create an interactive menu for teleportation options.

Uploaded by

aadi.jha414.duo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Minecraft Base Teleport Commands

The document contains a Minecraft server script that allows players to set a base location using the command ';setbase', teleport to that base with ';tpbase', and open a GUI menu with the command ';menu'. The script captures player commands, updates the base coordinates, and provides feedback to the player. It utilizes the ActionFormData class to create an interactive menu for teleportation options.

Uploaded by

aadi.jha414.duo
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import { world } from "@minecraft/server";

import { ActionFormData } from "@minecraft/server-ui";

let baseX = 0;
let baseY = 0;
let baseZ = 0;

// Command: set base


[Link](ev => {
if ([Link] === ";setbase") {
let player = [Link];
baseX = [Link].x;
baseY = [Link].y;
baseZ = [Link].z;
[Link](`Base set at: ${baseX}, ${baseY}, ${baseZ}`);
[Link] = true;
}
});

// Command: teleport to base


[Link](ev => {
if ([Link] === ";tpbase") {
let player = [Link];
[Link]({ x: baseX, y: baseY, z: baseZ }, { dimension: [Link]
});
[Link]("Teleported to base!");
[Link] = true;
}
});

// Command: open GUI menu


[Link](ev => {
if ([Link] === ";menu") {
let player = [Link];

let form = new ActionFormData()


.title("Teleport Menu")
.body("Choose an option:")
.button("Teleport to Base")
.button("Cancel");

[Link](player).then(response => {
if ([Link] === 0) {
[Link]({ x: baseX, y: baseY, z: baseZ }, { dimension:
[Link] });
[Link]("Teleported to base!");
}
});

[Link] = true;
}
});

You might also like