@hylithiumjs.com/core 1.0.0 → 1.0.2
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.d.ts +25 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -10
- package/dist/types.d.ts +5339 -20
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +17 -2
- package/package.json +28 -14
- package/dist/api.d.ts +0 -7
- package/dist/api.d.ts.map +0 -1
- package/dist/api.js +0 -9
- package/dist/api.js.map +0 -1
- package/dist/decorators.d.ts +0 -2
- package/dist/decorators.d.ts.map +0 -1
- package/dist/decorators.js +0 -13
- package/dist/decorators.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/types/index.d.ts +0 -255
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
export * from "./types";
|
|
2
|
+
import type { EventHandler, EventType } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Array of registered event handlers.
|
|
5
|
+
* HyLithiumJS reads this array to register handlers with the event system.
|
|
6
|
+
*/
|
|
7
|
+
export declare const handlers: EventHandler[];
|
|
8
|
+
/**
|
|
9
|
+
* Decorator to register a method as an event listener.
|
|
10
|
+
*
|
|
11
|
+
* @param eventType - The type of event to listen for
|
|
12
|
+
* @returns A decorator function
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* class MyPlugin {
|
|
17
|
+
* @EventListener("PlayerConnectEvent")
|
|
18
|
+
* onPlayerConnect(event: PlayerConnectEvent) {
|
|
19
|
+
* const player = event.getPlayer();
|
|
20
|
+
* logger.info(`Player ${player.getDisplayName()} connected!`);
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function EventListener(eventType: EventType): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
13
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,YAAY,EAAO,CAAC;AAE3C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,IAC7B,QAAQ,OAAO,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,wBAOxF"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
export * from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Array of registered event handlers.
|
|
4
|
+
* HyLithiumJS reads this array to register handlers with the event system.
|
|
5
|
+
*/
|
|
6
|
+
export const handlers = [];
|
|
7
|
+
/**
|
|
8
|
+
* Decorator to register a method as an event listener.
|
|
9
|
+
*
|
|
10
|
+
* @param eventType - The type of event to listen for
|
|
11
|
+
* @returns A decorator function
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* class MyPlugin {
|
|
16
|
+
* @EventListener("PlayerConnectEvent")
|
|
17
|
+
* onPlayerConnect(event: PlayerConnectEvent) {
|
|
18
|
+
* const player = event.getPlayer();
|
|
19
|
+
* logger.info(`Player ${player.getDisplayName()} connected!`);
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function EventListener(eventType) {
|
|
25
|
+
return function (target, propertyKey, descriptor) {
|
|
26
|
+
handlers.push({
|
|
27
|
+
eventType: eventType,
|
|
28
|
+
callback: descriptor.value
|
|
29
|
+
});
|
|
30
|
+
return descriptor;
|
|
31
|
+
};
|
|
32
|
+
}
|