fix target.chat (because new nmp version)

This commit is contained in:
ChomeNS 2023-01-16 19:20:39 +07:00
parent 8c17e0c8c9
commit 3993d67a8b
3 changed files with 6 additions and 5 deletions

View file

@ -39,7 +39,8 @@ function inject (bot, dcclient, config) {
const clientPacketBlacklist = []
const targetPacketBlacklist = []
target.chat = function (message) {
// target.chat exist so yeah..
target.sendMessage = function (message) {
if (minecraftVersionToNumber(target.version) >= 1.19) {
if (message.startsWith('/')) {
target.write('chat_command', {

View file

@ -50,7 +50,7 @@ function inject (bot, client, target, config, clientPacketBlacklist) {
]
})
} else {
target.chat(data)
target.sendMessage(data)
}
})
};

View file

@ -34,10 +34,10 @@ function inject (bot, client, target, config) {
const interval = setInterval(() => {
if (bot.options.kaboom) {
if (!op && config.self_care.op) target.chat('/minecraft:op @s[type=player]')
if (!cspy && config.self_care.cspy) target.chat('/commandspy:commandspy on')
if (!op && config.self_care.op) target.sendMessage('/minecraft:op @s[type=player]')
if (!cspy && config.self_care.cspy) target.sendMessage('/commandspy:commandspy on')
}
// if (gameMode !== 1 && config.self_care.gamemode) target.chat('/minecraft:gamemode creative @s[type=player]')
// if (gameMode !== 1 && config.self_care.gamemode) target.sendMessage('/minecraft:gamemode creative @s[type=player]')
}, config.self_care_check_interval)
bot.on('end', () => {