import { world } from "@minecraft/server";
import * as ui from "@minecraft/server-ui";
import { ActionFormData, ModalFormData } from "@minecraft/server-ui"
import { MessageFormData } from "@minecraft/server-ui"
function Form(player) {
let modal = new ActionFormData()
modal.title(" WHITECUBES-UI")
modal.body(`§8${player.name}'s`)
modal.button("-= Warps =-", "textures/ui_icons/clock_icon")
modal.button("-= Shop =-", "textures/ui_icons/ender_icon")
modal.button("-= Money transfer =-", 'textures/ui_icons/sword_icon')
modal.button("-= Settings =-", "textures/ui_icons/spark_icon")
}
let form2 = new ui.ActionFormData()
form2.title("Tutorial")
form2.body("Hi")
form2.button("Back")
function page2(player) {
let modal = new ActionFormData()
modal.title(" WHITECUBES-UI")
modal.body(`§8${player.name}'s`)
modal.button("-= Warps =-", "textures/ui_icons/clock_icon")
modal.button("-= Shop =-", "textures/ui_icons/ender_icon")
modal.button("-= Money transfer =-", 'textures/ui_icons/sword_icon')
modal.button("-= Settings =-", "textures/ui_icons/spark_icon")
modal.show(player).then(result => {
let selection = result.selection
if (selection == 0) {
player.runCommand(
"gamemode c @s"
)
}
if (selection == 1) {
player.runCommand(
"gamemode s @s"
)
}
if (selection == 2) {
player.dimension.createExplosion(player.location, 4, {})
}
if (selection == 3) {
let enoughMoney = player.runCommand(`scoreboard players test @s values 50 50`)
if (enoughMoney) {
player.runCommand("give @s diamond 1")
player.runCommand("scoreboard players remove @s values 50")
}
}
if (selection == 4) {
page2(player)
}
})
}```