用户:
岓查看:0 回复:0 评论:0 创建时间:2024-01-17T11:04:08
if(message===/)} {if(!gly.includes(entity.player.name))return const sel = await entity.player.dialog({ type: Box3DialogType.SELECT, title: '控制面板', content: `管喵${entity.player.name},欢迎使用控制面板,请选择你要执行的选项( 严 禁 滥 用 管 理 权 !)`, options: ['禁言','解除禁言','踢人','植入代码','查看举报'] }) if(sel){ if(sel.value==='禁言') { let options = [] world.querySelectorAll('player').forEach((x) => { options.push(x.player.name) }) const e = await entity.player.dialog({ type:'select', title:'禁言', content:'您要禁言谁', options:options }) if(e) { world.querySelectorAll('player').forEach((x) => { if(x.player.name == e.value) { x.player.muted = true world.say(`管喵${entity.player.name}禁言了${x.player.name}`) } }) } } else if(sel.value==='解除禁言') { let options = [] world.querySelectorAll('player').forEach((x) => { options.push(x.player.name) }) const e = await entity.player.dialog({ type:'select', title:'解除禁言', content:'您要解除禁言谁', options:options }) if(e) { world.querySelectorAll('player').forEach((x) => { if(x.player.name == e.value) { x.player.muted = false world.say(`管喵${entity.player.name}解除禁言了${x.player.name}`) } }) } } else if(sel.value==='踢人') { let options = [] world.querySelectorAll('player').forEach((x) => { options.push(x.player.name) }) const e = await entity.player.dialog({ type:'select', title:'踢人', content:'您要题踢谁', options:options }) if(e) { world.querySelectorAll('player').forEach((x) => { if(x.player.name == e.value) { x.player.kick() world.say(`管喵${entity.player.name}踢走了${x.player.name}`) } }) } } else if(sel.value==='植入代码') { const code = await entity.player.dialog({ type: Box3DialogType.INPUT, title:'植入代码', content: '请正确输入指令' }) world.say(`管喵${entity.player.name}执行了代码${code}`) try{ entity.player.directMessage('~>'+eval(code)) } catch (err) { entity.player.directMessage('<~'+err) } } else if(sel.value==='查看举报') { printRecord_jvbao_Box(entity) } } }
setInterval(() => { world.querySelectorAll('player').forEach(entity => { entity.hp = Math.min(entity.maxHp, entity.hp + 1) }) }, 2000); // 创建表 async function createTables_jvbao_box() { await db.sql`CREATE TABLE IF NOT EXISTS jvbao_box ( commenternamename VARCHAR(50) NOT NULL, name VARCHAR(50) NOT NULL, opinion VARCHAR(200) NOT NULL )` } /* 在脚本开始的时候执行 */ (async function() { await createTables_jvbao_box() }()); // 插入数据函数 async function insertRecord_jvbao_box(commentername,name, opinion) { try{ await db.sql`INSERT INTO jvbao_box VALUES (${commentername},${name}, ${opinion})` } catch (e) { world.say(`insert sql error: ${e}`) ; } } // 将数据输出 async function printRecord_jvbao_Box(entity) { rows = await db.sql`SELECT * FROM jvbao_box` if (rows && !rows.length) { entity.player.dialog({ type: Box3DialogType.TEXT, title: `系统`, content: `目前还没有举报信息哦!` }) return '目前还没有举报信息哦!'; } for await (const row of db.sql`SELECT * FROM jvbao_box`) { const result = await entity.player.dialog({ type: Box3DialogType.TEXT, title: `系统`, content: `举报者姓名:$喵enternamename} : 被举报者姓名: ${row.name} : 举报信息:${row.opinion}` }) } } // 清除表格所有数据 (表格结构不变) async function removeAll_jvbao_Box() { await db.sql`DELETE FROM jvbao_box`} }