@pma-network/shared-server 0.0.11 → 0.0.13
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.
|
@@ -19,6 +19,7 @@ export declare class CommonPMAPlayer extends Player implements CommonAbstractPMA
|
|
|
19
19
|
constructor(source: number);
|
|
20
20
|
constructor(pma_player: CommonAbstractPMAPlayer);
|
|
21
21
|
ensure_init(): void;
|
|
22
|
+
is_player_valid(): boolean;
|
|
22
23
|
send_notification(title?: string, description?: string, variant?: CommonNotificationVariant, duration?: number): void;
|
|
23
24
|
send_notification_object(partial: CommonPMAPartialNotification): void;
|
|
24
25
|
get_sex(): number;
|
package/class/CommonPMAPlayer.js
CHANGED
|
@@ -10,7 +10,7 @@ class CommonPMAPlayer extends Player {
|
|
|
10
10
|
// This will get lazy-initialized whenever we actually call a function that needs it,
|
|
11
11
|
// this will make sure we don't pay the un-needed serialize cost if we're only using this for
|
|
12
12
|
// basic nativewrappers types
|
|
13
|
-
#pma_player;
|
|
13
|
+
#pma_player = null;
|
|
14
14
|
/**
|
|
15
15
|
* Creates the player from the ScRT msgpack'd class
|
|
16
16
|
*/
|
|
@@ -50,6 +50,14 @@ class CommonPMAPlayer extends Player {
|
|
|
50
50
|
) : pma_get_player_from_id(this.Source);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
/*
|
|
54
|
+
* This will initialize the player and check that the player exists
|
|
55
|
+
* @returns `true` if the player is loaded in the framework or `false` otherwise
|
|
56
|
+
*/
|
|
57
|
+
is_player_valid() {
|
|
58
|
+
this.ensure_init();
|
|
59
|
+
return this.#pma_player !== null;
|
|
60
|
+
}
|
|
53
61
|
send_notification(title, description, variant = "default", duration = 5e3) {
|
|
54
62
|
const noti = {
|
|
55
63
|
body: description,
|