【Lv:2】
- 注册
- 2025/08/13
- 消息
- 4
- 金粒
- 356.47金粒
LeavesMC和Lophine(lophine不再维护)这两个端自带bot的时候遇到以下问题(貌似lophine用的是leaves的假人,这里一起写):
有关msl的配置请见msl官网:https://msl.kysou.xyz/
Github:https://github.com/imkysou/msl
- 安装了AuthMe之后假人无法登录,导致无法攻击挖掘
- 有的时候一个假人执行action但是另一个就不会执行action
- 假人执行action时即使最后一位传参是-1(无限执行)但是过一会儿还是会掉
JavaScript:
/**
* 该插件旨在修复LeavesMC / Lophine的假人与Authme冲突
*/
function showMsg(player, msg) {
plugin_executeCommand(`tellraw ${player} {color:"green",text:"[假人定制优化插件] ",extra:[{text:"${msg}",color:"white"}]}`);
}
let botList = {
testBot: "test"
}
/**
* 创建假人提示
*/
plugin_registerCommand("/bot create <name>", (player, name) => {
botList[name] = player;
showMsg(player, `检测到你正在创建假人。若需假人能够进行攻击、挖掘操作,请在假人进入后使用指令!bb login <假人名>`);
});
/**
* 假人登录提示
*/
plugin_registerCommand("!bb login <name>", (player, name) => {
if (!botList[name] || botList[name] !== player) {
showMsg(player, `你不是 ${name} 的创建者(${botList[name]}),无法登录该假人。`);
return;
}
let randPwd = Math.random().toString(36).substring(2, 10);
plugin_executeCommand(`authme register ${name} ${randPwd}`);
plugin_executeCommand(`authme forcelogin ${name}`);
showMsg(player, `已为假人 ${name} 登录,假人登录后将不会无敌,若这是第一次注册假人,则假人密码为 ${randPwd}`)
})
/**
* 假人无限操作
*/
plugin_registerCommand("/bot action <name> start <action> <a> <b> <c>", (player, name, action, a, b, c) => {
if (c !== "-1") {
showMsg(player, `当前为假人指定的攻击次数不是-1(无限),故该${action}操作将不会永久执行。`);
return;
}
// 检测假人是否存在
if (!botList[name]) {
showMsg(player, `假人 ${name} 不存在,请先创建假人。`);
return;
}
showMsg(player, `该假人将被假人定制优化插件操控,进行无限的${action}操作。注意,假人定制优化插件与bot指令并非同一插件,非原生功能。`);
showMsg(player, `重要提示:若需停止假人所有操作,请执行指令!bb stop <假人名>而不是/bot action`);
let interval = setInterval(() => {
plugin_executeCommand(`bot action ${name} stop all`);
plugin_executeCommand(`bot action ${name} start ${action} ${a} ${b} ${c}`);
}, 20000);
plugin_registerCommand("!bb stop <name>", q = (player, name) => {
clearInterval(interval);
showMsg(player, `已停止假人 ${name} 所有操作。`);
q = null; // 清除监听事件
})
})
/**
* 假人无敌模式
*/
plugin_registerCommand("!bb unbeatable <name>", (player, name) => {
if (!botList[name]) {
showMsg(player, `假人 ${name} 不存在,请先创建假人。`);
return;
}
// 检测假人是否为玩家拥有
if (botList[name] !== player) {
showMsg(player, `你不是 ${name} 的创建者(${botList[name]}),无法开启无敌模式。`);
return;
}
plugin_executeCommand(`gamemode creative ${name}`);
showMsg(player, `已为假人 ${name} 开启无敌模式(创造模式)。若需关闭,请执行指令!bb beatable <假人名>`);
});
/**
* 假人普通模式
*/
plugin_registerCommand("!bb beatable <name>", (player, name) => {
if (!botList[name]) {
showMsg(player, `假人 ${name} 不存在,请先创建假人。`);
return;
}
// 检测假人是否为玩家拥有
if (botList[name] !== player) {
showMsg(player, `你不是 ${name} 的创建者(${botList[name]}),无法修改该假人状态。`);
return;
}
plugin_executeCommand(`gamemode survival ${name}`);
showMsg(player, `已为假人 ${name} 开启普通模式(生存模式)。若需开启,请执行指令!bb unbeatable <假人名>`);
})
有关msl的配置请见msl官网:https://msl.kysou.xyz/
Github:https://github.com/imkysou/msl