Compare commits

..

No commits in common. "afd2e002dfa03feef2455dcdbaf7409d361ccde9" and "f50e388c398d404396d8b997e93b80015b7b6436" have entirely different histories.

2 changed files with 3 additions and 18 deletions

View File

@ -47,9 +47,7 @@ function unloadplugin(pluginname, pluginpath) {
const plugin = require.resolve(pluginpath) const plugin = require.resolve(pluginpath)
try { try {
if (plugin && require.cache[plugin]) { if (plugin && require.cache[plugin]) {
// `unload()` isn't exported sometimes, require.cache[plugin].exports.unload()
// when plugin isn't properly loaded
require.cache[plugin].exports?.unload?.()
delete plugins[pluginname] delete plugins[pluginname]
delete require.cache[plugin] delete require.cache[plugin]
} }

View File

@ -23,19 +23,6 @@ function initMoves(bot = bot, mcData = bot.mcData) {
movements.push(normalMove) movements.push(normalMove)
movements.defaultMove = movements[0] movements.defaultMove = movements[0]
const aggresiveMove = new Movements(bot, mcData)
//Object.create or assign?
Object.assign(aggresiveMove, normalMove)
aggresiveMove.canDig = true
movements.push(aggresiveMove)
const safeMove = new Movements(bot, mcData)
Object.assign(safeMove, normalMove)
safeMove.allowParkour = false
safeMove.canDig = false
movements.push(safeMove)
// console.info("go init: moves:", movements)
bot.pathfinder.setMovements(normalMove) bot.pathfinder.setMovements(normalMove)
} }
@ -156,7 +143,7 @@ function away(entity = bot.nearestEntity(), invertInvert = true, dynamic = true,
function ride(entity) { function ride(entity) {
entity = entity?.entity || entity entity = entity?.entity || entity
const ridableMobs = ["Horse", "Donkey", "Pig", "Strider", "Mule"] const ridableMobs = ["Horse", "Donkey", "Pig", "Strider"]
const vehicle = entity && typeof entity !== "string" ? entity : bot.nearestEntity(e => { const vehicle = entity && typeof entity !== "string" ? entity : bot.nearestEntity(e => {
if (typeof entity === "string") return e.name === entity if (typeof entity === "string") return e.name === entity
const maybeRidableMob = e.mobType?.split(" ") const maybeRidableMob = e.mobType?.split(" ")
@ -327,7 +314,7 @@ function command(message_parts, player) {
case "up": case "up":
case "u": case "u":
case "j": case "j":
moveOrRide(1, 1, "jump", message_parts2) moveOrRide(1, 1, "left", message_parts2)
break break
case "back": case "back":
case "forward": case "forward":