From e6d29576e7b50642b5d8c2e33385c4cfa2436c04 Mon Sep 17 00:00:00 2001 From: jay Date: Tue, 26 Jan 2021 22:49:23 +0500 Subject: [PATCH] refactor(command): :truck: move vehicle commands near other moves Move the following: - vehicle commands next to other movement related commands like `go`. - move `ride` / `mount` command functionality into mover plugin --- lib/plugins/command.js | 22 ++++++++++------------ lib/plugins/mover.js | 4 ++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/plugins/command.js b/lib/plugins/command.js index bfaba92..39f07ff 100644 --- a/lib/plugins/command.js +++ b/lib/plugins/command.js @@ -217,6 +217,16 @@ function command(username, message) { subcommand("go follow once") } break; + case "ride": + case "mount": + cfg.plugins.mover.command(message_parts) + break + case "unride": + case "getoff": + case "unmount": + case "dismount": + bot.dismount() + break case "move": case "go": cfg.plugins.mover.command(message_parts.slice(1), player) @@ -318,18 +328,6 @@ function command(username, message) { case "info": cfg.plugins.informer.command(message_parts.splice(1)) break - case "ride": - case "mount": - bot.mount(bot.nearestEntity()) - break - case "getoff": - case "unmount": - case "dismount": - bot.dismount() - break - case "go": - bot.moveVehicle(0, 10) - break // case "use": // bot.useOn(bot.nearestEntity()) // break; diff --git a/lib/plugins/mover.js b/lib/plugins/mover.js index 2e88ba6..da91063 100644 --- a/lib/plugins/mover.js +++ b/lib/plugins/mover.js @@ -194,6 +194,10 @@ function command(message_parts, player) { break } break + case "ride": + case "mount": + bot.mount(bot.nearestEntity()) + break case "w": case "f": command(["forward"].concat(message_parts.slice(1)))