@wumx-labs/noxaeapi-sdk 0.4.2 → 0.5.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.
- package/README.md +12 -1
- package/dist/index.cjs +212 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +215 -33
- package/dist/index.d.ts +215 -33
- package/dist/index.js +212 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -82,6 +82,19 @@ interface PlayerResolveResult {
|
|
|
82
82
|
name: string;
|
|
83
83
|
uuid: string;
|
|
84
84
|
}
|
|
85
|
+
interface IdentityServerInfo {
|
|
86
|
+
id: string;
|
|
87
|
+
label: string;
|
|
88
|
+
}
|
|
89
|
+
/** Result of resolving player identity via `GET /v1/identity/{name}`. */
|
|
90
|
+
interface IdentityInfo {
|
|
91
|
+
username: string;
|
|
92
|
+
identityUuid: string;
|
|
93
|
+
localUuid: string | null;
|
|
94
|
+
server: IdentityServerInfo;
|
|
95
|
+
onlineMode: boolean;
|
|
96
|
+
hasPlayedBefore: boolean;
|
|
97
|
+
}
|
|
85
98
|
interface ServerHealth {
|
|
86
99
|
cpus: number;
|
|
87
100
|
uptime: number;
|
|
@@ -168,16 +181,67 @@ interface TopBalanceEntry {
|
|
|
168
181
|
uuid: string;
|
|
169
182
|
balance: number;
|
|
170
183
|
}
|
|
171
|
-
|
|
172
|
-
name: string;
|
|
173
|
-
permissions: string[];
|
|
174
|
-
}
|
|
184
|
+
/** A single LuckPerms node (permission, inheritance, prefix, etc.) as returned by the server. */
|
|
175
185
|
interface PermissionNode {
|
|
176
186
|
permission: string;
|
|
177
187
|
value: boolean;
|
|
188
|
+
/** Epoch seconds, or `0` for a permanent (non-expiring) node. */
|
|
178
189
|
expiry: number;
|
|
179
|
-
|
|
180
|
-
|
|
190
|
+
/** Server context this node applies to, or the literal `"global"` if none was set. */
|
|
191
|
+
server: string;
|
|
192
|
+
/** World context this node applies to, or the literal `"global"` if none was set. */
|
|
193
|
+
world: string;
|
|
194
|
+
}
|
|
195
|
+
interface GroupInfo {
|
|
196
|
+
name: string;
|
|
197
|
+
/** `null` if the group has no display name node set. */
|
|
198
|
+
displayName: string | null;
|
|
199
|
+
weight: number;
|
|
200
|
+
permissions: PermissionNode[];
|
|
201
|
+
}
|
|
202
|
+
/** A player's or group's resolved prefix, suffix, and custom meta key-values. */
|
|
203
|
+
interface MetaInfo {
|
|
204
|
+
prefix: string | null;
|
|
205
|
+
suffix: string | null;
|
|
206
|
+
/** LuckPerms keeps every value ever set per key; the highest-priority one wins in-game. */
|
|
207
|
+
meta: Record<string, string[]>;
|
|
208
|
+
}
|
|
209
|
+
/** A LuckPerms track (an ordered rank ladder used for promote/demote). */
|
|
210
|
+
interface TrackInfo {
|
|
211
|
+
name: string;
|
|
212
|
+
/** Ordered from lowest to highest rank. */
|
|
213
|
+
groups: string[];
|
|
214
|
+
}
|
|
215
|
+
/** Optional server/world context that scopes a node to a subset of the network. */
|
|
216
|
+
interface LuckPermsContextOptions {
|
|
217
|
+
/** e.g. `"survival"` — matches LuckPerms' `server` context key. */
|
|
218
|
+
server?: string;
|
|
219
|
+
/** e.g. `"world_nether"` — matches LuckPerms' `world` context key. */
|
|
220
|
+
world?: string;
|
|
221
|
+
}
|
|
222
|
+
interface LuckPermsCheckPermissionResult {
|
|
223
|
+
uuid: string;
|
|
224
|
+
permission: string;
|
|
225
|
+
has: boolean;
|
|
226
|
+
}
|
|
227
|
+
interface LuckPermsPrimaryGroupResult {
|
|
228
|
+
uuid: string;
|
|
229
|
+
primaryGroup: string;
|
|
230
|
+
}
|
|
231
|
+
interface LuckPermsCreateGroupResult {
|
|
232
|
+
name: string;
|
|
233
|
+
status: string;
|
|
234
|
+
}
|
|
235
|
+
/** Result of a promote/demote call along a track. */
|
|
236
|
+
interface LuckPermsTrackActionResult {
|
|
237
|
+
uuid: string;
|
|
238
|
+
track: string;
|
|
239
|
+
/** `false` for statuses like `END_OF_TRACK`/`AMBIGUOUS_CALL`, where nothing was changed. */
|
|
240
|
+
success: boolean;
|
|
241
|
+
/** Raw LuckPerms `PromotionResult`/`DemotionResult` status, e.g. `"SUCCESS"`, `"END_OF_TRACK"`. */
|
|
242
|
+
status: string;
|
|
243
|
+
from: string | null;
|
|
244
|
+
to: string | null;
|
|
181
245
|
}
|
|
182
246
|
interface Advancement {
|
|
183
247
|
key: string;
|
|
@@ -612,55 +676,151 @@ declare class PlaceholdersModule {
|
|
|
612
676
|
replace(uuid: string, message: string): Promise<string>;
|
|
613
677
|
}
|
|
614
678
|
|
|
679
|
+
/** Extra fields accepted by the node-adding endpoints, on top of the context options. */
|
|
680
|
+
interface AddPermissionOptions extends LuckPermsContextOptions {
|
|
681
|
+
/**
|
|
682
|
+
* Node value. Defaults to `true` server-side when omitted — pass `false`
|
|
683
|
+
* to add a negating node rather than a positive grant.
|
|
684
|
+
*/
|
|
685
|
+
value?: boolean;
|
|
686
|
+
/**
|
|
687
|
+
* When the node should expire. Parsed server-side by
|
|
688
|
+
* `ValidationUtils.parseExpiry` — pass an ISO-8601 instant string (e.g.
|
|
689
|
+
* `"2026-12-31T00:00:00Z"`) or an epoch-seconds string. Omit for a node
|
|
690
|
+
* that never expires.
|
|
691
|
+
*/
|
|
692
|
+
expiry?: string;
|
|
693
|
+
}
|
|
694
|
+
type SetGroupOptions = LuckPermsContextOptions & Pick<AddPermissionOptions, "expiry">;
|
|
695
|
+
interface SetMetaValueOptions extends LuckPermsContextOptions {
|
|
696
|
+
/**
|
|
697
|
+
* Sort priority — higher wins when multiple prefix/suffix nodes are
|
|
698
|
+
* active at once. Defaults to `100` server-side when omitted, matching
|
|
699
|
+
* LuckPerms' own `/lp meta setprefix|setsuffix` default.
|
|
700
|
+
*/
|
|
701
|
+
priority?: number;
|
|
702
|
+
}
|
|
615
703
|
/**
|
|
616
704
|
* Wraps the `/v1/luckperms/*` routes. These only exist on the server when
|
|
617
|
-
* the LuckPerms
|
|
618
|
-
* without it
|
|
619
|
-
* available" flag from the SDK's side;
|
|
620
|
-
* LuckPerms if you need to branch on
|
|
705
|
+
* the LuckPerms plugin is loaded — calling any method here against a
|
|
706
|
+
* server without it throws `NoxAeApiServerError` with a 503 status.
|
|
707
|
+
* There's no separate "is this available" flag from the SDK's side;
|
|
708
|
+
* check `client.plugins.list()` for LuckPerms if you need to branch on
|
|
709
|
+
* it ahead of time.
|
|
621
710
|
*
|
|
622
|
-
* Unlike most other modules,
|
|
623
|
-
* JSON (the server reads
|
|
711
|
+
* Unlike most other modules, every request body here is sent as real
|
|
712
|
+
* JSON (the server reads it with `ctx.bodyAsClass(...)`, not
|
|
624
713
|
* `ctx.formParam(...)`) — do not add `form: true` to these calls.
|
|
714
|
+
*
|
|
715
|
+
* "Context" throughout this module means LuckPerms' `server`/`world`
|
|
716
|
+
* context keys, not the Bukkit/network server this SDK talks to — pass
|
|
717
|
+
* them when a node should only apply on a specific sub-server or world,
|
|
718
|
+
* and omit them for a global node.
|
|
625
719
|
*/
|
|
626
720
|
declare class LuckPermsModule {
|
|
627
721
|
private readonly http;
|
|
628
722
|
constructor(http: HttpEngine);
|
|
629
|
-
/** Get the
|
|
723
|
+
/** Get the names of every group a player belongs to (via inheritance nodes). */
|
|
630
724
|
getPlayerGroups(uuid: string): Promise<string[]>;
|
|
631
|
-
/** Get
|
|
725
|
+
/** Get every node (permissions, inheritance, prefix/suffix, meta, ...) held directly by a player. */
|
|
632
726
|
getPlayerPermissions(uuid: string): Promise<PermissionNode[]>;
|
|
633
|
-
/** Add a permission node to a player. */
|
|
634
|
-
addPlayerPermission(uuid: string, permission: string,
|
|
635
|
-
/**
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
/** Remove a permission node from a player. */
|
|
727
|
+
/** Add a permission node to a player. Defaults to a permanent, global, `true`-valued node. */
|
|
728
|
+
addPlayerPermission(uuid: string, permission: string, options?: AddPermissionOptions): Promise<void>;
|
|
729
|
+
/**
|
|
730
|
+
* Remove a permission node from a player by key. Note this matches on
|
|
731
|
+
* the permission string only — it does not target a specific
|
|
732
|
+
* value/expiry/context combination.
|
|
733
|
+
*/
|
|
641
734
|
removePlayerPermission(uuid: string, permission: string): Promise<void>;
|
|
642
|
-
/**
|
|
643
|
-
|
|
644
|
-
|
|
735
|
+
/**
|
|
736
|
+
* Check whether a player has a given permission, using LuckPerms'
|
|
737
|
+
* native resolution (inheritance, wildcards, contexts all apply).
|
|
738
|
+
*/
|
|
739
|
+
checkPlayerPermission(uuid: string, permission: string): Promise<LuckPermsCheckPermissionResult>;
|
|
740
|
+
/** Get a player's primary group name. */
|
|
741
|
+
getPlayerPrimaryGroup(uuid: string): Promise<LuckPermsPrimaryGroupResult>;
|
|
742
|
+
/**
|
|
743
|
+
* Set a player's primary group. This both adds the corresponding
|
|
744
|
+
* inheritance node (so permissions actually resolve from the group) and
|
|
745
|
+
* updates the primary-group label — mirrors `/lp user <target> parent
|
|
746
|
+
* add <group>` plus `/lp user <target> setprimarygroup <group>`.
|
|
747
|
+
*/
|
|
748
|
+
setPlayerGroup(uuid: string, group: string, options?: SetGroupOptions): Promise<void>;
|
|
749
|
+
/**
|
|
750
|
+
* Remove a group's inheritance node from a player. Does **not** change
|
|
751
|
+
* their primary group — call `setPlayerGroup()` with the new group
|
|
752
|
+
* afterward if you're reassigning rank rather than just removing one
|
|
753
|
+
* of several parents.
|
|
754
|
+
*/
|
|
645
755
|
removePlayerGroup(uuid: string, groupName: string): Promise<void>;
|
|
646
|
-
/**
|
|
756
|
+
/**
|
|
757
|
+
* Promote a player one step up a track. If the result isn't successful
|
|
758
|
+
* (e.g. `END_OF_TRACK`, `AMBIGUOUS_CALL`), the player's data is left
|
|
759
|
+
* untouched — check `.success`/`.status` on the result rather than
|
|
760
|
+
* assuming the call always moves them.
|
|
761
|
+
*/
|
|
762
|
+
promotePlayer(uuid: string, track: string, options?: LuckPermsContextOptions): Promise<LuckPermsTrackActionResult>;
|
|
763
|
+
/** Demote a player one step down a track. See `promotePlayer()` for the result semantics. */
|
|
764
|
+
demotePlayer(uuid: string, track: string, options?: LuckPermsContextOptions): Promise<LuckPermsTrackActionResult>;
|
|
765
|
+
/** Get a player's resolved prefix, suffix, and custom meta key-values. */
|
|
766
|
+
getPlayerMeta(uuid: string): Promise<MetaInfo>;
|
|
767
|
+
/**
|
|
768
|
+
* Set a player's prefix. Behaves like a "set", not an "add" — any
|
|
769
|
+
* existing prefix node (in any context) is cleared first, so a player
|
|
770
|
+
* only ever has one active prefix from this call.
|
|
771
|
+
*/
|
|
772
|
+
setPlayerPrefix(uuid: string, prefix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
773
|
+
/** Set a player's suffix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
774
|
+
setPlayerSuffix(uuid: string, suffix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
775
|
+
/** Set a custom meta key-value pair on a player, replacing any existing value(s) for that key. */
|
|
776
|
+
setPlayerMeta(uuid: string, key: string, value: string, options?: LuckPermsContextOptions): Promise<void>;
|
|
777
|
+
/** Remove a custom meta key from a player (all values/contexts for that key). */
|
|
778
|
+
removePlayerMeta(uuid: string, key: string): Promise<void>;
|
|
779
|
+
/** List the names of every group registered in LuckPerms. */
|
|
647
780
|
getGroups(): Promise<string[]>;
|
|
648
781
|
/**
|
|
649
782
|
* Create a new LuckPerms group. The name is lowercased server-side.
|
|
650
783
|
* Throws `NoxAeApiError` with a 409 status if the group already exists.
|
|
651
784
|
*/
|
|
652
|
-
createGroup(name: string): Promise<
|
|
653
|
-
name: string;
|
|
654
|
-
status: string;
|
|
655
|
-
}>;
|
|
785
|
+
createGroup(name: string): Promise<LuckPermsCreateGroupResult>;
|
|
656
786
|
/**
|
|
657
787
|
* Delete a LuckPerms group by name.
|
|
658
788
|
* The `default` group can't be deleted (400 — every user without an
|
|
659
789
|
* explicit group inherits from it) and a 404 is thrown if it doesn't exist.
|
|
660
790
|
*/
|
|
661
791
|
deleteGroup(name: string): Promise<void>;
|
|
662
|
-
/** Get
|
|
663
|
-
getGroupPermissions(name: string): Promise<
|
|
792
|
+
/** Get every node held directly by a group. */
|
|
793
|
+
getGroupPermissions(name: string): Promise<PermissionNode[]>;
|
|
794
|
+
/** Add a permission node to a group. Same options/defaults as `addPlayerPermission()`. */
|
|
795
|
+
addGroupPermission(name: string, permission: string, options?: AddPermissionOptions): Promise<void>;
|
|
796
|
+
/** Remove a permission node from a group by key (matches on permission string only). */
|
|
797
|
+
removeGroupPermission(name: string, permission: string): Promise<void>;
|
|
798
|
+
/** Get full info for a group: name, display name, weight, and all its nodes. */
|
|
799
|
+
getGroupInfo(name: string): Promise<GroupInfo>;
|
|
800
|
+
/**
|
|
801
|
+
* Update a group's weight and/or display name. Provide at least one of
|
|
802
|
+
* the two fields — the server 400s otherwise. Passing an empty/blank
|
|
803
|
+
* `displayName` resets it to the default rather than setting a blank one.
|
|
804
|
+
* Returns the group's full updated info.
|
|
805
|
+
*/
|
|
806
|
+
updateGroup(name: string, updates: {
|
|
807
|
+
weight?: number;
|
|
808
|
+
displayName?: string | null;
|
|
809
|
+
}): Promise<GroupInfo>;
|
|
810
|
+
/** Get a group's resolved prefix, suffix, and custom meta key-values. */
|
|
811
|
+
getGroupMeta(name: string): Promise<MetaInfo>;
|
|
812
|
+
/** Set a group's prefix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
813
|
+
setGroupPrefix(name: string, prefix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
814
|
+
/** Set a group's suffix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
815
|
+
setGroupSuffix(name: string, suffix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
816
|
+
/** Set a custom meta key-value pair on a group, replacing any existing value(s) for that key. */
|
|
817
|
+
setGroupMeta(name: string, key: string, value: string, options?: LuckPermsContextOptions): Promise<void>;
|
|
818
|
+
/** Remove a custom meta key from a group (all values/contexts for that key). */
|
|
819
|
+
removeGroupMeta(name: string, key: string): Promise<void>;
|
|
820
|
+
/** List the names of every track registered in LuckPerms. */
|
|
821
|
+
getTracks(): Promise<string[]>;
|
|
822
|
+
/** Get a track's name and its ordered list of groups (lowest to highest rank). */
|
|
823
|
+
getTrack(name: string): Promise<TrackInfo>;
|
|
664
824
|
}
|
|
665
825
|
|
|
666
826
|
/**
|
|
@@ -681,6 +841,27 @@ declare class NoxAuthModule {
|
|
|
681
841
|
checkPassword(name: string, password: string): Promise<PasswordCheckResult>;
|
|
682
842
|
}
|
|
683
843
|
|
|
844
|
+
/**
|
|
845
|
+
* Wraps the /v1/identity/* routes.
|
|
846
|
+
*
|
|
847
|
+
* Resolves a username to its deterministic network-wide identityUuid and
|
|
848
|
+
* returns whether the player has ever joined this backend server (along with
|
|
849
|
+
* this server's localUuid).
|
|
850
|
+
*/
|
|
851
|
+
declare class IdentityModule {
|
|
852
|
+
private readonly http;
|
|
853
|
+
constructor(http: HttpEngine);
|
|
854
|
+
/**
|
|
855
|
+
* Resolves a player's network-wide identity and local UUID status.
|
|
856
|
+
*
|
|
857
|
+
* Unlike players.resolve(name), this does NOT throw 404 if the player
|
|
858
|
+
* has never joined this server. Instead, identityUuid is always computed
|
|
859
|
+
* deterministically from the username, and hasPlayedBefore will be false
|
|
860
|
+
* with localUuid: null.
|
|
861
|
+
*/
|
|
862
|
+
get(name: string): Promise<IdentityInfo>;
|
|
863
|
+
}
|
|
864
|
+
|
|
684
865
|
/**
|
|
685
866
|
* Wraps the `/v1/skills/*` routes (mcMMO / AuraSkills).
|
|
686
867
|
*/
|
|
@@ -918,6 +1099,7 @@ declare class NoxAeApiSocket {
|
|
|
918
1099
|
|
|
919
1100
|
declare class NoxAeApiClient {
|
|
920
1101
|
readonly players: PlayersModule;
|
|
1102
|
+
readonly identity: IdentityModule;
|
|
921
1103
|
readonly economy: EconomyModule;
|
|
922
1104
|
readonly server: ServerModule;
|
|
923
1105
|
readonly worlds: WorldsModule;
|
|
@@ -1041,4 +1223,4 @@ declare class NoxAeApiNetworkError extends Error {
|
|
|
1041
1223
|
constructor(message: string, method: string, path: string, cause?: unknown);
|
|
1042
1224
|
}
|
|
1043
1225
|
|
|
1044
|
-
export { type Advancement, type CurrencyBalance, type CurrencyTopEntry, type EconomyInfo, type GroupInfo, type InventoryItem, type LeaderboardEntry, type LeaderboardSourceInfo, type NetworkBroadcastResponse, type NetworkFindPlayerResponse, type NetworkHealthResponse, type NetworkHealthServerEntry, type NetworkHubBroadcastResponse, type NetworkHubFindPlayerResponse, type NetworkHubNode, type NetworkHubPlayer, type NetworkHubPlayersResponse, type NetworkHubStatusResponse, type NetworkPlayersResponse, type NetworkPlayersServerEntry, type NetworkServerStatus, NoxAeApiClient, type NoxAeApiClientOptions, NoxAeApiError, NoxAeApiForbiddenError, NoxAeApiNetworkError, NoxAeApiNetworkHubClient, NoxAeApiNotFoundError, NoxAeApiRateLimitError, NoxAeApiServerError, NoxAeApiSocket, NoxAeApiUnauthorizedError, type NoxAeApiWsEvent, type NoxAeApiWsOptions, type NoxAuthPlayerInfo, type Objective, type OfflinePlayer, type OnlinePlayer, type PasswordCheckResult, type PermissionNode, type PlayerBalance, type PlayerProfile, type PlayerProfileBan, type PlayerProfileEconomy, type PlayerProfileStatTile, type PlayerProfileStatus, type PlayerProfilesResponse, type PlayerResolveResult, type PlayerStats, type Plugin, type RetryOptions, type Score, type Scoreboard, type ServerBan, type ServerHealth, type ServerInfo, type SkillInfo, type TopBalanceEntry, type WhitelistEntry, type World };
|
|
1226
|
+
export { type AddPermissionOptions, type Advancement, type CurrencyBalance, type CurrencyTopEntry, type EconomyInfo, type GroupInfo, type IdentityInfo, IdentityModule, type IdentityServerInfo, type InventoryItem, type LeaderboardEntry, type LeaderboardSourceInfo, type LuckPermsCheckPermissionResult, type LuckPermsContextOptions, type LuckPermsCreateGroupResult, type LuckPermsPrimaryGroupResult, type LuckPermsTrackActionResult, type MetaInfo, type NetworkBroadcastResponse, type NetworkFindPlayerResponse, type NetworkHealthResponse, type NetworkHealthServerEntry, type NetworkHubBroadcastResponse, type NetworkHubFindPlayerResponse, type NetworkHubNode, type NetworkHubPlayer, type NetworkHubPlayersResponse, type NetworkHubStatusResponse, type NetworkPlayersResponse, type NetworkPlayersServerEntry, type NetworkServerStatus, NoxAeApiClient, type NoxAeApiClientOptions, NoxAeApiError, NoxAeApiForbiddenError, NoxAeApiNetworkError, NoxAeApiNetworkHubClient, NoxAeApiNotFoundError, NoxAeApiRateLimitError, NoxAeApiServerError, NoxAeApiSocket, NoxAeApiUnauthorizedError, type NoxAeApiWsEvent, type NoxAeApiWsOptions, type NoxAuthPlayerInfo, type Objective, type OfflinePlayer, type OnlinePlayer, type PasswordCheckResult, type PermissionNode, type PlayerBalance, type PlayerProfile, type PlayerProfileBan, type PlayerProfileEconomy, type PlayerProfileStatTile, type PlayerProfileStatus, type PlayerProfilesResponse, type PlayerResolveResult, type PlayerStats, type Plugin, type RetryOptions, type Score, type Scoreboard, type ServerBan, type ServerHealth, type ServerInfo, type SetGroupOptions, type SetMetaValueOptions, type SkillInfo, type TopBalanceEntry, type TrackInfo, type WhitelistEntry, type World };
|
package/dist/index.d.ts
CHANGED
|
@@ -82,6 +82,19 @@ interface PlayerResolveResult {
|
|
|
82
82
|
name: string;
|
|
83
83
|
uuid: string;
|
|
84
84
|
}
|
|
85
|
+
interface IdentityServerInfo {
|
|
86
|
+
id: string;
|
|
87
|
+
label: string;
|
|
88
|
+
}
|
|
89
|
+
/** Result of resolving player identity via `GET /v1/identity/{name}`. */
|
|
90
|
+
interface IdentityInfo {
|
|
91
|
+
username: string;
|
|
92
|
+
identityUuid: string;
|
|
93
|
+
localUuid: string | null;
|
|
94
|
+
server: IdentityServerInfo;
|
|
95
|
+
onlineMode: boolean;
|
|
96
|
+
hasPlayedBefore: boolean;
|
|
97
|
+
}
|
|
85
98
|
interface ServerHealth {
|
|
86
99
|
cpus: number;
|
|
87
100
|
uptime: number;
|
|
@@ -168,16 +181,67 @@ interface TopBalanceEntry {
|
|
|
168
181
|
uuid: string;
|
|
169
182
|
balance: number;
|
|
170
183
|
}
|
|
171
|
-
|
|
172
|
-
name: string;
|
|
173
|
-
permissions: string[];
|
|
174
|
-
}
|
|
184
|
+
/** A single LuckPerms node (permission, inheritance, prefix, etc.) as returned by the server. */
|
|
175
185
|
interface PermissionNode {
|
|
176
186
|
permission: string;
|
|
177
187
|
value: boolean;
|
|
188
|
+
/** Epoch seconds, or `0` for a permanent (non-expiring) node. */
|
|
178
189
|
expiry: number;
|
|
179
|
-
|
|
180
|
-
|
|
190
|
+
/** Server context this node applies to, or the literal `"global"` if none was set. */
|
|
191
|
+
server: string;
|
|
192
|
+
/** World context this node applies to, or the literal `"global"` if none was set. */
|
|
193
|
+
world: string;
|
|
194
|
+
}
|
|
195
|
+
interface GroupInfo {
|
|
196
|
+
name: string;
|
|
197
|
+
/** `null` if the group has no display name node set. */
|
|
198
|
+
displayName: string | null;
|
|
199
|
+
weight: number;
|
|
200
|
+
permissions: PermissionNode[];
|
|
201
|
+
}
|
|
202
|
+
/** A player's or group's resolved prefix, suffix, and custom meta key-values. */
|
|
203
|
+
interface MetaInfo {
|
|
204
|
+
prefix: string | null;
|
|
205
|
+
suffix: string | null;
|
|
206
|
+
/** LuckPerms keeps every value ever set per key; the highest-priority one wins in-game. */
|
|
207
|
+
meta: Record<string, string[]>;
|
|
208
|
+
}
|
|
209
|
+
/** A LuckPerms track (an ordered rank ladder used for promote/demote). */
|
|
210
|
+
interface TrackInfo {
|
|
211
|
+
name: string;
|
|
212
|
+
/** Ordered from lowest to highest rank. */
|
|
213
|
+
groups: string[];
|
|
214
|
+
}
|
|
215
|
+
/** Optional server/world context that scopes a node to a subset of the network. */
|
|
216
|
+
interface LuckPermsContextOptions {
|
|
217
|
+
/** e.g. `"survival"` — matches LuckPerms' `server` context key. */
|
|
218
|
+
server?: string;
|
|
219
|
+
/** e.g. `"world_nether"` — matches LuckPerms' `world` context key. */
|
|
220
|
+
world?: string;
|
|
221
|
+
}
|
|
222
|
+
interface LuckPermsCheckPermissionResult {
|
|
223
|
+
uuid: string;
|
|
224
|
+
permission: string;
|
|
225
|
+
has: boolean;
|
|
226
|
+
}
|
|
227
|
+
interface LuckPermsPrimaryGroupResult {
|
|
228
|
+
uuid: string;
|
|
229
|
+
primaryGroup: string;
|
|
230
|
+
}
|
|
231
|
+
interface LuckPermsCreateGroupResult {
|
|
232
|
+
name: string;
|
|
233
|
+
status: string;
|
|
234
|
+
}
|
|
235
|
+
/** Result of a promote/demote call along a track. */
|
|
236
|
+
interface LuckPermsTrackActionResult {
|
|
237
|
+
uuid: string;
|
|
238
|
+
track: string;
|
|
239
|
+
/** `false` for statuses like `END_OF_TRACK`/`AMBIGUOUS_CALL`, where nothing was changed. */
|
|
240
|
+
success: boolean;
|
|
241
|
+
/** Raw LuckPerms `PromotionResult`/`DemotionResult` status, e.g. `"SUCCESS"`, `"END_OF_TRACK"`. */
|
|
242
|
+
status: string;
|
|
243
|
+
from: string | null;
|
|
244
|
+
to: string | null;
|
|
181
245
|
}
|
|
182
246
|
interface Advancement {
|
|
183
247
|
key: string;
|
|
@@ -612,55 +676,151 @@ declare class PlaceholdersModule {
|
|
|
612
676
|
replace(uuid: string, message: string): Promise<string>;
|
|
613
677
|
}
|
|
614
678
|
|
|
679
|
+
/** Extra fields accepted by the node-adding endpoints, on top of the context options. */
|
|
680
|
+
interface AddPermissionOptions extends LuckPermsContextOptions {
|
|
681
|
+
/**
|
|
682
|
+
* Node value. Defaults to `true` server-side when omitted — pass `false`
|
|
683
|
+
* to add a negating node rather than a positive grant.
|
|
684
|
+
*/
|
|
685
|
+
value?: boolean;
|
|
686
|
+
/**
|
|
687
|
+
* When the node should expire. Parsed server-side by
|
|
688
|
+
* `ValidationUtils.parseExpiry` — pass an ISO-8601 instant string (e.g.
|
|
689
|
+
* `"2026-12-31T00:00:00Z"`) or an epoch-seconds string. Omit for a node
|
|
690
|
+
* that never expires.
|
|
691
|
+
*/
|
|
692
|
+
expiry?: string;
|
|
693
|
+
}
|
|
694
|
+
type SetGroupOptions = LuckPermsContextOptions & Pick<AddPermissionOptions, "expiry">;
|
|
695
|
+
interface SetMetaValueOptions extends LuckPermsContextOptions {
|
|
696
|
+
/**
|
|
697
|
+
* Sort priority — higher wins when multiple prefix/suffix nodes are
|
|
698
|
+
* active at once. Defaults to `100` server-side when omitted, matching
|
|
699
|
+
* LuckPerms' own `/lp meta setprefix|setsuffix` default.
|
|
700
|
+
*/
|
|
701
|
+
priority?: number;
|
|
702
|
+
}
|
|
615
703
|
/**
|
|
616
704
|
* Wraps the `/v1/luckperms/*` routes. These only exist on the server when
|
|
617
|
-
* the LuckPerms
|
|
618
|
-
* without it
|
|
619
|
-
* available" flag from the SDK's side;
|
|
620
|
-
* LuckPerms if you need to branch on
|
|
705
|
+
* the LuckPerms plugin is loaded — calling any method here against a
|
|
706
|
+
* server without it throws `NoxAeApiServerError` with a 503 status.
|
|
707
|
+
* There's no separate "is this available" flag from the SDK's side;
|
|
708
|
+
* check `client.plugins.list()` for LuckPerms if you need to branch on
|
|
709
|
+
* it ahead of time.
|
|
621
710
|
*
|
|
622
|
-
* Unlike most other modules,
|
|
623
|
-
* JSON (the server reads
|
|
711
|
+
* Unlike most other modules, every request body here is sent as real
|
|
712
|
+
* JSON (the server reads it with `ctx.bodyAsClass(...)`, not
|
|
624
713
|
* `ctx.formParam(...)`) — do not add `form: true` to these calls.
|
|
714
|
+
*
|
|
715
|
+
* "Context" throughout this module means LuckPerms' `server`/`world`
|
|
716
|
+
* context keys, not the Bukkit/network server this SDK talks to — pass
|
|
717
|
+
* them when a node should only apply on a specific sub-server or world,
|
|
718
|
+
* and omit them for a global node.
|
|
625
719
|
*/
|
|
626
720
|
declare class LuckPermsModule {
|
|
627
721
|
private readonly http;
|
|
628
722
|
constructor(http: HttpEngine);
|
|
629
|
-
/** Get the
|
|
723
|
+
/** Get the names of every group a player belongs to (via inheritance nodes). */
|
|
630
724
|
getPlayerGroups(uuid: string): Promise<string[]>;
|
|
631
|
-
/** Get
|
|
725
|
+
/** Get every node (permissions, inheritance, prefix/suffix, meta, ...) held directly by a player. */
|
|
632
726
|
getPlayerPermissions(uuid: string): Promise<PermissionNode[]>;
|
|
633
|
-
/** Add a permission node to a player. */
|
|
634
|
-
addPlayerPermission(uuid: string, permission: string,
|
|
635
|
-
/**
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
/** Remove a permission node from a player. */
|
|
727
|
+
/** Add a permission node to a player. Defaults to a permanent, global, `true`-valued node. */
|
|
728
|
+
addPlayerPermission(uuid: string, permission: string, options?: AddPermissionOptions): Promise<void>;
|
|
729
|
+
/**
|
|
730
|
+
* Remove a permission node from a player by key. Note this matches on
|
|
731
|
+
* the permission string only — it does not target a specific
|
|
732
|
+
* value/expiry/context combination.
|
|
733
|
+
*/
|
|
641
734
|
removePlayerPermission(uuid: string, permission: string): Promise<void>;
|
|
642
|
-
/**
|
|
643
|
-
|
|
644
|
-
|
|
735
|
+
/**
|
|
736
|
+
* Check whether a player has a given permission, using LuckPerms'
|
|
737
|
+
* native resolution (inheritance, wildcards, contexts all apply).
|
|
738
|
+
*/
|
|
739
|
+
checkPlayerPermission(uuid: string, permission: string): Promise<LuckPermsCheckPermissionResult>;
|
|
740
|
+
/** Get a player's primary group name. */
|
|
741
|
+
getPlayerPrimaryGroup(uuid: string): Promise<LuckPermsPrimaryGroupResult>;
|
|
742
|
+
/**
|
|
743
|
+
* Set a player's primary group. This both adds the corresponding
|
|
744
|
+
* inheritance node (so permissions actually resolve from the group) and
|
|
745
|
+
* updates the primary-group label — mirrors `/lp user <target> parent
|
|
746
|
+
* add <group>` plus `/lp user <target> setprimarygroup <group>`.
|
|
747
|
+
*/
|
|
748
|
+
setPlayerGroup(uuid: string, group: string, options?: SetGroupOptions): Promise<void>;
|
|
749
|
+
/**
|
|
750
|
+
* Remove a group's inheritance node from a player. Does **not** change
|
|
751
|
+
* their primary group — call `setPlayerGroup()` with the new group
|
|
752
|
+
* afterward if you're reassigning rank rather than just removing one
|
|
753
|
+
* of several parents.
|
|
754
|
+
*/
|
|
645
755
|
removePlayerGroup(uuid: string, groupName: string): Promise<void>;
|
|
646
|
-
/**
|
|
756
|
+
/**
|
|
757
|
+
* Promote a player one step up a track. If the result isn't successful
|
|
758
|
+
* (e.g. `END_OF_TRACK`, `AMBIGUOUS_CALL`), the player's data is left
|
|
759
|
+
* untouched — check `.success`/`.status` on the result rather than
|
|
760
|
+
* assuming the call always moves them.
|
|
761
|
+
*/
|
|
762
|
+
promotePlayer(uuid: string, track: string, options?: LuckPermsContextOptions): Promise<LuckPermsTrackActionResult>;
|
|
763
|
+
/** Demote a player one step down a track. See `promotePlayer()` for the result semantics. */
|
|
764
|
+
demotePlayer(uuid: string, track: string, options?: LuckPermsContextOptions): Promise<LuckPermsTrackActionResult>;
|
|
765
|
+
/** Get a player's resolved prefix, suffix, and custom meta key-values. */
|
|
766
|
+
getPlayerMeta(uuid: string): Promise<MetaInfo>;
|
|
767
|
+
/**
|
|
768
|
+
* Set a player's prefix. Behaves like a "set", not an "add" — any
|
|
769
|
+
* existing prefix node (in any context) is cleared first, so a player
|
|
770
|
+
* only ever has one active prefix from this call.
|
|
771
|
+
*/
|
|
772
|
+
setPlayerPrefix(uuid: string, prefix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
773
|
+
/** Set a player's suffix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
774
|
+
setPlayerSuffix(uuid: string, suffix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
775
|
+
/** Set a custom meta key-value pair on a player, replacing any existing value(s) for that key. */
|
|
776
|
+
setPlayerMeta(uuid: string, key: string, value: string, options?: LuckPermsContextOptions): Promise<void>;
|
|
777
|
+
/** Remove a custom meta key from a player (all values/contexts for that key). */
|
|
778
|
+
removePlayerMeta(uuid: string, key: string): Promise<void>;
|
|
779
|
+
/** List the names of every group registered in LuckPerms. */
|
|
647
780
|
getGroups(): Promise<string[]>;
|
|
648
781
|
/**
|
|
649
782
|
* Create a new LuckPerms group. The name is lowercased server-side.
|
|
650
783
|
* Throws `NoxAeApiError` with a 409 status if the group already exists.
|
|
651
784
|
*/
|
|
652
|
-
createGroup(name: string): Promise<
|
|
653
|
-
name: string;
|
|
654
|
-
status: string;
|
|
655
|
-
}>;
|
|
785
|
+
createGroup(name: string): Promise<LuckPermsCreateGroupResult>;
|
|
656
786
|
/**
|
|
657
787
|
* Delete a LuckPerms group by name.
|
|
658
788
|
* The `default` group can't be deleted (400 — every user without an
|
|
659
789
|
* explicit group inherits from it) and a 404 is thrown if it doesn't exist.
|
|
660
790
|
*/
|
|
661
791
|
deleteGroup(name: string): Promise<void>;
|
|
662
|
-
/** Get
|
|
663
|
-
getGroupPermissions(name: string): Promise<
|
|
792
|
+
/** Get every node held directly by a group. */
|
|
793
|
+
getGroupPermissions(name: string): Promise<PermissionNode[]>;
|
|
794
|
+
/** Add a permission node to a group. Same options/defaults as `addPlayerPermission()`. */
|
|
795
|
+
addGroupPermission(name: string, permission: string, options?: AddPermissionOptions): Promise<void>;
|
|
796
|
+
/** Remove a permission node from a group by key (matches on permission string only). */
|
|
797
|
+
removeGroupPermission(name: string, permission: string): Promise<void>;
|
|
798
|
+
/** Get full info for a group: name, display name, weight, and all its nodes. */
|
|
799
|
+
getGroupInfo(name: string): Promise<GroupInfo>;
|
|
800
|
+
/**
|
|
801
|
+
* Update a group's weight and/or display name. Provide at least one of
|
|
802
|
+
* the two fields — the server 400s otherwise. Passing an empty/blank
|
|
803
|
+
* `displayName` resets it to the default rather than setting a blank one.
|
|
804
|
+
* Returns the group's full updated info.
|
|
805
|
+
*/
|
|
806
|
+
updateGroup(name: string, updates: {
|
|
807
|
+
weight?: number;
|
|
808
|
+
displayName?: string | null;
|
|
809
|
+
}): Promise<GroupInfo>;
|
|
810
|
+
/** Get a group's resolved prefix, suffix, and custom meta key-values. */
|
|
811
|
+
getGroupMeta(name: string): Promise<MetaInfo>;
|
|
812
|
+
/** Set a group's prefix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
813
|
+
setGroupPrefix(name: string, prefix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
814
|
+
/** Set a group's suffix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
815
|
+
setGroupSuffix(name: string, suffix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
816
|
+
/** Set a custom meta key-value pair on a group, replacing any existing value(s) for that key. */
|
|
817
|
+
setGroupMeta(name: string, key: string, value: string, options?: LuckPermsContextOptions): Promise<void>;
|
|
818
|
+
/** Remove a custom meta key from a group (all values/contexts for that key). */
|
|
819
|
+
removeGroupMeta(name: string, key: string): Promise<void>;
|
|
820
|
+
/** List the names of every track registered in LuckPerms. */
|
|
821
|
+
getTracks(): Promise<string[]>;
|
|
822
|
+
/** Get a track's name and its ordered list of groups (lowest to highest rank). */
|
|
823
|
+
getTrack(name: string): Promise<TrackInfo>;
|
|
664
824
|
}
|
|
665
825
|
|
|
666
826
|
/**
|
|
@@ -681,6 +841,27 @@ declare class NoxAuthModule {
|
|
|
681
841
|
checkPassword(name: string, password: string): Promise<PasswordCheckResult>;
|
|
682
842
|
}
|
|
683
843
|
|
|
844
|
+
/**
|
|
845
|
+
* Wraps the /v1/identity/* routes.
|
|
846
|
+
*
|
|
847
|
+
* Resolves a username to its deterministic network-wide identityUuid and
|
|
848
|
+
* returns whether the player has ever joined this backend server (along with
|
|
849
|
+
* this server's localUuid).
|
|
850
|
+
*/
|
|
851
|
+
declare class IdentityModule {
|
|
852
|
+
private readonly http;
|
|
853
|
+
constructor(http: HttpEngine);
|
|
854
|
+
/**
|
|
855
|
+
* Resolves a player's network-wide identity and local UUID status.
|
|
856
|
+
*
|
|
857
|
+
* Unlike players.resolve(name), this does NOT throw 404 if the player
|
|
858
|
+
* has never joined this server. Instead, identityUuid is always computed
|
|
859
|
+
* deterministically from the username, and hasPlayedBefore will be false
|
|
860
|
+
* with localUuid: null.
|
|
861
|
+
*/
|
|
862
|
+
get(name: string): Promise<IdentityInfo>;
|
|
863
|
+
}
|
|
864
|
+
|
|
684
865
|
/**
|
|
685
866
|
* Wraps the `/v1/skills/*` routes (mcMMO / AuraSkills).
|
|
686
867
|
*/
|
|
@@ -918,6 +1099,7 @@ declare class NoxAeApiSocket {
|
|
|
918
1099
|
|
|
919
1100
|
declare class NoxAeApiClient {
|
|
920
1101
|
readonly players: PlayersModule;
|
|
1102
|
+
readonly identity: IdentityModule;
|
|
921
1103
|
readonly economy: EconomyModule;
|
|
922
1104
|
readonly server: ServerModule;
|
|
923
1105
|
readonly worlds: WorldsModule;
|
|
@@ -1041,4 +1223,4 @@ declare class NoxAeApiNetworkError extends Error {
|
|
|
1041
1223
|
constructor(message: string, method: string, path: string, cause?: unknown);
|
|
1042
1224
|
}
|
|
1043
1225
|
|
|
1044
|
-
export { type Advancement, type CurrencyBalance, type CurrencyTopEntry, type EconomyInfo, type GroupInfo, type InventoryItem, type LeaderboardEntry, type LeaderboardSourceInfo, type NetworkBroadcastResponse, type NetworkFindPlayerResponse, type NetworkHealthResponse, type NetworkHealthServerEntry, type NetworkHubBroadcastResponse, type NetworkHubFindPlayerResponse, type NetworkHubNode, type NetworkHubPlayer, type NetworkHubPlayersResponse, type NetworkHubStatusResponse, type NetworkPlayersResponse, type NetworkPlayersServerEntry, type NetworkServerStatus, NoxAeApiClient, type NoxAeApiClientOptions, NoxAeApiError, NoxAeApiForbiddenError, NoxAeApiNetworkError, NoxAeApiNetworkHubClient, NoxAeApiNotFoundError, NoxAeApiRateLimitError, NoxAeApiServerError, NoxAeApiSocket, NoxAeApiUnauthorizedError, type NoxAeApiWsEvent, type NoxAeApiWsOptions, type NoxAuthPlayerInfo, type Objective, type OfflinePlayer, type OnlinePlayer, type PasswordCheckResult, type PermissionNode, type PlayerBalance, type PlayerProfile, type PlayerProfileBan, type PlayerProfileEconomy, type PlayerProfileStatTile, type PlayerProfileStatus, type PlayerProfilesResponse, type PlayerResolveResult, type PlayerStats, type Plugin, type RetryOptions, type Score, type Scoreboard, type ServerBan, type ServerHealth, type ServerInfo, type SkillInfo, type TopBalanceEntry, type WhitelistEntry, type World };
|
|
1226
|
+
export { type AddPermissionOptions, type Advancement, type CurrencyBalance, type CurrencyTopEntry, type EconomyInfo, type GroupInfo, type IdentityInfo, IdentityModule, type IdentityServerInfo, type InventoryItem, type LeaderboardEntry, type LeaderboardSourceInfo, type LuckPermsCheckPermissionResult, type LuckPermsContextOptions, type LuckPermsCreateGroupResult, type LuckPermsPrimaryGroupResult, type LuckPermsTrackActionResult, type MetaInfo, type NetworkBroadcastResponse, type NetworkFindPlayerResponse, type NetworkHealthResponse, type NetworkHealthServerEntry, type NetworkHubBroadcastResponse, type NetworkHubFindPlayerResponse, type NetworkHubNode, type NetworkHubPlayer, type NetworkHubPlayersResponse, type NetworkHubStatusResponse, type NetworkPlayersResponse, type NetworkPlayersServerEntry, type NetworkServerStatus, NoxAeApiClient, type NoxAeApiClientOptions, NoxAeApiError, NoxAeApiForbiddenError, NoxAeApiNetworkError, NoxAeApiNetworkHubClient, NoxAeApiNotFoundError, NoxAeApiRateLimitError, NoxAeApiServerError, NoxAeApiSocket, NoxAeApiUnauthorizedError, type NoxAeApiWsEvent, type NoxAeApiWsOptions, type NoxAuthPlayerInfo, type Objective, type OfflinePlayer, type OnlinePlayer, type PasswordCheckResult, type PermissionNode, type PlayerBalance, type PlayerProfile, type PlayerProfileBan, type PlayerProfileEconomy, type PlayerProfileStatTile, type PlayerProfileStatus, type PlayerProfilesResponse, type PlayerResolveResult, type PlayerStats, type Plugin, type RetryOptions, type Score, type Scoreboard, type ServerBan, type ServerHealth, type ServerInfo, type SetGroupOptions, type SetMetaValueOptions, type SkillInfo, type TopBalanceEntry, type TrackInfo, type WhitelistEntry, type World };
|