Skip to content

Commit 49375c0

Browse files
authored
Merge pull request #1048 from SjnExe/fix-commands-and-ui-14846249216144152681
Fix slash commands, chat commands, and server_form UI errors
2 parents b7b3aea + ee7c507 commit 49375c0

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

packs/resource/ui/server_form.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
"namespace": "server_form",
33
"long_form": {
44
"type": "panel",
5+
"bindings": [
6+
{ "binding_name": "#title_text" },
7+
{ "binding_name": "#content_text" },
8+
{ "binding_name": "#form_button_length" }
9+
],
510
"controls": [
611
{
712
"client_content": {
@@ -19,8 +24,7 @@
1924
"controls": [
2025
{
2126
"grid_view": {
22-
"type": "custom",
23-
"renderer": "ui_scene_renderer",
27+
"type": "panel",
2428
"layer": 1,
2529
"anchor_from": "center",
2630
"anchor_to": "center",
@@ -29,7 +33,7 @@
2933
}
3034
}
3135
],
32-
"visible": "(($title_text - '§t§t§t') = 'Tic Tac Toe')"
36+
"visible": "($title_text = '§t§t§tTic Tac Toe')"
3337
}
3438
},
3539
{
@@ -99,7 +103,7 @@
99103
}
100104
}
101105
],
102-
"visible": "(not (($title_text - '§t§t§t') = 'Tic Tac Toe'))"
106+
"visible": "(not ($title_text = '§t§t§tTic Tac Toe'))"
103107
}
104108
}
105109
]

src/core/__tests__/UI.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ jest.unstable_mockModule('../configManager.js', () => ({
1515
updateMultipleConfig: jest.fn(),
1616
resetConfigSection: jest.fn(),
1717
onConfigUpdated: jest.fn(),
18-
initializeConfigManager: jest.fn()
18+
initializeConfigManager: jest.fn(),
19+
reloadConfig: jest.fn()
1920
}));
2021

2122
// Mock feature managers if needed by panels

src/core/events/beforeChatSend.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as mc from '@minecraft/server';
22

3+
import { commandManager } from '@core/commands/commandManager.js';
34
import { getConfig } from '@core/configManager.js';
45
import { getPlayerFromCache } from '@core/playerCache.js';
56
import { getPlayer } from '@core/playerDataManager.js';
@@ -9,6 +10,8 @@ import { getPlayer } from '@core/playerDataManager.js';
910
* Manages chat formatting, muting, and ranks.
1011
*/
1112
export default function handleBeforeChatSend(event: mc.ChatSendBeforeEvent) {
13+
if (commandManager.handleChatCommand(event)) return;
14+
1215
const config = getConfig();
1316
if (config.chat.enabled !== true) return; // Vanilla chat if disabled
1417

src/core/main.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as mc from '@minecraft/server';
22

3+
import { loadCommands } from '@core/commands/index.js';
34
import { initializeXrayDetection } from '@features/anticheat/xrayDetection.js';
45
import { restartAnnouncer } from '@features/essentials/commands/announcement.js';
56
import { cleanupSpawnProtection, initializeSpawnProtection } from '@features/essentials/spawnProtection.js';
@@ -33,6 +34,9 @@ import { reinitializeOnlinePlayers } from './utils.js';
3334

3435
const VERSION = '0.7.0'; // Current Addon Version
3536

37+
// Load Commands immediately to register slash commands during startup
38+
loadCommands();
39+
3640
/**
3741
* Initializes the addon.
3842
* This function should be called once at startup.

0 commit comments

Comments
 (0)