Skip to content

Commit d6325fa

Browse files
committed
added script displays full /help text
1 parent 57b19dd commit d6325fa

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

scripts/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@
1616

1717
### [Timers Module](./timers)
1818

19-
### [mojang-net-auth](./mojang-net-auth/)
19+
### [mojang-net-auth](./mojang-net-auth/)
20+
21+
### [Command Handler](./commandHandler.js)
22+
23+
### [Compass Prompt](./compass-prompt.js)
24+
25+
### [/help](./help_command.js)

scripts/help_command.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { world } from "mojang-minecraft";
2+
3+
export default function () {
4+
let response = "";
5+
let prev = "";
6+
for (let index = 1; index <= 26; index++) {
7+
let help = world.getDimension("overworld").runCommand(`help ${index}`);
8+
let messages = help.statusMessage.split("\n").filter(msg => msg.startsWith("/"));
9+
10+
for (const iterator of messages) {
11+
const command = iterator.split(" ")[0].replace('/', '');
12+
if (command === prev) continue;
13+
let message = world.getDimension("overworld").runCommand("help " + command).statusMessage;
14+
response += message + "\n\n";
15+
prev = command;
16+
}
17+
};
18+
19+
console.warn(response.replace(/§[abcdefgkl0123456789]/g, ''));
20+
return response;
21+
};

0 commit comments

Comments
 (0)