@pma-network/redm-server 0.0.6 → 0.0.8

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/PMA.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { ItemData, ItemName } from "@common-types/Inventory";
2
- import type { PlayerUID } from "@common-types/PMAPlayer";
3
- import { PMAPlayerWrapper } from "./class/PMAPlayerWrapper";
1
+ import type { ItemData, ItemName } from "@redm-types/Inventory";
2
+ import type { PlayerUID } from "@redm-types/PMAPlayer";
3
+ import { PMAPlayer } from "./class/PMAPlayer";
4
4
  import type { UsableItemCall } from "./types/Inventory";
5
5
  /**
6
6
  * A static class that's used for invoking framework types
@@ -22,16 +22,16 @@ export declare class PMA {
22
22
  * isn't initialized, this won't break anything though.
23
23
  * @returns the PMAPlayer wrapper, or `null` if the player doesn't exist
24
24
  */
25
- static from_source(source: number): PMAPlayerWrapper | null;
25
+ static from_source(source: number): PMAPlayer | null;
26
26
  /**
27
27
  * Gets the player from the specified UID
28
28
  * @returns the PMAPlayer wrapper, or `null` if there wasn't a player
29
29
  */
30
- static from_uid(uid: PlayerUID): PMAPlayerWrapper | null;
30
+ static from_uid(uid: PlayerUID): PMAPlayer | null;
31
31
  /**
32
32
  * Gets all of the players that habe the specified job(s), and the specified {@param job_rank} if specified.
33
33
  */
34
- static get_players_with_job(job_names: string | string[], job_rank?: number): PMAPlayerWrapper[];
34
+ static get_players_with_job(job_names: string | string[], job_rank?: number): PMAPlayer[];
35
35
  /**
36
36
  * Generic logging
37
37
  * TODO: Setup a clickhouse wrapper
package/PMA.js CHANGED
@@ -1,7 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { Ped, randomInt } from "@nativewrappers/server";
4
- import { PMAPlayerWrapper } from "./class/PMAPlayerWrapper";
3
+ import { PMAPlayer } from "./class/PMAPlayer";
5
4
  class PMA {
6
5
  static {
7
6
  __name(this, "PMA");
@@ -18,7 +17,7 @@ class PMA {
18
17
  */
