@yeow/server-api 0.1.0
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/dist/index.cjs +17 -0
- package/dist/index.d.ts +144 -0
- package/dist/index.mjs +13 -0
- package/package.json +23 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
|
|
3
|
+
const api = _yeow;
|
|
4
|
+
|
|
5
|
+
exports.default = api;
|
|
6
|
+
exports.platform = api.platform;
|
|
7
|
+
exports.plugin = api.plugin;
|
|
8
|
+
exports.Location = api.Location;
|
|
9
|
+
exports.log = api.log.bind(api);
|
|
10
|
+
exports.warn = api.warn.bind(api);
|
|
11
|
+
exports.error = api.error.bind(api);
|
|
12
|
+
exports.player = api.player;
|
|
13
|
+
exports.entity = api.entity;
|
|
14
|
+
exports.world = api.world;
|
|
15
|
+
exports.task = api.task;
|
|
16
|
+
exports.command = api.command;
|
|
17
|
+
exports.event = api.event;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Yeow Server API — Type Declarations
|
|
2
|
+
|
|
3
|
+
declare class Location {
|
|
4
|
+
constructor(x: number, y: number, z: number, yaw?: number, pitch?: number, world?: string);
|
|
5
|
+
readonly x: number;
|
|
6
|
+
readonly y: number;
|
|
7
|
+
readonly z: number;
|
|
8
|
+
readonly yaw: number;
|
|
9
|
+
readonly pitch: number;
|
|
10
|
+
readonly world: string | null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare class Entity {
|
|
14
|
+
constructor(uuid: string);
|
|
15
|
+
readonly uuid: string;
|
|
16
|
+
readonly type: any;
|
|
17
|
+
readonly world: World | null;
|
|
18
|
+
readonly location: Location | null;
|
|
19
|
+
remove(): Promise<void>;
|
|
20
|
+
teleport(location: Location): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare class LivingEntity extends Entity {
|
|
24
|
+
health: number;
|
|
25
|
+
readonly maxHealth: number;
|
|
26
|
+
readonly isDead: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class HumanEntity extends LivingEntity {}
|
|
30
|
+
|
|
31
|
+
declare class Player extends HumanEntity {
|
|
32
|
+
readonly name: string;
|
|
33
|
+
displayName: string;
|
|
34
|
+
readonly ping: number;
|
|
35
|
+
gamemode: any;
|
|
36
|
+
foodLevel: number;
|
|
37
|
+
saturation: number;
|
|
38
|
+
readonly isOp: boolean;
|
|
39
|
+
allowFlight: boolean;
|
|
40
|
+
isFlying: boolean;
|
|
41
|
+
walkSpeed: number;
|
|
42
|
+
flySpeed: number;
|
|
43
|
+
sendMessage(message: string): Promise<void>;
|
|
44
|
+
sendTitle(title: string, subtitle?: string, fadeIn?: number, stay?: number, fadeOut?: number): Promise<void>;
|
|
45
|
+
kick(reason?: string): Promise<void>;
|
|
46
|
+
hasPermission(node: string): boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare class Block {
|
|
50
|
+
type: any;
|
|
51
|
+
readonly location: Location;
|
|
52
|
+
readonly isSolid: boolean;
|
|
53
|
+
readonly isLiquid: boolean;
|
|
54
|
+
readonly world: World;
|
|
55
|
+
isEmpty(): boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare class World {
|
|
59
|
+
constructor(name: string);
|
|
60
|
+
readonly name: string;
|
|
61
|
+
time: number;
|
|
62
|
+
storm: boolean;
|
|
63
|
+
thundering: boolean;
|
|
64
|
+
getBlock(x: number, y: number, z: number): Block | null;
|
|
65
|
+
setBlock(x: number, y: number, z: number, blockType: string, options?: any): Promise<void>;
|
|
66
|
+
getEntity(uuid: string): Entity | null;
|
|
67
|
+
getEntities(): Entity[];
|
|
68
|
+
getPlayers(): Player[];
|
|
69
|
+
dropItem(location: Location, itemType: string, amount?: number): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface CommandParams {
|
|
73
|
+
sender: Player | string;
|
|
74
|
+
args: string[];
|
|
75
|
+
command: string;
|
|
76
|
+
label: string;
|
|
77
|
+
[key: string]: any;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface CommandOptions {
|
|
81
|
+
executor: (params: CommandParams) => void;
|
|
82
|
+
tabComplete?: (params: any) => string[];
|
|
83
|
+
description?: string;
|
|
84
|
+
usage?: string;
|
|
85
|
+
permission?: string;
|
|
86
|
+
aliases?: string[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface CommandAPI {
|
|
90
|
+
register(commandName: string, executor: (params: CommandParams) => void): Promise<boolean>;
|
|
91
|
+
register(commandName: string, options: CommandOptions): Promise<boolean>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface TaskAPI {
|
|
95
|
+
call(taskType: string, params?: Record<string, any>): Promise<any>;
|
|
96
|
+
post(taskType: string, params?: Record<string, any>, options?: { priority?: string; label?: string }): Promise<any>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
interface EventAPI {
|
|
100
|
+
on(eventType: string, handler: (event: any) => void | { cancelled?: boolean }): void;
|
|
101
|
+
once(eventType: string, handler: (event: any) => void): void;
|
|
102
|
+
off(eventType: string, handler: (event: any) => void): void;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface YeowAPI {
|
|
106
|
+
readonly platform: any;
|
|
107
|
+
readonly plugin: any;
|
|
108
|
+
readonly Location: typeof Location;
|
|
109
|
+
log(msg: string): void;
|
|
110
|
+
warn(msg: string): void;
|
|
111
|
+
error(msg: string): void;
|
|
112
|
+
readonly player: {
|
|
113
|
+
get(identifier: string | { _uuid: string }): Player | null;
|
|
114
|
+
getAll(): Player[];
|
|
115
|
+
getExact(name: string): Player | null;
|
|
116
|
+
};
|
|
117
|
+
readonly entity: {
|
|
118
|
+
get(uuid: string | { _uuid: string }): Entity | null;
|
|
119
|
+
};
|
|
120
|
+
readonly world: {
|
|
121
|
+
get(name: string): World | null;
|
|
122
|
+
getAll(): World[];
|
|
123
|
+
};
|
|
124
|
+
readonly task: TaskAPI;
|
|
125
|
+
readonly command: CommandAPI;
|
|
126
|
+
readonly event: EventAPI;
|
|
127
|
+
__ping(options?: any): Promise<any>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare const _yeow: YeowAPI;
|
|
131
|
+
export default _yeow;
|
|
132
|
+
|
|
133
|
+
export const platform: any;
|
|
134
|
+
export const plugin: any;
|
|
135
|
+
export const Location: typeof Location;
|
|
136
|
+
export const log: (msg: string) => void;
|
|
137
|
+
export const warn: (msg: string) => void;
|
|
138
|
+
export const error: (msg: string) => void;
|
|
139
|
+
export const player: YeowAPI['player'];
|
|
140
|
+
export const entity: YeowAPI['entity'];
|
|
141
|
+
export const world: YeowAPI['world'];
|
|
142
|
+
export const task: TaskAPI;
|
|
143
|
+
export const command: CommandAPI;
|
|
144
|
+
export const event: EventAPI;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default _yeow;
|
|
2
|
+
export const platform = _yeow.platform;
|
|
3
|
+
export const plugin = _yeow.plugin;
|
|
4
|
+
export const Location = _yeow.Location;
|
|
5
|
+
export const log = _yeow.log.bind(_yeow);
|
|
6
|
+
export const warn = _yeow.warn.bind(_yeow);
|
|
7
|
+
export const error = _yeow.error.bind(_yeow);
|
|
8
|
+
export const player = _yeow.player;
|
|
9
|
+
export const entity = _yeow.entity;
|
|
10
|
+
export const world = _yeow.world;
|
|
11
|
+
export const task = _yeow.task;
|
|
12
|
+
export const command = _yeow.command;
|
|
13
|
+
export const event = _yeow.event;
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yeow/server-api",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript types and runtime bridge for Yeow Minecraft plugin API",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.cjs",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./*": "./dist/*"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "node build.js"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|