@wumx-labs/noxaeapi-sdk 0.4.2 → 0.5.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/README.md +8 -0
- package/dist/index.cjs +190 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +180 -33
- package/dist/index.d.ts +180 -33
- package/dist/index.js +190 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,6 +35,14 @@ const network = await client.network.statusAll();
|
|
|
35
35
|
// ban/whitelist status, Vault balance, and every leaderboard entry at once):
|
|
36
36
|
const { uuid } = await client.players.resolve("NoxlyDev");
|
|
37
37
|
const profile = await client.leaderboards.getPlayerProfile(uuid);
|
|
38
|
+
|
|
39
|
+
// LuckPerms (requires the plugin to be loaded on the target server):
|
|
40
|
+
await client.luckperms.setPlayerGroup(uuid, "vip");
|
|
41
|
+
await client.luckperms.addPlayerPermission(uuid, "essentials.fly", { expiry: "2026-12-31T00:00:00Z" });
|
|
42
|
+
const { has } = await client.luckperms.checkPlayerPermission(uuid, "essentials.fly");
|
|
43
|
+
await client.luckperms.promotePlayer(uuid, "default"); // moves them up the "default" track
|
|
44
|
+
const group = await client.luckperms.getGroupInfo("vip");
|
|
45
|
+
await client.luckperms.setGroupPrefix("vip", "&b[VIP] ");
|
|
38
46
|
```
|
|
39
47
|
|
|
40
48
|
### From environment variables
|
package/dist/index.cjs
CHANGED
|
@@ -652,26 +652,44 @@ var LuckPermsModule = class {
|
|
|
652
652
|
this.http = http;
|
|
653
653
|
}
|
|
654
654
|
http;
|
|
655
|
-
|
|
655
|
+
// ---------------------------------------------------------------
|
|
656
|
+
// Player permissions & groups
|
|
657
|
+
// ---------------------------------------------------------------
|
|
658
|
+
/** Get the names of every group a player belongs to (via inheritance nodes). */
|
|
656
659
|
getPlayerGroups(uuid) {
|
|
657
660
|
return this.http.request("GET", `luckperms/player/${encodeURIComponent(uuid)}/groups`);
|
|
658
661
|
}
|
|
659
|
-
/** Get
|
|
662
|
+
/** Get every node (permissions, inheritance, prefix/suffix, meta, ...) held directly by a player. */
|
|
660
663
|
getPlayerPermissions(uuid) {
|
|
661
664
|
return this.http.request(
|
|
662
665
|
"GET",
|
|
663
666
|
`luckperms/player/${encodeURIComponent(uuid)}/permissions`
|
|
664
667
|
);
|
|
665
668
|
}
|
|
666
|
-
/** Add a permission node to a player. */
|
|
667
|
-
addPlayerPermission(uuid, permission,
|
|
669
|
+
/** Add a permission node to a player. Defaults to a permanent, global, `true`-valued node. */
|
|
670
|
+
addPlayerPermission(uuid, permission, options = {}) {
|
|
668
671
|
return this.http.request(
|
|
669
672
|
"POST",
|
|
670
673
|
`luckperms/player/${encodeURIComponent(uuid)}/permission`,
|
|
671
|
-
{ body: { permission,
|
|
674
|
+
{ body: { permission, ...options } }
|
|
672
675
|
);
|
|
673
676
|
}
|
|
674
|
-
/**
|
|
677
|
+
/**
|
|
678
|
+
* Remove a permission node from a player by key. Note this matches on
|
|
679
|
+
* the permission string only — it does not target a specific
|
|
680
|
+
* value/expiry/context combination.
|
|
681
|
+
*/
|
|
682
|
+
removePlayerPermission(uuid, permission) {
|
|
683
|
+
return this.http.request(
|
|
684
|
+
"DELETE",
|
|
685
|
+
`luckperms/player/${encodeURIComponent(uuid)}/permission`,
|
|
686
|
+
{ body: { permission } }
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Check whether a player has a given permission, using LuckPerms'
|
|
691
|
+
* native resolution (inheritance, wildcards, contexts all apply).
|
|
692
|
+
*/
|
|
675
693
|
checkPlayerPermission(uuid, permission) {
|
|
676
694
|
return this.http.request(
|
|
677
695
|
"POST",
|
|
@@ -679,30 +697,105 @@ var LuckPermsModule = class {
|
|
|
679
697
|
{ body: { permission } }
|
|
680
698
|
);
|
|
681
699
|
}
|
|
682
|
-
/**
|
|
683
|
-
|
|
700
|
+
/** Get a player's primary group name. */
|
|
701
|
+
getPlayerPrimaryGroup(uuid) {
|
|
684
702
|
return this.http.request(
|
|
685
|
-
"
|
|
686
|
-
`luckperms/player/${encodeURIComponent(uuid)}/
|
|
687
|
-
{ body: { permission } }
|
|
703
|
+
"GET",
|
|
704
|
+
`luckperms/player/${encodeURIComponent(uuid)}/primary-group`
|
|
688
705
|
);
|
|
689
706
|
}
|
|
690
|
-
/**
|
|
691
|
-
|
|
707
|
+
/**
|
|
708
|
+
* Set a player's primary group. This both adds the corresponding
|
|
709
|
+
* inheritance node (so permissions actually resolve from the group) and
|
|
710
|
+
* updates the primary-group label — mirrors `/lp user <target> parent
|
|
711
|
+
* add <group>` plus `/lp user <target> setprimarygroup <group>`.
|
|
712
|
+
*/
|
|
713
|
+
setPlayerGroup(uuid, group, options = {}) {
|
|
692
714
|
return this.http.request(
|
|
693
715
|
"POST",
|
|
694
716
|
`luckperms/player/${encodeURIComponent(uuid)}/group`,
|
|
695
|
-
{ body: { group } }
|
|
717
|
+
{ body: { group, ...options } }
|
|
696
718
|
);
|
|
697
719
|
}
|
|
698
|
-
/**
|
|
720
|
+
/**
|
|
721
|
+
* Remove a group's inheritance node from a player. Does **not** change
|
|
722
|
+
* their primary group — call `setPlayerGroup()` with the new group
|
|
723
|
+
* afterward if you're reassigning rank rather than just removing one
|
|
724
|
+
* of several parents.
|
|
725
|
+
*/
|
|
699
726
|
removePlayerGroup(uuid, groupName) {
|
|
700
727
|
return this.http.request(
|
|
701
728
|
"DELETE",
|
|
702
729
|
`luckperms/player/${encodeURIComponent(uuid)}/group/${encodeURIComponent(groupName)}`
|
|
703
730
|
);
|
|
704
731
|
}
|
|
705
|
-
/**
|
|
732
|
+
/**
|
|
733
|
+
* Promote a player one step up a track. If the result isn't successful
|
|
734
|
+
* (e.g. `END_OF_TRACK`, `AMBIGUOUS_CALL`), the player's data is left
|
|
735
|
+
* untouched — check `.success`/`.status` on the result rather than
|
|
736
|
+
* assuming the call always moves them.
|
|
737
|
+
*/
|
|
738
|
+
promotePlayer(uuid, track, options = {}) {
|
|
739
|
+
return this.http.request(
|
|
740
|
+
"POST",
|
|
741
|
+
`luckperms/player/${encodeURIComponent(uuid)}/promote`,
|
|
742
|
+
{ body: { track, ...options } }
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
/** Demote a player one step down a track. See `promotePlayer()` for the result semantics. */
|
|
746
|
+
demotePlayer(uuid, track, options = {}) {
|
|
747
|
+
return this.http.request(
|
|
748
|
+
"POST",
|
|
749
|
+
`luckperms/player/${encodeURIComponent(uuid)}/demote`,
|
|
750
|
+
{ body: { track, ...options } }
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
// ---------------------------------------------------------------
|
|
754
|
+
// Player meta (prefix / suffix / custom meta)
|
|
755
|
+
// ---------------------------------------------------------------
|
|
756
|
+
/** Get a player's resolved prefix, suffix, and custom meta key-values. */
|
|
757
|
+
getPlayerMeta(uuid) {
|
|
758
|
+
return this.http.request("GET", `luckperms/player/${encodeURIComponent(uuid)}/meta`);
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Set a player's prefix. Behaves like a "set", not an "add" — any
|
|
762
|
+
* existing prefix node (in any context) is cleared first, so a player
|
|
763
|
+
* only ever has one active prefix from this call.
|
|
764
|
+
*/
|
|
765
|
+
setPlayerPrefix(uuid, prefix, options = {}) {
|
|
766
|
+
return this.http.request(
|
|
767
|
+
"POST",
|
|
768
|
+
`luckperms/player/${encodeURIComponent(uuid)}/meta/prefix`,
|
|
769
|
+
{ body: { prefix, ...options } }
|
|
770
|
+
);
|
|
771
|
+
}
|
|
772
|
+
/** Set a player's suffix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
773
|
+
setPlayerSuffix(uuid, suffix, options = {}) {
|
|
774
|
+
return this.http.request(
|
|
775
|
+
"POST",
|
|
776
|
+
`luckperms/player/${encodeURIComponent(uuid)}/meta/suffix`,
|
|
777
|
+
{ body: { suffix, ...options } }
|
|
778
|
+
);
|
|
779
|
+
}
|
|
780
|
+
/** Set a custom meta key-value pair on a player, replacing any existing value(s) for that key. */
|
|
781
|
+
setPlayerMeta(uuid, key, value, options = {}) {
|
|
782
|
+
return this.http.request(
|
|
783
|
+
"POST",
|
|
784
|
+
`luckperms/player/${encodeURIComponent(uuid)}/meta`,
|
|
785
|
+
{ body: { key, value, ...options } }
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
/** Remove a custom meta key from a player (all values/contexts for that key). */
|
|
789
|
+
removePlayerMeta(uuid, key) {
|
|
790
|
+
return this.http.request(
|
|
791
|
+
"DELETE",
|
|
792
|
+
`luckperms/player/${encodeURIComponent(uuid)}/meta/${encodeURIComponent(key)}`
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
// ---------------------------------------------------------------
|
|
796
|
+
// Groups
|
|
797
|
+
// ---------------------------------------------------------------
|
|
798
|
+
/** List the names of every group registered in LuckPerms. */
|
|
706
799
|
getGroups() {
|
|
707
800
|
return this.http.request("GET", "luckperms/groups");
|
|
708
801
|
}
|
|
@@ -721,10 +814,90 @@ var LuckPermsModule = class {
|
|
|
721
814
|
deleteGroup(name) {
|
|
722
815
|
return this.http.request("DELETE", `luckperms/group/${encodeURIComponent(name)}`);
|
|
723
816
|
}
|
|
724
|
-
/** Get
|
|
817
|
+
/** Get every node held directly by a group. */
|
|
725
818
|
getGroupPermissions(name) {
|
|
726
819
|
return this.http.request("GET", `luckperms/group/${encodeURIComponent(name)}/permissions`);
|
|
727
820
|
}
|
|
821
|
+
/** Add a permission node to a group. Same options/defaults as `addPlayerPermission()`. */
|
|
822
|
+
addGroupPermission(name, permission, options = {}) {
|
|
823
|
+
return this.http.request(
|
|
824
|
+
"POST",
|
|
825
|
+
`luckperms/group/${encodeURIComponent(name)}/permission`,
|
|
826
|
+
{ body: { permission, ...options } }
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
/** Remove a permission node from a group by key (matches on permission string only). */
|
|
830
|
+
removeGroupPermission(name, permission) {
|
|
831
|
+
return this.http.request(
|
|
832
|
+
"DELETE",
|
|
833
|
+
`luckperms/group/${encodeURIComponent(name)}/permission`,
|
|
834
|
+
{ body: { permission } }
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
/** Get full info for a group: name, display name, weight, and all its nodes. */
|
|
838
|
+
getGroupInfo(name) {
|
|
839
|
+
return this.http.request("GET", `luckperms/group/${encodeURIComponent(name)}`);
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Update a group's weight and/or display name. Provide at least one of
|
|
843
|
+
* the two fields — the server 400s otherwise. Passing an empty/blank
|
|
844
|
+
* `displayName` resets it to the default rather than setting a blank one.
|
|
845
|
+
* Returns the group's full updated info.
|
|
846
|
+
*/
|
|
847
|
+
updateGroup(name, updates) {
|
|
848
|
+
return this.http.request("PUT", `luckperms/group/${encodeURIComponent(name)}`, {
|
|
849
|
+
body: updates
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
// ---------------------------------------------------------------
|
|
853
|
+
// Group meta (prefix / suffix / custom meta)
|
|
854
|
+
// ---------------------------------------------------------------
|
|
855
|
+
/** Get a group's resolved prefix, suffix, and custom meta key-values. */
|
|
856
|
+
getGroupMeta(name) {
|
|
857
|
+
return this.http.request("GET", `luckperms/group/${encodeURIComponent(name)}/meta`);
|
|
858
|
+
}
|
|
859
|
+
/** Set a group's prefix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
860
|
+
setGroupPrefix(name, prefix, options = {}) {
|
|
861
|
+
return this.http.request(
|
|
862
|
+
"POST",
|
|
863
|
+
`luckperms/group/${encodeURIComponent(name)}/meta/prefix`,
|
|
864
|
+
{ body: { prefix, ...options } }
|
|
865
|
+
);
|
|
866
|
+
}
|
|
867
|
+
/** Set a group's suffix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
868
|
+
setGroupSuffix(name, suffix, options = {}) {
|
|
869
|
+
return this.http.request(
|
|
870
|
+
"POST",
|
|
871
|
+
`luckperms/group/${encodeURIComponent(name)}/meta/suffix`,
|
|
872
|
+
{ body: { suffix, ...options } }
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
/** Set a custom meta key-value pair on a group, replacing any existing value(s) for that key. */
|
|
876
|
+
setGroupMeta(name, key, value, options = {}) {
|
|
877
|
+
return this.http.request(
|
|
878
|
+
"POST",
|
|
879
|
+
`luckperms/group/${encodeURIComponent(name)}/meta`,
|
|
880
|
+
{ body: { key, value, ...options } }
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
/** Remove a custom meta key from a group (all values/contexts for that key). */
|
|
884
|
+
removeGroupMeta(name, key) {
|
|
885
|
+
return this.http.request(
|
|
886
|
+
"DELETE",
|
|
887
|
+
`luckperms/group/${encodeURIComponent(name)}/meta/${encodeURIComponent(key)}`
|
|
888
|
+
);
|
|
889
|
+
}
|
|
890
|
+
// ---------------------------------------------------------------
|
|
891
|
+
// Tracks (rank ladders — promote/demote)
|
|
892
|
+
// ---------------------------------------------------------------
|
|
893
|
+
/** List the names of every track registered in LuckPerms. */
|
|
894
|
+
getTracks() {
|
|
895
|
+
return this.http.request("GET", "luckperms/tracks");
|
|
896
|
+
}
|
|
897
|
+
/** Get a track's name and its ordered list of groups (lowest to highest rank). */
|
|
898
|
+
getTrack(name) {
|
|
899
|
+
return this.http.request("GET", `luckperms/track/${encodeURIComponent(name)}`);
|
|
900
|
+
}
|
|
728
901
|
};
|
|
729
902
|
|
|
730
903
|
// src/modules/noxauth.ts
|