yeow-api 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/package.json +3 -2
  2. package/src/command.ts +23 -6
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "yeow-api",
3
- "version": "0.1.0",
4
- "description": "Yeow API TypeScript OOP wrappers over the task protocol",
3
+ "version": "0.1.1",
4
+ "description": "Yeow API �?TypeScript OOP wrappers over the task protocol",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
7
7
  "types": "./src/index.ts",
8
8
  "files": ["src/"],
9
9
  "license": "MIT"
10
10
  }
11
+
package/src/command.ts CHANGED
@@ -1,5 +1,28 @@
1
1
  import { call } from './task.js';
2
2
 
3
+ export interface CommandSender {
4
+ /** Sender display name. */
5
+ readonly name: string;
6
+ /** Player UUID, or "CONSOLE" for console senders. */
7
+ readonly uuid: string;
8
+ /** Whether this sender is a player. */
9
+ readonly isPlayer: boolean;
10
+ /**
11
+ * Send a message back to the sender. Injected by the API at callback time.
12
+ * MiniMessage format is supported.
13
+ */
14
+ sendMessage(msg: string): void;
15
+ }
16
+
17
+ export interface CommandPayload {
18
+ /** The command sender. Use `Player.get(sender.uuid)` to access full Player properties. */
19
+ readonly sender: CommandSender;
20
+ /** Space-delimited command arguments. */
21
+ readonly args: string[];
22
+ /** The alias used to invoke the command. */
23
+ readonly label: string;
24
+ }
25
+
3
26
  export interface CommandOptions {
4
27
  description?: string;
5
28
  usage?: string;
@@ -8,12 +31,6 @@ export interface CommandOptions {
8
31
  executor: (payload: CommandPayload) => void;
9
32
  }
10
33
 
11
- export interface CommandPayload {
12
- sender: { name: string; uuid: string; isPlayer: boolean };
13
- args: string[];
14
- label: string;
15
- }
16
-
17
34
  export function registerCommand(name: string, options: CommandOptions): boolean {
18
35
  const executor = options.executor;
19
36
  const pluginName = (globalThis as any).__plugin?.name || 'unknown';