import*as vlk from'@minecraft/server-ui';
import*as DynamicPropertiesDefinition from'@minecraft/server'import*as Minecraft from'@minecraft/server';
import
{
world,system
}
from'@minecraft/server';
import
{
getScore,getDurability,setScore,getRank,oRank,getTitle,setConfig,getExperienceLevel
}
from'./functions.js';
import
{
settings,objects,boxes,Misions,amulets,habilities,cosmetics,SmithCatalog
}
from'./database.js';
export function joinSelect(player)
{
const form=new vlk.ActionFormData()form.title(`Bienvenido`)form.body(`Se bienvenido a nether multiplayer`)form.button(`Continuar`)form.show(player).then((r)=>
{
player.triggerEvent(`Spawn`)
}
)
}
export function support(player)
{
const form=new vlk.ActionFormData().title(`Soporte Técnico`).body(`§cNether Multiplayer:§r\n\nProyecto creado originalmente por:\n\n-§cDarpaCrafter292§r\n-§cGeneral Bárbaro.§r\n\nTodos los complementos añadidos para el desarrollo de este servidor fueron proporcionados por:\n\n§d©DarpaGame Studios`).button(`Salir`).show(player).then(result=>
{
if(result.selection===0)
{
}
}
)
}
export function mision(player)
{
const form=new vlk.ActionFormData().title(`Misiones disponibles`)for(const mis of Misions)
{
form.body(`Misiones disponibles:`)form.button(`$
{
mis.name
}
`,`$
{
mis.icon
}
`)
}
form.show(player).then(result=>
{
const r=result.selection if(result.canceled)
{
}
if(result.selection===0)
{
startMision(player,Misions[0])
}
if(result.selection>0)
{
startMision(player,Misions[r])
}
}
)
}
export function mainMenu(player)
{
let players=[]for(let player1 of Minecraft.world.getPlayers())
{
if(player1.nameTag!==player.nameTag)players.push(player1.name)
}
const form=new vlk.ActionFormData().title(`text.main_menu`).button(' Estadísticas','textures/ui/icon_book_writable').button(' Tienda','textures/ui/store_icon').button(' Reportar Jugador','textures/ui/reports_icon2')
{
if(player.getTags().find((tag)=>tag.startsWith("<server/")))
{
form.button('Administración','textures/ui/op_logo')
}
}
form.button('Salir','textures/ui/arrow_back')form.show(player).then(result=>
{
if(result.selection===0)
{
stats(player)
}
else if(result.selection===1)
{
store(player)
}
else if(result.selection===2)
{
if(players[0])
{
try
{
reportMenu(player)
}
catch
{
}
}
else if(!players[0])
{
try
{
reportsOff(player)
}
catch
{
}
}
}
else if(result.selection===3)
{
if(player.getTags().find((tag)=>tag.startsWith("<server/")))
{
admin(player)
}
else if(!player.getTags().find((tag)=>tag.startsWith("<server/")))return
}
else if(result.selection===4)
{
}
}
)
};
export function reportMenu(player)
{
let players=[]for(let player1 of Minecraft.world.getPlayers())
{
if(player1.nameTag!==player.nameTag)players.push(player1.name)
}
const form=new vlk.ModalFormData().title('Menú de reportes').dropdown("\n¿A quien desesas reportar?\n\nSelecciona un jugador",players).toggle('Uso de Hacks',false).toggle('Lenguaje inapropiado',false)form.show(player).then((r)=>
{
if(r.canceled)
{
mainMenu(player)
}
const
{
canceled,formValues
}
=r let selectedPlayer=players[r.formValues[0]]for(let playe of Minecraft.world.getPlayers())
{
let rp=player.getTags().find((tag)=>tag.startsWith("rp:"));
if((playe.name==selectedPlayer)&&!rp.includes(`$
{
selectedPlayer
}
`))
{
try
{
player.removeTag(`$
{
rp
}
`)player.addTag(`$
{
rp
}
$
{
selectedPlayer
}
|`)setScore(playe,'reports',getScore(playe,'reports')+1);
player.sendMessage('§aReporte Exitoso: §fEl jugador §5'+selectedPlayer+'§f ha sido reportado.')
}
catch
{
}
}
else if(rp.includes(`$
{
selectedPlayer
}
`))
{
try
{
player.sendMessage('§cREPORTE ANULADO: §fYa habías reportado a este jugador anteriormente.')
}
catch
{
}
}
}
}
)
};
export function globalHost(source)
{
const form=new vlk.ActionFormData()form.title("§l§i§s§t")let player=Minecraft.world.getPlayers().find((a)=>a)const entity=world.getDimension(`nether`).getEntities(
{
type:"dg:global_host"
}
).find((p)=>p.nameTag==`global_host`)form.body(`$
{
entity.name?(entity.name):('')
}
`)const inv=entity.getComponent('inventory').container for(let i=0x0;
i<inv.size;
i++)
{
const item=inv.getItem(i);
if(item===undefined)
{
form.button(`$
{
i
}
`,`textures/ui/items/void`)
}
if(item!==undefined)
{
form.button(`$
{
i<=8?("§l§o§c§k"):("inventario")
}
`,`textures/items/$
{
item.typeId.replace('dg:','').replace('minecraft:','')
}
`)
}
};
form.show(source).then(result=>
{
const r=result.selection if(r==0)
{
manageSlot(source,inv.getItem(r),r)
}
if(r>0)
{
manageSlot(source,inv.getItem(r),r)
}
}
)
}
function manageSlot(source,itemstack,slot)
{
const form=new vlk.ActionFormData()form.title(`Editar espacio.`)form.body(`$
{
itemstack?(`\nInformación:\n\nitem:§c$
{
itemstack.typeId
}
$
{
itemstack.nameTag?(`§r\nNombre:§c$
{
itemstack.nameTag
}
`):(``)
}
\n§rcantidad:§c$
{
itemstack.amount
}
$
{
itemstack.getComponent('durability')?(`§r\nDurabilidad:§c$
{
getDurability(itemstack)
}
`):(``)
}
\n§rslot:§c$
{
slot
}
\n§rLore:$
{
itemstack.getLore()
}
`):(`Este espacio se encuentra vacío`)
}
`)if(itemstack===undefined)
{
form.button(`Subir item`)
}
if(itemstack!==undefined)
{
form.button(`Reubicar item`)
}
form.show(source).then(result=>
{
const r=result.selection if(r==0&&itemstack==undefined)
{
selectItem(source,slot)
}
if(r==0&&itemstack!=undefined)
{
selectItem(source,slot)
}
}
)
}
function selectItem(source,slot)
{
const form=new vlk.ActionFormData()form.title("§l§i§s§t")const inv=source.getComponent('inventory').container const entity=world.getDimension(`nether`).getEntities(
{
type:"dg:global_host"
}
).find((e)=>e.nameTag==`global_host`).getComponent('inventory').container form.body(`$
{
source.name?(source.name):('')
}
`)for(let i=0x0;
i<inv.size;
i++)
{
const item=inv.getItem(i);
if(item===undefined)
{
form.button(`$
{
i
}
`,`textures/ui/items/void`)
}
if(item!==undefined)
{
form.button(`$
{
i<=8?("§l§o§c§k"):("inventario")
}
`,`textures/items/$
{
item.typeId.replace('dg:','').replace('minecraft:','')
}
`)
}
};
form.show(source).then(result=>
{
const r=result.selection const it=inv.getItem(r)const ei=entity.getItem(slot)if(r==0)
{
if(inv.getItem(r)!=undefined&&ei!=undefined)
{
inv.setItem(r,ei)entity.setItem(slot,it)
}
if(inv.getItem(r)===undefined&&ei!==undefined)
{
entity.setItem(slot,undefined)inv.setItem(r,ei)
}
if(inv.getItem(r)!=undefined&&ei==undefined)
{
inv.setItem(r,undefined)entity.setItem(slot,it)
}
}
if(r>0)
{
if(inv.getItem(r)!=undefined&&ei!=undefined)
{
inv.setItem(r,ei)entity.setItem(slot,it)
}
if(inv.getItem(r)===undefined&&ei!==undefined)
{
entity.setItem(slot,undefined)inv.setItem(r,ei)
}
if(inv.getItem(r)!=undefined&&ei==undefined)
{
inv.setItem(r,undefined)entity.setItem(slot,it)
}
}
}
)
}
export function reportMenu2(player)
{
let players=[]for(let player1 of Minecraft.world.getPlayers())
{
players.push(player1.name)
}
const form=new vlk.ModalFormData().title('Menú de reportes').dropdown("\n¿A quien desesas reportar?\n\nSelecciona un jugador",players).toggle('Uso de Hacks',false).toggle('Lenguaje inapropiado',false)form.show(player).then((r)=>
{
const
{
canceled,formValues
}
=r let selectedPlayer=players[r.formValues[0]]for(let playe of Minecraft.world.getPlayers())
{
let rp=player.getTags().find((tag)=>tag.startsWith("rp:"));
if((playe.name==selectedPlayer)&&!rp.includes(`$
{
selectedPlayer
}
`))
{
try
{
player.removeTag(`$
{
rp
}
`)player.addTag(`$
{
rp
}
$
{
selectedPlayer
}
|`)setScore(playe,'reports',getScore(playe,'reports')+1);
player.sendMessage(`§aReporte Exitoso:§fEl jugador§5$
{
selectedPlayer
}
§f ha sido reportado.`)
}
catch
{
}
}
else if(rp.includes(`$
{
selectedPlayer
}
`))
{
try
{
player.sendMessage('§cREPORTE ANULADO: §fYa has reportado a este jugador.')
}
catch
{
}
}
}
}
)
};
export function reportsOff(player)
{
let rank=getRank(player)const form=new vlk.ActionFormData().title('Reportes desactivados').body('Lo sentimos, no hay jugadores conectados...\n\nLos reportes se encuentran temporalmente desactivados, inténtalo cuando haya más de un solo jugador.\n\n').button('Atrás','textures/ui/arrow_back')form.show(player).then(result=>
{
if(result.selection)return
}
)
};
export function stats(player)
{
let rank=oRank(player);
let title=getTitle(player)const health=player.getComponent("minecraft:health").currentValue const form=new vlk.ActionFormData().title('Tus Estadísticas').body(`Detalles:\n\n§cJugador:§r $
{
player.nameTag
}
§r\n§g$
{
getScore(player,'money')
}
§r\nRango:§c$
{
rank
}
§r\n\nNivel:§c$
{
getScore(player,'level')
}
§r\n\nTítulo:§c$
{
title
}
\n\n§rReportes:§c$
{
getScore(player,'reports')
}
/$
{
settings['maxReports']
}
\n\n§fMás Opciones:`).button('Atrás','textures/ui/arrow_back')form.show(player).then(result=>
{
if(result.selection===0)
{
}
}
)
};
export function store(player)
{
let rank=getRank(player)const form=new vlk.ActionFormData().title('§v§e§n§d').body('\n§g===========\n '+`$
{
getScore(player,'money')
}
`+'\n===========\n').button(' Cosméticos y Habilidades','textures/ui/MashupIcon').button(' Cajas y Objetos ','textures/ui/recipe_book_icon').button(' Tarjetas de regalo ','textures/ui/icon_goldenchest').button('Atrás','textures/ui/arrow_back')form.show(player).then(result=>
{
if(result.selection===0)
{
cosHab(player)
}
else if(result.selection===1)
{
itemBox(player)
}
else if(result.selection===2)
{
giftCodes(player)
}
else if(result.selection===3)
{
}
}
)
};
export function smith(player)
{
const form=new vlk.ActionFormData().title(`§c§o§s§m§e§t§i§c`).body('§fMonedas:\n§g===========\n '+`$
{
getScore(player,'money')
}
`+'\n===========\n')for(const cat of SmithCatalog)
{
form.button(`$
{
cat.name
}
\n$
{
cat.price
}
`,`$
{
cat.icon
}
`)
}
form.show(player).then(result=>
{
const r=result.selection if(result.canceled)
{
}
if(result.selection===0)
{
itemBuy(player,SmithCatalog[0])
}
if(result.selection>0)
{
itemBuy(player,SmithCatalog[r])
}
}
)
}
function cosHab(player)
{
let rank=getRank(player)const form=new vlk.ActionFormData().title('§v§e§n§d').body('§fMonedas:\n§g===========\n '+`$
{
getScore(player,'money')
}
`+'\n===========\n').button(' Cosméticos y Apariencia','textures/ui/MashupIcon').button(' Habilidades','textures/ui/habilities').button(' Amuletos','textures/ui/recipe_book_icon').button('Atrás','textures/ui/arrow_back')form.show(player).then(result=>
{
if(result.selection===0)
{
cosm(player)
}
else if(result.selection===1)
{
habs(player)
}
else if(result.selection===2)
{
amul(player)
}
else if(result.selection===3)
{
}
}
)
};
function cosm(player)
{
const form=new vlk.ActionFormData().title('§v§e§n§d').body(`§fMonedas:\n§g===========\n$
{
getScore(player,'money')
}
\n===========\n\n§fOpciones:\n`)for(const cos of cosmetics)
{
form.button(`$
{
cos.name
}
\n$
{
cos.price
}
`,`$
{
cos.icon
}
`)
}
form.show(player).then(result=>
{
const r=result.selection if(result.canceled)
{
cosHab(player)
}
if(result.selection===0)
{
cosHabBuy(player,cosmetics[0])
}
if(result.selection>0)
{
cosHabBuy(player,cosmetics[r])
}
}
)
};
function habs(player)
{
const form=new vlk.ActionFormData().title('§v§e§n§d').body(`§fMonedas:\n§g===========\n$
{
getScore(player,'money')
}
\n===========\n\n§fOpciones:\n`)for(const hab of habilities)
{
form.button(`$
{
hab.name
}
\n$
{
hab.price
}
`,`$
{
hab.icon
}
`)
}
form.show(player).then(result=>
{
const r=result.selection if(result.canceled)
{
cosHab(player)
}
if(result.selection===0)
{
cosHabBuy(player,habilities[0])
}
if(result.selection>0)
{
cosHabBuy(player,habilities[r])
}
}
)
};
function amul(player)
{
const form=new vlk.ActionFormData().title('§v§e§n§d').body(`§fMonedas:\n§g===========\n$
{
getScore(player,'money')
}
\n===========\n\n§fOpciones:\n`)for(const amulet of amulets)
{
form.button(`$
{
amulet.name
}
\n$
{
amulet.price
}
`,`$
{
amulet.icon
}
`)
}
form.show(player).then(result=>
{
const r=result.selection if(result.canceled)
{
cosHab(player)
}
if(result.selection===0)
{
cosHabBuy(player,amulets[0])
}
if(result.selection>0)
{
cosHabBuy(player,amulets[r])
}
}
)
};
function cosHabBuy(player,object)
{
let rank=getRank(player)let money=getScore(player,'money')let unlock=player.getTags().find((tag)=>tag.startsWith("unlock:"));
let tag=player.getTags().find((tag)=>tag.startsWith(`$
{
object.tag
}
`));
const form=new vlk.ActionFormData().title(`$
{
object.name
}
`).body(`\n$
{
object.description
}
\n`)if(unlock.includes(`$
{
object.id
}
`))
{
form.button(`Equipar`,`$
{
object.icon
}
`)
}
if(!unlock.includes(`$
{
object.id
}
`))
{
form.button(`Comprar y equipar por:\n$
{
object.price
}
`,`$
{
object.icon
}
`)
}
form.button('Atrás','textures/ui/arrow_back')form.show(player).then(result=>
{
if(result.selection===0)
{
if((getScore(player,'money')>=object.price)&&(!unlock.includes(`$
{
object.id
}
`)))
{
let p=money-object.price const buy=new vlk.MessageFormData().title("Confirmar Compra").body(`\n\n¿Estás seguro de comprar y equipar"$
{
object.name
}
"por$
{
object.price
}
?`).button1("NO").button2("SI")buy.show(player).then(r=>
{
if(r.selection===1)
{
setScore(player,'money',p)object.prop(player)player.removeTag(`$
{
tag
}
`)for(const ev of object.event)
{
player.runCommandAsync(`$
{
ev
}
`)
}
player.removeTag(`$
{
unlock
}
`)player.addTag(`$
{
unlock
}
$
{
object.id
}
`)player.addTag(`$
{
object.tag
}
$
{
object.id
}
`)
}
else if(r.selection===0)
{
cosHabBuy(player,object)
}
}
)
}
else if(unlock.includes(`$
{
object.id
}
`))
{
player.removeTag(`$
{
tag
}
`)object.prop(player)for(const ev of object.event)
{
player.runCommandAsync(`$
{
ev
}
`)
}
player.addTag(`$
{
object.tag
}
$
{
object.id
}
`)
}
else if((getScore(player,'money')<object.price)&&(!unlock.includes(`$
{
object.id
}
`)))
{
const buy=new vlk.MessageFormData().title("Sin Monedas").body(`\n\nNo tienes§gMonedas§r suficientes para comprar este objeto,vuelve cuando tengas como mínimo§g$
{
object.price
}
`).button2('Volver al menú').button1('Salir')buy.show(player).then(r=>
{
if(r.selection===1)
{
if(object.type==="cosmetic")
{
cosmetics(player)
}
else if(object.type==="hability")
{
habs(player)
}
else if(object.type==="amulet")
{
amulets(player)
}
}
}
)
}
}
else if(result.selection===1)
{
if(object.type==="cosmetic")
{
cosmetics(player)
}
else if(object.type==="hability")
{
habs(player)
}
else if(object.type==="amulet")
{
amulets(player)
}
}
}
)
};
function itemBox(player)
{
let rank=getRank(player)const form=new vlk.ActionFormData().title(' Cajas y Objetos').body(`§fMonedas:\n§g===========\n$
{
getScore(player,'money')
}
\n===========\n\n§fOpciones:\n`).button(`Cofres de Objetos`,`textures/ui/inventory_icon`).button(`Objetos Especiales`,`textures/ui/icon_fall`).button('Atrás','textures/ui/arrow_back')form.show(player).then(result=>
{
if(result.selection===0)
{
itemBoxes(player)
}
else if(result.selection===1)
{
items(player)
}
else if(result.selection===2)
{
}
}
)
};
function itemBoxes(player)
{
const form=new vlk.ActionFormData().title(' Cajas de Objetos').body(`§fMonedas:\n§g===========\n$
{
getScore(player,'money')
}
\n===========\n\n§fOpciones:\n`)for(const box of boxes)
{
form.button(`$
{
box.name
}
\n$
{
box.price
}
`,`$
{
box.icon
}
`)
}
form.show(player).then(result=>
{
const r=result.selection if(result.canceled)
{
itemBox(player)
}
if(result.selection===0)
{
itemBuy(player,boxes[0])
}
if(result.selection>0)
{
itemBuy(player,boxes[r])
}
}
)
};
function items(player)
{
const form=new vlk.ActionFormData().title(' Objetos Especiales').body(`§fMonedas:\n§g===========\n$
{
getScore(player,'money')
}
\n===========\n\n§fOpciones:\n`)for(const obj of objects)
{
form.button(`$
{
obj.name
}
\n$
{
obj.price
}
`,`$
{
obj.icon
}
`)
}
form.show(player).then(result=>
{
const r=result.selection if(result.canceled)
{
itemBox(player)
}
if(result.selection===0)
{
itemBuy(player,objects[0])
}
if(result.selection>0)
{
itemBuy(player,objects[r])
}
}
)
};
function itemBuy(player,object)
{
let rank=getRank(player)const form=new vlk.ActionFormData().title(`$
{
object.name
}
`).body(`\n$
{
object.description
}
\n`).button(`Comprar por:\n$
{
object.price
}
`,`$
{
object.icon
}
`).button('Atrás','textures/ui/arrow_back')form.show(player).then(result=>
{
if(result.selection===0)
{
if(getScore(player,'money')>=object.price)
{
let money=getScore(player,'money')const buy=new vlk.MessageFormData().title("Confirmar Compra").body(`\n\n¿Estás seguro de comprar"$
{
object.name
}
"por$
{
object.price
}
?`).button1("NO").button2("SI")buy.show(player).then(r=>
{
if(r.selection===1)
{
for(const ev of object.event)
{
player.runCommandAsync(`$
{
ev
}
`)
}
setScore(player,'money',money-object.price)
}
else if(r.selection===0)
{
itemBuy(player,object)
}
}
)
}
else if(getScore(player,'money')<object.price)
{
const buy=new vlk.MessageFormData().title("Sin Monedas").body(`\n\nNo tienes§gMonedas§r suficientes para comprar este objeto,vuelve cuando tengas como mínimo§g$
{
object.price
}
`).button2('Volver al menú').button1('Salir')buy.show(player).then(r=>
{
if(r.selection===1)
{
if(object.type==="box")
{
itemBoxes(player)
}
else if(object.type==="item")
{
items(player)
}
else if(object.type==="smith")
{
smith(player)
}
}
}
)
}
}
else if(result.selection===1)
{
if(object.type==="box")
{
itemBoxes(player)
}
else if(object.type==="item")
{
items(player)
}
else if(object.type==="smith")
{
smith(player)
}
}
}
)
};
function startMision(player,mision)
{
let rank=getRank(player)let completed=player.getTags().find((tag)=>tag.startsWith("completed:"))const first=!completed.includes(mision.id)const form=new vlk.ActionFormData()form.title(`$
{
mision.name
}
`)if(!first)
{
form.body(`\n$
{
mision.description
}
\n\nJugadores recomendados:$
{
mision.players
}
\n\nRecompensa:§g$
{
mision.reward
}
`)
}
if(first)
{
form.body(`\n$
{
mision.description
}
\n\nJugadores recomendados:$
{
mision.players
}
\n\nRecompensa:§g$
{
mision.first
}
`)
}
form.button(`Iniciar Misión`,`$
{
mision.icon
}
`)form.show(player).then(result=>
{
if(result.selection===0)
{
for(const ev of mision.event)
{
player.runCommandAsync(`$
{
ev
}
`)
}
}
}
)
}
function giftCodes(player)
{
let rank=getRank(player)const form=new vlk.ModalFormData().title("Canjear código de regalo").textField("\n\nIngresa el código:","XABC-DEF-GHI-JX","");
form.show(player).then(result=>
{
if(result.canceled)
{
store(player)
}
if(result.selection===0)
{
}
else if(result.selection===1)
{
}
else if(result.selection===2)
{
}
else if(result.selection===3)
{
}
}
)
};
export function adminC(player)
{
let rank=getRank(player)const form=new vlk.ActionFormData().title('Administración').body('§rOpciones:').button('Gestiónar jugadores','textures/ui/players_logo').button('Configuración del mundo','textures/ui/config_logo').button('Herramientas de desarrollo','textures/ui/debug_logo').button('Atrás','textures/ui/arrow_back')form.show(player).then(result=>
{
if(result.selection===0)
{
let players=[]for(let player1 of Minecraft.world.getPlayers())
{
players.push(player1.name)
}
const form=new vlk.ModalFormData().title('Menú de reportes').dropdown("\nSelecciona un jugador",players).toggle('Editar datos',false)form.show(player).then((r)=>
{
if(r.canceled)
{
admin(player)
}
const
{
canceled,formValues
}
=r let selectedPlayer=players[r.formValues[0]]for(let playe of Minecraft.world.getPlayers())
{
if((playe.name===selectedPlayer)&&(r.formValues[1]===false))
{
try
{
let rank=oRank(playe);
let title=getTitle(playe)const form=new vlk.ActionFormData().title(`Estadísticas de $
{
playe.nameTag
}
`).body(`Detalles:\n\n§cJugador:§r $
{
playe.nameTag
}
§r\n§g$
{
getScore(playe,'money')
}
§r\nRango:§c$
{
rank
}
§r\n\nNivel:§c$
{
getScore(playe,'level')
}
§r\n\nTítulo:§c$
{
title
}
\n\n§rReportes:§c$
{
getScore(playe,'reports')
}
/$
{
settings['maxReports']
}
\n\n§fMás Opciones:`).button('Atrás','textures/ui/arrow_back').show(player).then(result=>
{
if(result.selection===0)
{
admin(player)
}
}
)
}
catch
{
}
}
else if((playe.name===selectedPlayer)&&(r.formValues[1]===true))
{
try
{
dataChanger(player,playe)
}
catch(error)
{
return"error"
}
}
}
}
)
}
else if(result.selection===1)
{
worldConfig(player)
}
else if(result.selection===2)
{
devTools(player)
}
}
)
};
export function modC(player)
{
let rank=getRank(player)const form=new vlk.ActionFormData().title('Administración').body('§rOpciones:').button('Gestiónar jugadores','textures/ui/players_logo').button('Herramientas de desarrollo','textures/ui/debug_logo').button('Atrás','textures/ui/arrow_back')form.show(player).then(result=>
{
if(result.selection===0)
{
let players=[]for(let player1 of Minecraft.world.getPlayers())
{
players.push(player1.name)
}
const form=new vlk.ModalFormData().title('Menú de reportes').dropdown("\nSelecciona un jugador",players).toggle('Editar datos',false)form.show(player).then((r)=>
{
if(r.canceled)
{
admin(player)
}
const
{
canceled,formValues
}
=r let selectedPlayer=players[r.formValues[0]]for(let playe of Minecraft.world.getPlayers())
{
if((playe.name===selectedPlayer)&&(r.formValues[1]===false))
{
try
{
let rank=oRank(playe);
let title=getTitle(playe)const form=new vlk.ActionFormData().title(`Estadísticas de $
{
playe.nameTag
}
`).body(`Detalles:\n\n§cJugador:§r $
{
playe.nameTag
}
§r\n§g$
{
getScore(playe,'money')
}
§r\nRango:§c$
{
rank
}
§r\n\nNivel:§c$
{
getScore(playe,'level')
}
§r\n\nTítulo:§c$
{
title
}
\n\n§rReportes:§c$
{
getScore(playe,'reports')
}
/$
{
settings['maxReports']
}
\n\n§fMás Opciones:`).button('Atrás','textures/ui/arrow_back').show(player).then(result=>
{
if(result.selection===0)
{
admin(player)
}
}
)
}
catch
{
}
}
else if((playe.name===selectedPlayer)&&(r.formValues[1]===true))
{
try
{
dataChanger(player)
}
catch(error)
{
return"error"
}
}
}
}
)
}
else if(result.selection===1)
{
devTools(player)
}
}
)
};
function dataChanger(source,player)
{
let rank=getRank(player)let title=getTitle(player)const form=new vlk.ModalFormData().title(`Editar Datos de $
{
player.nameTag
}
`).textField(`Detalles:\n\n§cJugador:§r $
{
player.nameTag
}
§r\n\nMonedas:`,"number",`$
{
getScore(player,'money')
}
`).dropdown("Rango:",[" Cobre"," Hierro"," Oro"," Esmeralda"," Diamante"," Enderium"],rank).textField(`Nivel:`,"number",`$
{
getScore(player,"level")
}
`).textField(`Título:`,"",`$
{
title
}
`).slider(`Reportes:§c§`,0,settings['maxReports'],1,getScore(player,'reports'))form.show(source).then(result=>
{
const money=result.formValues[0]const delRank=player.getTags().find((tag)=>tag.startsWith("rank:"))const delTitle=player.getTags().find((tag)=>tag.startsWith("title:"))const rank=result.formValues[1]const level=result.formValues[2]const title=result.formValues[3]const reports=result.formValues[4]player.runCommandAsync(`scoreboard players set $
{
player.name
}
money $
{
money
}
`)player.removeTag(`$
{
delRank
}
`)player.runCommandAsync(`scoreboard players set $
{
player.name
}
level $
{
level
}
`)player.removeTag(`$
{
delTitle
}
`)player.addTag(`title:$
{
title
}
`)setScore(player,'reports',reports)if(result.canceled)
{
admin(player)
}
if(rank>0)
{
player.addTag(`rank:$
{
rank
}
`)
}
}
)
};
function worldConfig(player)
{
const form=new vlk.ModalFormData().title(`Configuración del mundo`).textField("Radio de aparición:","number",`$
{
world.gameRules.spawnRadius
}
`).textField("Velocidad de marca aleatoria:","number",`$
{
world.gameRules.randomTickSpeed
}
`).slider(`Número máximo de reportes`,1,20,1,settings['maxReports']).textField("Porcentaje de jugadores que deben dormir:","number",`$
{
world.gameRules.playersSleepingPercentage
}
`).textField("Punto de generación del mundo:","x: y: z:",settings['worldSpawn']).toggle('Mantener Inventario',world.gameRules.keepInventory).toggle('Mostrar Coordenadas',world.gameRules.showCoordinates).toggle('Realizar ciclo diurno',world.gameRules.doDayLightCycle).toggle('Reaparición inmediata',world.gameRules.doImmediateRespawn).toggle('Generación de Entidades',world.gameRules.doMobSpawning).toggle('La dinamita explota',world.gameRules.tntExplodes).toggle('Las camas explotan',world.gameRules.respawnBlocksExplode).toggle('Botín de entidades',world.gameRules.doMobLoot).toggle('Vandalismo de Criaturas',world.gameRules.mobGriefing).toggle('Daño por fuego',world.gameRules.fireDamage).toggle('Daño por caída',world.gameRules.fallDamage).toggle('Daño por ahogamiento',world.gameRules.drowningDamage).toggle('Daño por congelación',world.gameRules.freezeDamage).toggle('Bloques de comandos',world.gameRules.commandBlocksEnabled).toggle('Inmunidad al aparecer',settings['spawnInmunity']).toggle('Fuego amigo (pvp)',world.gameRules.pvp).show(player).then(r=>
{
if(r.canceled)
{
admin(player)
}
const responses=r.formValues;
settings['spawnRadius']=responses[0];
Minecraft.world.setDynamicProperty('spawnRadius',settings['spawnRadius']);
settings['tickSpeed']=responses[1];
Minecraft.world.setDynamicProperty('tickSpeed',settings['tickSpeed']);
settings['maxReports']=responses[2];
Minecraft.world.setDynamicProperty('maxReports',settings['maxReports']);
settings['sleepPercent']=responses[3];
Minecraft.world.setDynamicProperty('maxReports',settings['sleepPercent']);
settings['worldSpawn']=responses[4];
Minecraft.world.setDynamicProperty('worldSpawn',settings['worldSpawn']);
settings['keepInventory']=responses[5];
Minecraft.world.setDynamicProperty('keepInventory',settings['keepInventory']);
settings['showCoords']=responses[6];
Minecraft.world.setDynamicProperty('showCoords',settings['showCoords']);
settings['dayCycle']=responses[7];
Minecraft.world.setDynamicProperty('dayCycle',settings['dayCycle']);
settings['immediateRespawn']=responses[8];
Minecraft.world.setDynamicProperty('immediateRespawn',settings['immediateRespawn']);
settings['mobSpawning']=responses[9];
Minecraft.world.setDynamicProperty('mobSpawning',settings['mobSpawning']);
settings['tntExplodes']=responses[10];
Minecraft.world.setDynamicProperty('tntExplodes',settings['tntExplodes']);
settings['bedExplodes']=responses[11];
Minecraft.world.setDynamicProperty('bedExplodes',settings['bedExplodes']);
settings['mobLoot']=responses[12];
Minecraft.world.setDynamicProperty('mobLoot',settings['mobLoot']);
settings['mobGriefing']=responses[13];
Minecraft.world.setDynamicProperty('mobGriefing',settings['mobGriefing']);
settings['fireDamage']=responses[14];
Minecraft.world.setDynamicProperty('fireDamage',settings['fireDamage']);
settings['fallDamage']=responses[15];
Minecraft.world.setDynamicProperty('fallDamage',settings['fallDamage']);
settings['drowningDamage']=responses[16];
Minecraft.world.setDynamicProperty('drowningDamage',settings['drowningDamage']);
settings['freezeDamage']=responses[17];
Minecraft.world.setDynamicProperty('freezeDamage',settings['freezeDamage']);
settings['commandBlocks']=responses[18];
Minecraft.world.setDynamicProperty('commandBlocks',settings['commandBlocks']);
settings['spawnInmunity']=responses[19];
Minecraft.world.setDynamicProperty('spawnInmunity',settings['spawnInmunity']);
settings['pvp']=responses[20];
Minecraft.world.setDynamicProperty('pvp',settings['pvp']);
const source=player setConfig(source)
}
)
};
function devTools(player)
{
const form=new vlk.ActionFormData().title('Herramientas de desarrollo').body('§rOpciones:').button('Kit de desarrollo','textures/ui/items/devtools').button('Kit de análisis','textures/ui/ui_debug_glyph_color').button('Vanilla recovery','textures/ui/storageIconColor').button('Atrás','textures/ui/arrow_back')form.show(player).then(result=>
{
if(result.selection===0)
{
player.runCommandAsync('give @s command_block')
}
else if(result.selection===1)
{
player.runCommandAsync('give @s redstone_block')
}
else if(result.selection===2)
{
player.runCommandAsync('give @s anvil')
}
else if(result.selection===3)
{
admin(player)
}
}
)
};
export function portal(player)
{
const form=new vlk.ActionFormData().title('Viaje Interdimensional').body('\nEl viaje interdimensional se encuentra inhabilitado\n\n¿Deseas Desbloquearlo por §g90§r?\n').button('Si').button('No')form.show(player).then(result=>
{
if(result.selection===0)
{
}
else if(result.selection===1)
{
worldConfig(player)
}
}
)
};
© 2023 Quttera Ltd. All rights reserved.