Skip to content

Commit

Permalink
Use waitShowModalForm
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlaubb committed Mar 9, 2025
1 parent 2cc353e commit eb00a41
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Matrix_BP/functions/matrix/help.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tellraw @s {"rawtext":[{"translate":"function.help","with":["CqZGXeRKPJ", "V6.0.34"]},{"text":"\n§7>> §c(Not translated) If you cannot see any messages, install the RESOURCE PACK correctly, Matrix anticheat required RP to show you the translated message.\n"},{"translate":"function.help.typeA","with":[]},{"text":"\n"},{"translate":"function.help.typeB","with":[]}]}
tellraw @s {"rawtext":[{"translate":"function.help","with":["CqZGXeRKPJ", "V6.0.35"]},{"text":"\n§7>> §c(Not translated) If you cannot see any messages, install the RESOURCE PACK correctly, Matrix anticheat required RP to show you the translated message.\n"},{"translate":"function.help.typeA","with":[]},{"text":"\n"},{"translate":"function.help.typeB","with":[]}]}
scoreboard objectives add matrix:zero_mark dummy
scoreboard players set is_enabled matrix:zero_mark -1
execute if score is_enabled matrix:script-online = is_enabled matrix:zero_mark run tellraw @s {"rawtext":[{"translate":"function.script.online"}]}
Expand Down
6 changes: 3 additions & 3 deletions Matrix_BP/manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"format_version": 2,
"header": {
"name": "§bMatrix§a+ §gAnti-Cheat §7(BP§7) V6.0.34§r",
"name": "§bMatrix§a+ §gAnti-Cheat §7(BP§7) V6.0.35§r",
"description": "pack.description",
"uuid": "22cc8811-023a-42dc-9f1b-45065f9d33b2",
"version": [6, 0, 34],
"version": [6, 0, 35],
"min_engine_version": [1, 21, 60]
},
"metadata": {
Expand All @@ -29,7 +29,7 @@
"dependencies": [
{
"uuid": "44408a4d-808d-4c6a-bd46-77dd6c3f5fbb",
"version": [6, 0, 34]
"version": [6, 0, 35]
},
{
"module_name": "@minecraft/server",
Expand Down
2 changes: 1 addition & 1 deletion Matrix_BP/src/matrixAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class IntegratedSystemEvent {
* @warn You are not allowed to copy or modify this system unless you have declared yours as a fork from us.
*/
class Module {
public static readonly version: [number, number, number] = [6, 0, 34];
public static readonly version: [number, number, number] = [6, 0, 35];
public static readonly discordInviteLink = "CqZGXeRKPJ";
// Map that store almost everything. (Temporary)
public static readonly tickData = new Map<string, TickData>();
Expand Down
33 changes: 15 additions & 18 deletions Matrix_BP/src/program/command/mset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { system } from "@minecraft/server";
import { Command, Config } from "../../matrixAPI";
import { fastText, rawtextTranslate } from "../../util/rawtext";
import { ModalFormData } from "@minecraft/server-ui";
import { waitShowModalForm } from "../../util/util";
const MATCH_REG = /#[(a-zA-Z)|/]+\,[^#,]+#/g
const TEST_REG = /^(#[(a-zA-Z)|/]+\,[^#,]+#)+$/
new Command()
Expand All @@ -10,26 +11,22 @@ new Command()
.setMinPermissionLevel(3)
.setAliases("multiset", "fastset", "fset", "import")
.onExecute(async (player) => {
new ModalFormData()
const data = await waitShowModalForm(new ModalFormData()
.title(rawtextTranslate("command.mset.title"))
.textField(rawtextTranslate("command.mset.input"), "<key here>")
.submitButton("Press to input")
//@ts-expect-error
.show(player)
.then((data) => {
if (data.canceled) return;
const key = data.formValues![0] as string;
const match = key.match(MATCH_REG);
if (match === null || TEST_REG.test(key) === false) {
player.sendMessage(fastText().addText("§bMatrix§a+ §7> §c").addTran("command.mset.error").build());
return;
}
match.forEach((value) => {
const [key, ...nv] = value.slice(1, -1).split(",");
player.runChatCommand(`set ${key} "${nv.join(",")}"`)
});
player.sendMessage(rawtextTranslate("command.mset.success", match.length.toString()));
})
.submitButton("Press to input"), player);
if (data === null ||data.canceled) return;
const key = data.formValues![0] as string;
const match = key.match(MATCH_REG);
if (match === null || TEST_REG.test(key) === false) {
player.sendMessage(fastText().addText("§bMatrix§a+ §7> §c").addTran("command.mset.error").build());
return;
}
match.forEach((value) => {
const [key, ...nv] = value.slice(1, -1).split(",");
player.runChatCommand(`set ${key} "${nv.join(",")}"`)
});
player.sendMessage(rawtextTranslate("command.mset.success", match.length.toString()));
})
.register();
new Command()
Expand Down
4 changes: 2 additions & 2 deletions Matrix_RP/manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"format_version": 2,
"header": {
"name": "§bMatrix§a+ §gAnti-Cheat §7(RP§7) V6.0.34§r",
"name": "§bMatrix§a+ §gAnti-Cheat §7(RP§7) V6.0.35§r",
"description": "pack.description",
"uuid": "44408a4d-808d-4c6a-bd46-77dd6c3f5fbb",
"version": [6, 0, 34],
"version": [6, 0, 35],
"min_engine_version": [1, 21, 60]
},
"modules": [
Expand Down

0 comments on commit eb00a41

Please sign in to comment.