Add Formatting (Thank God)
This commit is contained in:
@@ -11,7 +11,7 @@ export class Command {
|
||||
}
|
||||
constructor(argv: string[], player: Player) {
|
||||
this.argv = (function* () {
|
||||
for (let arg of argv) yield arg;
|
||||
for (const arg of argv) yield arg;
|
||||
})();
|
||||
this.__player = player;
|
||||
}
|
||||
@@ -83,13 +83,13 @@ export class Commands {
|
||||
public static register(prefix: string, command: string, commandFunction: (arg: Command) => void): void {
|
||||
if (prefix.startsWith("/")) throw Error("Unable to register slash commands.");
|
||||
world.beforeEvents.chatSend.subscribe((arg) => {
|
||||
var argv = arg.message.split(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g).filter((e) => e.trim().length > 0);
|
||||
const argv = arg.message.split(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g).filter((e) => e.trim().length > 0);
|
||||
if (argv[0] === `${prefix}${command}`) {
|
||||
arg.cancel = true;
|
||||
try {
|
||||
commandFunction(new Command(argv, arg.sender));
|
||||
} catch (err) {
|
||||
let { statusMessage } = JSON.parse(err as string);
|
||||
const { statusMessage } = JSON.parse(err as string);
|
||||
console.error(err);
|
||||
arg.sender.sendMessage(`§c${statusMessage}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user