create-yeow 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -1,16 +1,42 @@
|
|
|
1
|
-
import { Player, registerCommand,
|
|
1
|
+
import { Player, registerCommand, eventOn, broadcast, call } from 'yeow-api';
|
|
2
2
|
|
|
3
|
+
// ── Init (message loop active, no game ops) ─────────
|
|
4
|
+
console.log('[init] Plugin loaded');
|
|
5
|
+
|
|
6
|
+
// ── Load (game ops allowed) ────────────────────────
|
|
7
|
+
function onLoad() {
|
|
8
|
+
console.log('[load] Server is ready, registering commands...');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// ── Commands ────────────────────────────────────────
|
|
3
12
|
registerCommand('hello', {
|
|
4
13
|
description: 'Say hello',
|
|
5
|
-
executor: (p) => p.sender.sendMessage(
|
|
14
|
+
executor: (p) => p.sender.sendMessage(`<green>Hello, ${p.args[0] || 'World'}!</green>`),
|
|
6
15
|
});
|
|
7
16
|
|
|
8
17
|
registerCommand('ping', {
|
|
9
18
|
description: 'Check ping',
|
|
10
19
|
executor: (p) => {
|
|
11
20
|
const player = Player.get(p.sender.uuid);
|
|
12
|
-
if (player) p.sender.sendMessage(
|
|
21
|
+
if (player) p.sender.sendMessage(`<yellow>Ping: ${player.ping}ms | Gamemode: ${player.gamemode}</yellow>`);
|
|
13
22
|
},
|
|
14
23
|
});
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
registerCommand('time', {
|
|
26
|
+
description: 'Show server time',
|
|
27
|
+
executor: (p) => {
|
|
28
|
+
const world = call('world.getTime', { world: 'world' });
|
|
29
|
+
p.sender.sendMessage(`<aqua>World time: ${world}</aqua>`);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// ── Events ──────────────────────────────────────────
|
|
34
|
+
eventOn('playerJoin', (e) => {
|
|
35
|
+
console.log(`Player joined: ${e.player}`);
|
|
36
|
+
broadcast(`<yellow>${e.joinMessage}</yellow>`);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
eventOn('blockBreak', (e) => {
|
|
40
|
+
console.log(`Block break: ${e.block} at ${e.x},${e.y},${e.z}`);
|
|
41
|
+
if (e.block === 'minecraft:bedrock') e.cancelled = true;
|
|
42
|
+
});
|