19
18
  static register_usable_item(item_name, fn) {
20
19
  const usable_item_wrapper = /* @__PURE__ */ __name((abstract_ply, inventory, item) => {
21
- const ply = PMAPlayerWrapper.from_raw(abstract_ply);
20
+ const ply = PMAPlayer.from_raw(abstract_ply);
22
21
  fn(ply, inventory, item);
23
22
  }, "usable_item_wrapper");
24
23
  exports["pma"].register_usable_item(item_name, usable_item_wrapper);
@@ -31,7 +30,7 @@ class PMA {
31
30
  * @returns the PMAPlayer wrapper, or `null` if the player doesn't exist
32
31
  */
33
32
  static from_source(source) {
34
- return PMAPlayerWrapper.from_source(source);
33
+ return PMAPlayer.from_source(source);
35
34
  }
36
35
  /**
37
36
  * Gets the player from the specified UID
@@ -39,14 +38,14 @@ class PMA {
39
38
  */
40
39
  static from_uid(uid) {
41
40
  const data = exports["pma"].from_uid(uid);
42
- return data ? PMAPlayerWrapper.from_raw(data) : null;
41
+ return data ? PMAPlayer.from_raw(data) : null;
43
42
  }
44
43
  /**
45
44
  * Gets all of the players that habe the specified job(s), and the specified {@param job_rank} if specified.
46
45
  */
47
46
  static get_players_with_job(job_names, job_rank) {
48
47
  const players = exports["pma"].get_players_with_job(job_names, job_rank);
49
- return players.map((v) => PMAPlayerWrapper.from_raw(v));
48
+ return players.map((v) => PMAPlayer.from_raw(v));
50
49
  }
51
50
  /**
52
51
  * Generic logging
@@ -1,37 +1,22 @@
1
- import type { ItemName, OptionalItem } from "@common-types/Inventory";
2
- import type { NotificationVariant, PMAPartialNotification } from "@common-types/Notifications";
3
- import type { AbstractPMAPlayer, CallSign, PlayerJob, PlayerUID } from "@common-types/PMAPlayer";
4
- import { Player } from "@nativewrappers/server";
5
- export declare class PMAPlayerWrapper extends Player implements AbstractPMAPlayer {
1
+ import type { ItemName, OptionalItem } from "@redm-types/Inventory";
2
+ import { CommonPMAPlayer } from "@shared-server/class/CommonPMAPlayer";
3
+ import type { CommonAbstractPMAPlayer } from "@shared-server/types/CommonAbstractPMAPlayer";
4
+ export declare class PMAPlayer extends CommonPMAPlayer {
6
5
  #private;
7
6
  /**
8
7
  * Creates the player from the ScRT msgpack'd class
9
8
  */
10
- static from_raw(ply: AbstractPMAPlayer): PMAPlayerWrapper;
9
+ static from_raw(ply: CommonAbstractPMAPlayer): PMAPlayer;
11
10
  /**
12
11
  * Does basic checks that the player exists before lazy initializing the player
13
12
  */
14
- static from_source(source: number): PMAPlayerWrapper | null;
13
+ static from_source(source: number): PMAPlayer | null;
14
+ /**
15
+ * Creates the player from the source without doing any validity checks
16
+ */
17
+ static from_source_unchecked(source: number): CommonPMAPlayer;
15
18
  constructor(source: number);
16
- constructor(pma_player: AbstractPMAPlayer);
17
- ensure_init(): void;
18
- send_notification(title?: string, description?: string, variant?: NotificationVariant): void;
19
- send_notification_object(partial: PMAPartialNotification): void;
20
- get_sex(): number;
21
- get_height(): number;
22
- get_dob(): string;
23
- get_unique_id(): PlayerUID;
24
- get_call_sign(): CallSign;
25
- get_character_name(): string;
26
- get_log_name(): string;
19
+ constructor(pma_player: CommonAbstractPMAPlayer);
27
20
  get_item(item_name: ItemName): OptionalItem;
28
21
  add_item(item_name: ItemName, quantity: number): OptionalItem;
29
- remove_item(item_name: ItemName, quantity: number): void;
30
- has_enough_of_item(item_name: ItemName, quantity: number): boolean;
31
- get_job(): PlayerJob;
32
- set_job(job_name: string, rank: number): void;
33
- get_bank(): number;
34
- add_to_bank(positive_amount: number): void;
35
- remove_from_bank(negative_amount: number): void;
36
- save(): Promise<void>;
37
22
  }
@@ -1,9 +1,9 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { Player } from "@nativewrappers/server";
4
- class PMAPlayerWrapper extends Player {
3
+ import { CommonPMAPlayer } from "@shared-server/class/CommonPMAPlayer";
4
+ class PMAPlayer extends CommonPMAPlayer {
5
5
  static {
6
- __name(this, "PMAPlayerWrapper");
6
+ __name(this, "PMAPlayer");
7
7
  }
8
8
  // This will get lazy-initialized whenever we actually call a function that needs it,
9
9
  // this will make sure we don't pay the un-needed serialize cost if we're only using this for
@@ -13,7 +13,7 @@ class PMAPlayerWrapper extends Player {
13
13
  * Creates the player from the ScRT msgpack'd class
14
14
  */
15
15
  static from_raw(ply) {
16
- return new PMAPlayerWrapper(ply);
16
+ return new PMAPlayer(ply);
17
17
  }
18
18
  /**
19
19
  * Does basic checks that the player exists before lazy initializing the player
@@ -22,7 +22,13 @@ class PMAPlayerWrapper extends Player {
22
22
  if (!DoesPlayerExist(source)) {
23
23
  return null;
24
24
  }
25
- return new PMAPlayerWrapper(source);
25
+ return new PMAPlayer(source);
26
+ }
27
+ /**
28
+ * Creates the player from the source without doing any validity checks
29
+ */
30
+ static from_source_unchecked(source) {
31
+ return new CommonPMAPlayer(source);
26
32
  }
27
33
  constructor(source) {
28
34
  if (typeof source !== "number") {
@@ -33,51 +39,6 @@ class PMAPlayerWrapper extends Player {
33
39
  super(source);
34
40
  }
35
41
  }
36
- // Ensure we initialize the player whenever we're doing something that needs it.
37
- ensure_init() {
38
- if (!this.#pma_player) {
39
- this.#pma_player = exports["pma"].from_source(this.Source);
40
- }
41
- }
42
- send_notification(title, description, variant = "default") {
43
- const noti = {
44
- title,
45
- body: description,
46
- variant
47
- };
48
- this.emit("pma:add_notifications", noti);
49
- }
50
- send_notification_object(partial) {
51
- this.emit("pma:add_notification", partial);
52
- }
53
- get_sex() {
54
- this.ensure_init();
55
- return this.#pma_player.get_sex();
56
- }
57
- get_height() {
58
- this.ensure_init();
59
- return this.#pma_player.get_height();
60
- }
61
- get_dob() {
62
- this.ensure_init();
63
- return this.#pma_player.get_dob();
64
- }
65
- get_unique_id() {
66
- this.ensure_init();
67
- return this.#pma_player.get_unique_id();
68
- }
69
- get_call_sign() {
70
- this.ensure_init();
71
- return this.#pma_player.get_call_sign();
72
- }
73
- get_character_name() {
74
- this.ensure_init();
75
- return this.#pma_player.get_character_name();
76
- }
77
- get_log_name() {
78
- this.ensure_init();
79
- return this.#pma_player.get_character_name();
80
- }
81
42
  get_item(item_name) {
82
43
  this.ensure_init();
83
44
  return this.#pma_player.get_item(item_name);
@@ -86,39 +47,7 @@ class PMAPlayerWrapper extends Player {
86
47
  this.ensure_init();
87
48
  return this.#pma_player.add_item(item_name, quantity);
88
49
  }
89
- remove_item(item_name, quantity) {
90
- this.ensure_init();
91
- return this.#pma_player.remove_item(item_name, quantity);
92
- }
93
- has_enough_of_item(item_name, quantity) {
94
- this.ensure_init();
95
- return this.#pma_player.has_enough_of_item(item_name, quantity);
96
- }
97
- get_job() {
98
- this.ensure_init();
99
- return this.#pma_player.get_job();
100
- }
101
- set_job(job_name, rank) {
102
- this.ensure_init();
103
- return this.#pma_player.set_job(job_name, rank);
104
- }
105
- get_bank() {
106
- this.ensure_init();
107
- return this.#pma_player.get_bank();
108
- }
109
- add_to_bank(positive_amount) {
110
- this.ensure_init();
111
- return this.#pma_player.add_to_bank(positive_amount);
112
- }
113
- remove_from_bank(negative_amount) {
114
- this.ensure_init();
115
- return this.#pma_player.remove_from_bank(negative_amount);
116
- }
117
- save() {
118
- this.ensure_init();
119
- return this.#pma_player.save();
120
- }
121
50
  }
122
51
  export {
123
- PMAPlayerWrapper
52
+ PMAPlayer
124
53
  };
@@ -0,0 +1,10 @@
1
+ import { PMAPlayer } from "../class/PMAPlayer";
2
+ type PMAServerEventType = (player: PMAPlayer, ...args: any[]) => Promise<void> | void;
3
+ /**
4
+ * Registers the Net Event call for {@link eventName} to this method
5
+ *
6
+ * @param eventName the event to bind this net event to
7
+ * @param remoteOnly if the event should only accept remote calls, if set to true it will ignore any local call via `emit`, defaults to true
8
+ */
9
+ export declare function OnPMANetEvent(eventName: string): (originalMethod: PMAServerEventType, context: ClassMethodDecoratorContext) => void;
10
+ export {};
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { PMAPlayerWrapper } from "../class/PMAPlayer";
4
- function PMAServerEvent(eventName) {
3
+ import { PMAPlayer } from "../class/PMAPlayer";
4
+ function OnPMANetEvent(eventName) {
5
5
  return /* @__PURE__ */ __name(function actualDecorator(originalMethod, context) {
6
6
  if (context.private) {
7
7
  throw new Error("NetEvent does not work on private methods, please mark the method as public");
@@ -9,7 +9,7 @@ function PMAServerEvent(eventName) {
9
9
  context.addInitializer(function() {
10
10
  const _t = this;
11
11
  onNet(eventName, async (...args) => {
12
- const ply = new PMAPlayerWrapper(source);
12
+ const ply = new PMAPlayer(source);
13
13
  if (_t.__permissionMap) {
14
14
  const permissions = _t.__permissionMap.get(context.name);
15
15
  if (permissions) {
@@ -40,7 +40,7 @@ function PMAServerEvent(eventName) {
40
40
  });
41
41
  }, "actualDecorator");
42
42
  }
43
- __name(PMAServerEvent, "PMAServerEvent");
43
+ __name(OnPMANetEvent, "OnPMANetEvent");
44
44
  export {
45
- PMAServerEvent
45
+ OnPMANetEvent
46
46
  };
@@ -1,9 +1,10 @@
1
- import type { ItemName } from "@common-types/Inventory";
2
1
  import type { UsableItemCall } from "../types/Inventory";
2
+ import type { ItemName } from "@redm-types/Inventory";
3
3
  /**
4
- * Registers the Net Event call for {@link eventName} to this method
4
+ * Registers the {@link item_name} to be usable
5
5
  *
6
- * @param eventName the event to bind this net event to
7
- * @param remoteOnly if the event should only accept remote calls, if set to true it will ignore any local call via `emit`, defaults to true
6
+ * NOTE: On RedM the item needs to have its usable flag for this to work.
7
+ *
8
+ * @param item_name The item to make usable
8
9
  */
9
10
  export declare function RegisterUsableItem(item_name: ItemName): (originalMethod: UsableItemCall, context: ClassMethodDecoratorContext) => void;
@@ -1,11 +1,10 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { PMA } from "../PMA";
4
- import { PMAPlayerWrapper } from "../class/PMAPlayer";
5
4
  function RegisterUsableItem(item_name) {
6
5
  return /* @__PURE__ */ __name(function actualDecorator(originalMethod, context) {
7
6
  if (context.private) {
8
- throw new Error("NetEvent does not work on private methods, please mark the method as public");
7
+ throw new Error("RegisterUsableItem does not work on private methods, please mark the method as public");
9
8
  }
10
9
  context.addInitializer(function() {
11
10
  const t = this;
package/index.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  export * from "./PMA";
2
2
  export * from "./types/Inventory";
3
- export * from "./decors/PMANetServerEvent";
4
- export * from "./decors/PMAServerEvent";
3
+ export * from "./decors/PMANetEvent";
5
4
  export * from "./decors/RegisterUsableItems";
6
- export * from "./class/PMAPlayer";
7
- export * from "./class/PMAPlayerWrapper";
5
+ export * from "./class/PMAPlayer";
package/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  export * from "./PMA";
2
2
  export * from "./types/Inventory";
3
- export * from "./decors/PMANetServerEvent";
4
- export * from "./decors/PMAServerEvent";
3
+ export * from "./decors/PMANetEvent";
5
4
  export * from "./decors/RegisterUsableItems";
6
- export * from "./class/PMAPlayer";
7
- export * from "./class/PMAPlayerWrapper";
5
+ export * from "./class/PMAPlayer";
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Dillon Skaggs <AvarianKnight>"
6
6
  ],
7
7
  "type": "module",
8
- "version": "0.0.6",
8
+ "version": "0.0.8",
9
9
  "files": [
10
10
  "./**/*.js",
11
11
  "./**/*.d.ts"
@@ -1,7 +1,7 @@
1
- import type { BaseInventory, InventoryItem } from "@common-types/Inventory";
2
- import type { AbstractPMAPlayer } from "@common-types/PMAPlayer";
3
- import type { PMAPlayerWrapper } from "../class/PMAPlayerWrapper";
4
- export type UsableItemCall = (ply: PMAPlayerWrapper, inventory: BaseInventory, item: InventoryItem) => void;
1
+ import type { PMAPlayer } from "../class/PMAPlayer";
2
+ import type { BaseInventory, InventoryItem } from "@redm-types/Inventory";
3
+ import type { AbstractPMAPlayer } from "@redm-types/PMAPlayer";
4
+ export type UsableItemCall = (ply: PMAPlayer, inventory: BaseInventory, item: InventoryItem) => void;
5
5
  export type UsableItemCallShared = (ply: AbstractPMAPlayer, inventory: BaseInventory, item: InventoryItem) => void;
6
6
  export type UsableItems = {
7
7
  fn: UsableItemCallShared;
@@ -1,37 +0,0 @@
1
- import { Player } from "@nativewrappers/server";
2
- import type { ItemName, OptionalItem } from "redm-types/Inventory";
3
- import type { NotificationVariant, PMAPartialNotification } from "redm-types/Notifications";
4
- import type { AbstractPMAPlayer, CallSign, PlayerJob, PlayerUID } from "redm-types/PMAPlayer";
5
- export declare class PMAPlayerWrapper extends Player implements AbstractPMAPlayer {
6
- #private;
7
- /**
8
- * Creates the player from the ScRT msgpack'd class
9
- */
10
- static from_raw(ply: AbstractPMAPlayer): PMAPlayerWrapper;
11
- /**
12
- * Does basic checks that the player exists before lazy initializing the player
13
- */
14
- static from_source(source: number): PMAPlayerWrapper | null;
15
- constructor(source: number);
16
- constructor(pma_player: AbstractPMAPlayer);
17
- ensure_init(): void;
18
- show_notification(title?: string, description?: string, variant?: NotificationVariant): void;
19
- show_notification_object(partial: PMAPartialNotification): void;
20
- get_sex(): number;
21
- get_height(): number;
22
- get_dob(): string;
23
- get_unique_id(): PlayerUID;
24
- get_call_sign(): CallSign;
25
- get_character_name(): string;
26
- get_log_name(): string;
27
- get_item(item_name: ItemName): OptionalItem;
28
- add_item(item_name: ItemName, quantity: number): OptionalItem;
29
- remove_item(item_name: ItemName, quantity: number): void;
30
- has_enough_of_item(item_name: ItemName, quantity: number): boolean;
31
- get_job(): PlayerJob;
32
- set_job(job_name: string, rank: number): void;
33
- get_bank(): number;
34
- add_to_bank(positive_amount: number): void;
35
- remove_from_bank(negative_amount: number): void;
36
- save(): Promise<void>;
37
- }
@@ -1,124 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { Player } from "@nativewrappers/server";
4
- class PMAPlayerWrapper extends Player {
5
- static {
6
- __name(this, "PMAPlayerWrapper");
7
- }
8
- // This will get lazy-initialized whenever we actually call a function that needs it,
9
- // this will make sure we don't pay the un-needed serialize cost if we're only using this for
10
- // basic nativewrappers types
11
- #pma_player;
12
- /**
13
- * Creates the player from the ScRT msgpack'd class
14
- */
15
- static from_raw(ply) {
16
- return new PMAPlayerWrapper(ply);
17
- }
18
- /**
19
- * Does basic checks that the player exists before lazy initializing the player
20
- */
21
- static from_source(source) {
22
- if (!DoesPlayerExist(source)) {
23
- return null;
24
- }
25
- return new PMAPlayerWrapper(source);
26
- }
27
- constructor(source) {
28
- if (typeof source !== "number") {
29
- const ply = source;
30
- super(ply.source);
31
- this.#pma_player = ply;
32
- } else {
33
- super(source);
34
- }
35
- }
36
- // Ensure we initialize the player whenever we're doing something that needs it.
37
- ensure_init() {
38
- if (!this.#pma_player) {
39
- this.#pma_player = exports["pma"].from_source(this.Source);
40
- }
41
- }
42
- show_notification(title, description, variant = "default") {
43
- const noti = {
44
- title,
45
- body: description,
46
- variant
47
- };
48
- this.emit("pma:add_notifications", noti);
49
- }
50
- show_notification_object(partial) {
51
- this.emit("pma:add_notification", partial);
52
- }
53
- get_sex() {
54
- this.ensure_init();
55
- return this.#pma_player.get_sex();
56
- }
57
- get_height() {
58
- this.ensure_init();
59
- return this.#pma_player.get_height();
60
- }
61
- get_dob() {
62
- this.ensure_init();
63
- return this.#pma_player.get_dob();
64
- }
65
- get_unique_id() {
66
- this.ensure_init();
67
- return this.#pma_player.get_unique_id();
68
- }
69
- get_call_sign() {
70
- this.ensure_init();
71
- return this.#pma_player.get_call_sign();
72
- }
73
- get_character_name() {
74
- this.ensure_init();
75
- return this.#pma_player.get_character_name();
76
- }
77
- get_log_name() {
78
- this.ensure_init();
79
- return this.#pma_player.get_log_name();
80
- }
81
- get_item(item_name) {
82
- this.ensure_init();
83
- return this.#pma_player.get_item(item_name);
84
- }
85
- add_item(item_name, quantity) {
86
- this.ensure_init();
87
- return this.#pma_player.add_item(item_name, quantity);
88
- }
89
- remove_item(item_name, quantity) {
90
- this.ensure_init();
91
- return this.#pma_player.remove_item(item_name, quantity);
92
- }
93
- has_enough_of_item(item_name, quantity) {
94
- this.ensure_init();
95
- return this.#pma_player.has_enough_of_item(item_name, quantity);
96
- }
97
- get_job() {
98
- this.ensure_init();
99
- return this.#pma_player.get_job();
100
- }
101
- set_job(job_name, rank) {
102
- this.ensure_init();
103
- return this.#pma_player.set_job(job_name, rank);
104
- }
105
- get_bank() {
106
- this.ensure_init();
107
- return this.#pma_player.get_bank();
108
- }
109
- add_to_bank(positive_amount) {
110
- this.ensure_init();
111
- return this.#pma_player.add_to_bank(positive_amount);
112
- }
113
- remove_from_bank(negative_amount) {
114
- this.ensure_init();
115
- return this.#pma_player.remove_from_bank(negative_amount);
116
- }
117
- save() {
118
- this.ensure_init();
119
- return this.#pma_player.save();
120
- }
121
- }
122
- export {
123
- PMAPlayerWrapper
124
- };
@@ -1,10 +0,0 @@
1
- import { PMAPlayerWrapper } from "../class/PMAPlayerWrapper";
2
- type PMAServerEventType = (player: PMAPlayerWrapper, ...args: any[]) => Promise<void> | void;
3
- /**
4
- * Registers the Net Event call for {@link eventName} to this method
5
- *
6
- * @param eventName the event to bind this net event to
7
- * @param remoteOnly if the event should only accept remote calls, if set to true it will ignore any local call via `emit`, defaults to true
8
- */
9
- export declare function PMAServerEvent(eventName: string): (originalMethod: PMAServerEventType, context: ClassMethodDecoratorContext) => void;
10
- export {};
@@ -1,46 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { PMAPlayerWrapper } from "../class/PMAPlayerWrapper";
4
- function PMAServerEvent(eventName) {
5
- return /* @__PURE__ */ __name(function actualDecorator(originalMethod, context) {
6
- if (context.private) {
7
- throw new Error("NetEvent does not work on private methods, please mark the method as public");
8
- }
9
- context.addInitializer(function() {
10
- const _t = this;
11
- onNet(eventName, async (...args) => {
12
- const ply = new PMAPlayerWrapper(source);
13
- if (_t.__permissionMap) {
14
- const permissions = _t.__permissionMap.get(context.name);
15
- if (permissions) {
16
- let hasPermission = false;
17
- for (const perm of permissions) {
18
- if (ply.isAceAllowed(perm)) {
19
- hasPermission = true;
20
- break;
21
- }
22
- }
23
- if (!hasPermission) {
24
- emit("@nativewrappers:no_permission", { eventName, method: context.name, source: ply.Source });
25
- return;
26
- }
27
- }
28
- }
29
- try {
30
- return await originalMethod.call(this, ply, ...args);
31
- } catch (e) {
32
- console.error("------- NET EVENT ERROR --------");
33
- console.error(`Call to ${eventName} errored`);
34
- console.error(`Caller: ${ply.Source}`);
35
- console.error(`Data: ${JSON.stringify(args)}`);
36
- console.error(`Error: ${e}`);
37
- console.error("------- END NET EVENT ERROR --------");
38
- }
39
- });
40
- });
41
- }, "actualDecorator");
42
- }
43
- __name(PMAServerEvent, "PMAServerEvent");
44
- export {
45
- PMAServerEvent
46
- };
@@ -1,10 +0,0 @@
1
- import { PMAPlayerWrapper } from "../class/PMAPlayer";
2
- type PMAServerEventType = (player: PMAPlayerWrapper, ...args: any[]) => Promise<void> | void;
3
- /**
4
- * Registers the Net Event call for {@link eventName} to this method
5
- *
6
- * @param eventName the event to bind this net event to
7
- * @param remoteOnly if the event should only accept remote calls, if set to true it will ignore any local call via `emit`, defaults to true
8
- */
9
- export declare function PMAServerEvent(eventName: string): (originalMethod: PMAServerEventType, context: ClassMethodDecoratorContext) => void;
10
- export {};