猫史档案馆


[蛋蛋代码V] 聊天区历史记录代码

用户:egg鸡蛋蛋egg鸡蛋蛋查看:11 回复:3 评论:11 创建时间:2022-05-07T20:15:48


历史记录

是个好东西

(比如你的浏览器历史记录

world.lsjl = []
console.clear()
world.onChat(async ({ entity, message }) => {
    if (entity.isPlayer) {
        if (message == '历史记录') {
            ls()
            async function ls() {
                const sel = await entity.player.dialog({
                    type: Box3DialogType.SELECT,
                    titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
                    titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
                    contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
                    contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
                    title: '历史记录',
                    content: `
               请选择您的操作
                `,
                    options: ['查看历史记录', '删除历史记录'],
                })
                if (sel) {
                    if (sel.value == '查看历史记录') {
                        const sel = await entity.player.dialog({
                            type: Box3DialogType.SELECT,
                            title: '历史记录',
                            content: `
               目前有这些历史记录
                `,
                            options: world.lsjl,
                        })
                        ls()
                    }
                    if (sel.value == '删除历史记录') {
                        const sel = await entity.player.dialog({
                            type: Box3DialogType.SELECT,
                            title: '历史记录',
                            content: `
              请问您要选择哪一种删除方式
                `,
                            options: ['全部删除'],
                        })
                        if (sel) {
                            if (sel.value == '全部删除') {
                                world.lsjl = []
                                ls()
                                entity.player.directMessage('删除成功')
                            }
                        }
                        else {
                            ls()
                        }
                    }
                }
                return;
            }
        }
        world.lsjl.push(entity.player.name + ':' + message)
        console.log(entity.player.name + ':' + world.lsjl)
    }
    else {
        return;
    }
})

食用前请查看评论区是否有修正版

/代码版权:egg-鸡蛋蛋/


回复

上一页1 页 / 共 1下一页
egg鸡蛋蛋egg鸡蛋蛋

center_image

天真无邪的眼神

求点赞

点赞3


评论


yee089yee089

我白嫖了()

点赞0


评论


传说之下ULB--sans传说之下ULB--sans

沙发

点赞0


评论