Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82466c2e5d | ||
|
|
c598daf350 | ||
|
|
a40421fa1f | ||
|
|
d98b464ce9 | ||
|
|
1d5e3205ac | ||
|
|
07eb17f5d5 | ||
|
|
3951725852 | ||
|
|
77956d69ad | ||
|
|
5784458d03 | ||
|
|
3d2115ff3c | ||
|
|
8618a67e2e | ||
|
|
234b9cafd7 | ||
|
|
4ecd899bac | ||
|
|
ce2c943397 | ||
|
|
51898abb71 | ||
|
|
e2f800dd63 | ||
|
|
d9e5bc9345 | ||
|
|
e42cc101cc | ||
|
|
845367e847 | ||
|
|
90afd3c3ed | ||
|
|
b4aeb04d1b | ||
|
|
65b0d45738 | ||
|
|
3c44388883 | ||
|
|
400f3a9156 | ||
|
|
ad6e837aa5 | ||
|
|
cadd7545c5 | ||
|
|
b41dea9ee1 | ||
|
|
7a6c0ab154 | ||
|
|
1bb1f5ebb3 | ||
|
|
fce5b8430d | ||
|
|
0befa6a491 | ||
|
|
b12ce943f7 | ||
|
|
d23b29aeb1 | ||
|
|
42d48c8da2 | ||
|
|
9e83a5e4d9 | ||
|
|
d2bf940105 | ||
|
|
7d4aca68cc | ||
|
|
d7094909c0 | ||
|
|
7083d55a9b | ||
|
|
770db2fee0 | ||
|
|
b8e65c4f26 | ||
|
|
5cd5186092 | ||
|
|
fa0b66c2dc | ||
|
|
1b199fd2c7 | ||
|
|
2ffbeeef8e | ||
|
|
26ce8b8ab7 | ||
|
|
8e224c4a27 | ||
|
|
cf5318b92b | ||
|
|
e50fa17f7c | ||
|
|
8766e3b408 | ||
|
|
c4c7f06d83 | ||
|
|
413e304845 | ||
|
|
046daf23d0 | ||
|
|
c57947949c | ||
|
|
0acefde805 | ||
|
|
a9e751b4b8 | ||
|
|
3df1ae8ded | ||
|
|
b4a2da0ea8 | ||
|
|
5c5d1e8d0a | ||
|
|
ff0c988a1d | ||
|
|
b9fc8f4b5f | ||
|
|
2ecaa39cb6 | ||
|
|
7b8654339c | ||
|
|
306e252c31 | ||
|
|
87c3bd6293 | ||
|
|
307beebb58 | ||
|
|
4109863aa9 | ||
|
|
0febdbe3a4 | ||
|
|
139dd5302b | ||
|
|
cc907b6530 | ||
|
|
ca1dacf2b6 |
No files matched your search
+458
-10
@@ -13,6 +13,7 @@ loading-error: "Permissions data could not be loaded. Please try again later."
|
||||
op-disabled: "&bThe vanilla OP system is disabled on this server."
|
||||
op-disabled-sponge: "&2Server Operator status has no effect when a permission plugin is installed. Please edit user data directly."
|
||||
log: "&3LOG &3&l> {0}"
|
||||
verbose-log: "&3VERBOSE &3&l> {0}"
|
||||
export-log: "&3EXPORT &3&l> &f{0}"
|
||||
export-log-progress: "&3EXPORT &3&l> &7{0}"
|
||||
migration-log: "&3MIGRATION &7[&3{0}&7] &3&l> &f{1}"
|
||||
@@ -56,6 +57,16 @@ search-showing-users: "&bShowing user entries:"
|
||||
search-showing-groups: "&bShowing group entries:"
|
||||
search-showing-users-with-page: "&bShowing user entries: {0}"
|
||||
search-showing-groups-with-page: "&bShowing group entries: {0}"
|
||||
apply-edits-invalid-code: "&aInvalid code. &7({0})"
|
||||
apply-edits-unable-to-read: "&aUnable to read data using the given code. &7({0})"
|
||||
apply-edits-no-target: "&aUnable to parse the target of the edit. Please supply it as an extra argument."
|
||||
apply-edits-target-group-not-exists: "&aTarget group &b{0}&a does not exist."
|
||||
apply-edits-target-user-not-uuid: "&aTarget user &b{0}&a is not a valid uuid."
|
||||
apply-edits-target-user-unable-to-load: "&aUnable to load target user &b{0}&a."
|
||||
apply-edits-target-unknown: "&aInvalid target. &7({0})"
|
||||
apply-edits-success: "&aSuccessfully applied &b{0}&a nodes to &b{1}&a."
|
||||
editor-upload-failure: "&cUnable to upload permission data to the editor."
|
||||
editor-url: "&aEditor URL:"
|
||||
check-result: "&aPermission check result on user &b{0}&a for permission &b{1}&a: &f{2}"
|
||||
create-success: "&b{0}&a was successfully created."
|
||||
delete-success: "&b{0}&a was successfully deleted."
|
||||
@@ -115,21 +126,18 @@ info: >
|
||||
create-group-error: "There was an error whilst creating the group."
|
||||
delete-group-error: "There was an error whilst deleting the group."
|
||||
delete-group-error-default: "You cannot delete the default group."
|
||||
groups-list: "&aGroups: {0}"
|
||||
groups-list: "&aGroups: &7(name, weight, tracks)"
|
||||
groups-list-entry: "&f- &3{0} &7- &b{1}"
|
||||
groups-list-entry-with-tracks: "&f- &3{0} &7- &b{1} &7- [&3{2}&7]"
|
||||
create-track-error: "There was an error whilst creating the track."
|
||||
delete-track-error: "There was an error whilst deleting the track."
|
||||
tracks-list: "&aTracks: {0}"
|
||||
listnodes: "&b{0}'s Nodes:"
|
||||
listnodes-with-page: "&b{0}'s Nodes: {1}"
|
||||
listnodes-temp: >
|
||||
&b{0}'s Temporary Nodes:\n
|
||||
{1}
|
||||
listparents: >
|
||||
&b{0}'s Parent Groups:\n
|
||||
{1}
|
||||
listparents-temp: >
|
||||
&b{0}'s Temporary Parent Groups:\n
|
||||
{1}
|
||||
listnodes-temp: "&b{0}'s Temporary Nodes:"
|
||||
listnodes-temp-with-page: "&b{0}'s Temporary Nodes: {1}"
|
||||
listparents: "&b{0}'s Parent Groups:"
|
||||
listparents-temp: "&b{0}'s Temporary Parent Groups:"
|
||||
list-tracks: >
|
||||
&b{0}'s Tracks:\n
|
||||
{1}
|
||||
@@ -288,3 +296,443 @@ import-end-error-header: >
|
||||
{PREFIX}&b(Import) &fOutput:
|
||||
import-end-error-content: "&b(Import) &b-> &c{0}"
|
||||
import-end-error-footer: "&b(Import) &7<------------------------------------------>"
|
||||
|
||||
command-specs:
|
||||
user:
|
||||
description: "User commands"
|
||||
usage: "/%s user <user>"
|
||||
group:
|
||||
description: "Group commands"
|
||||
usage: "/%s group <group>"
|
||||
track:
|
||||
description: "Track commands"
|
||||
usage: "/%s track <track>"
|
||||
log:
|
||||
description: "Log commands"
|
||||
usage: "/%s log"
|
||||
sync:
|
||||
description: "Sync changes with the storage"
|
||||
usage: "/%s sync"
|
||||
info:
|
||||
description: "Print general plugin info"
|
||||
usage: "/%s info"
|
||||
verbose:
|
||||
description: "Manage verbose permission checking"
|
||||
usage: "/%s verbose <true|false> [filter]"
|
||||
args:
|
||||
"on|record|off|paste": "whether to enable/disable logging, or to paste the logged output"
|
||||
"filter": "the filter to match entries against"
|
||||
tree:
|
||||
description: "Generate a tree view of permissions"
|
||||
usage: "/%s tree [selection] [max level] [player]"
|
||||
args:
|
||||
"selection": "the root of the tree. specify \".\" to include all permissions"
|
||||
"max level": "how many branch levels should be returned"
|
||||
"player": "the name of an online player to check against"
|
||||
search:
|
||||
description: "Search for users/groups with a specific permission"
|
||||
usage: "/%s search <permission>"
|
||||
args:
|
||||
"permission": "the permission to search for"
|
||||
"page": "the page to view"
|
||||
check:
|
||||
description: "Perform a standard permission check on an online player"
|
||||
usage: "/%s check <user> <permission>"
|
||||
args:
|
||||
"user": "the user to check"
|
||||
"permission": "the permission to check for"
|
||||
network-sync:
|
||||
description: "Sync changes with the storage and request that all other servers on the network do the same"
|
||||
usage: "/%s networksync"
|
||||
import:
|
||||
description: "Import data from a file"
|
||||
usage: "/%s import <file>"
|
||||
args:
|
||||
"file": "the file to import from"
|
||||
export:
|
||||
description: "Export data to a file"
|
||||
usage: "/%s export <file>"
|
||||
args:
|
||||
"file": "the file to export to"
|
||||
reload-config:
|
||||
description: "Reload some of the config options"
|
||||
usage: "/%s reloadconfig"
|
||||
bulk-update:
|
||||
description: "Execute bulk change queries on all data"
|
||||
usage: "/%s bulkupdate"
|
||||
args:
|
||||
"data type": "the type of data being changed. ('all', 'users' or 'groups')"
|
||||
"action": "the action to perform on the data. ('update' or 'delete')"
|
||||
"action field": "the field to act upon. only required for 'update'. ('permission', 'server' or 'world')"
|
||||
"action value": "the value to replace with. only required for 'update'."
|
||||
"constraint...": "the constraints required for the update"
|
||||
migration:
|
||||
description: "Migration commands"
|
||||
usage: "/%s migration"
|
||||
apply-edits:
|
||||
description: "Applies permission changes made from the web editor"
|
||||
usage: "/%s applyedits <code> [target]"
|
||||
args:
|
||||
"code": "the unique code for the data"
|
||||
"target": "who to apply the data to"
|
||||
create-group:
|
||||
description: "Create a new group"
|
||||
usage: "/%s creategroup <group>"
|
||||
args:
|
||||
"name": "the name of the group"
|
||||
delete-group:
|
||||
description: "Delete a group"
|
||||
usage: "/%s deletegroup <group>"
|
||||
args:
|
||||
"name": "the name of the group"
|
||||
list-groups:
|
||||
description: "List all groups on the platform"
|
||||
usage: "/%s listgroups"
|
||||
create-track:
|
||||
description: "Create a new track"
|
||||
usage: "/%s createtrack <track>"
|
||||
args:
|
||||
"name": "the name of the track"
|
||||
delete-track:
|
||||
description: "Delete a track"
|
||||
usage: "/%s deletetrack <track>"
|
||||
args:
|
||||
"name": "the name of the track"
|
||||
list-tracks:
|
||||
description: "List all tracks on the platform"
|
||||
usage: "/%s listtracks"
|
||||
user-info:
|
||||
description: "Shows info about the user"
|
||||
user-switchprimarygroup:
|
||||
description: "Switches the user's primary group"
|
||||
args:
|
||||
"group": "the group to switch to"
|
||||
user-promote:
|
||||
description: "Promotes the user up a track"
|
||||
args:
|
||||
"track": "the track to promote the user up"
|
||||
"context...": "the contexts to promote the user in"
|
||||
user-demote:
|
||||
description: "Demotes the user down a track"
|
||||
args:
|
||||
"track": "the track to demote the user down"
|
||||
"context...": "the contexts to demote the user in"
|
||||
group-info:
|
||||
description: "Gives info about the group"
|
||||
group-listmembers:
|
||||
description: "Show the users/groups who inherit from this group"
|
||||
args:
|
||||
"page": "the page to view"
|
||||
group-setweight:
|
||||
description: "Set the groups weight"
|
||||
args:
|
||||
"weight": "the weight to set"
|
||||
group-rename:
|
||||
description: "Rename the group"
|
||||
args:
|
||||
"name": "the new name"
|
||||
group-clone:
|
||||
description: "Clone the group"
|
||||
args:
|
||||
"name": "the name of the group to clone onto"
|
||||
holder-editor:
|
||||
description: "Opens the web permission editor"
|
||||
holder-showtracks:
|
||||
description: "Lists the tracks that the object is on"
|
||||
holder-clear:
|
||||
description: "Removes all permissions, parents and meta"
|
||||
args:
|
||||
"context...": "the contexts to filter by"
|
||||
permission:
|
||||
description: "Edit permissions"
|
||||
parent:
|
||||
description: "Edit inheritances"
|
||||
meta:
|
||||
description: "Edit metadata values"
|
||||
permission-info:
|
||||
description: "Lists the permission nodes the object has"
|
||||
args:
|
||||
"page": "the page to view"
|
||||
"filter": "the string to filter by"
|
||||
permission-set:
|
||||
description: "Sets a permission for the object"
|
||||
args:
|
||||
"node": "the permission node to set"
|
||||
"true|false": "the value of the node"
|
||||
"context...": "the contexts to add the permission in"
|
||||
permission-unset:
|
||||
description: "Unsets a permission for the object"
|
||||
args:
|
||||
"node": "the permission node to unset"
|
||||
"context...": "the contexts to remove the permission in"
|
||||
permission-settemp:
|
||||
description: "Sets a permission for the object temporarily"
|
||||
args:
|
||||
"node": "the permission node to set"
|
||||
"true|false": "the value of the node"
|
||||
"duration": "the duration until the permission node expires"
|
||||
"context...": "the contexts to add the permission in"
|
||||
permission-unsettemp:
|
||||
description: "Unsets a temporary permission for the object"
|
||||
args:
|
||||
"node": "the permission node to unset"
|
||||
"context...": "the contexts to remove the permission in"
|
||||
permission-check:
|
||||
description: "Checks to see if the object has a certain permission node"
|
||||
args:
|
||||
"node": "the permission node to check for"
|
||||
"context...": "the contexts to check in"
|
||||
permission-check-inherits:
|
||||
description: "Checks to see if the object inherits a certain permission node"
|
||||
args:
|
||||
"node": "the permission node to check for"
|
||||
"context...": "the contexts to check in"
|
||||
parent-info:
|
||||
description: "Lists the groups that this object inherits from"
|
||||
parent-set:
|
||||
description: "Removes all other groups the object inherits already and adds them to the one given"
|
||||
args:
|
||||
"group": "the group to set to"
|
||||
"context...": "the contexts to set the group in"
|
||||
parent-add:
|
||||
description: "Sets another group for the object to inherit permissions from"
|
||||
args:
|
||||
"group": "the group to inherit from"
|
||||
"context...": "the contexts to inherit the group in"
|
||||
parent-remove:
|
||||
description: "Removes a previously set inheritance rule"
|
||||
args:
|
||||
"group": "the group to remove"
|
||||
"context...": "the contexts to remove the group in"
|
||||
parent-set-track:
|
||||
description: "Removes all other groups the object inherits from already on the given track and adds them to the one given"
|
||||
args:
|
||||
"track": "the track to set on"
|
||||
"group": "the group to set to, or a number relating to the position of the group on the given track"
|
||||
"context...": "the contexts to set the group in"
|
||||
parent-add-temp:
|
||||
description: "Sets another group for the object to inherit permissions from temporarily"
|
||||
args:
|
||||
"group": "the group to inherit from"
|
||||
"duration": "the duration of the group membership"
|
||||
"context...": "the contexts to inherit the group in"
|
||||
parent-remove-temp:
|
||||
description: "Removes a previously set temporary inheritance rule"
|
||||
args:
|
||||
"group": "the group to remove"
|
||||
"context...": "the contexts to remove the group in"
|
||||
parent-clear:
|
||||
description: "Clears all parents"
|
||||
args:
|
||||
"context...": "the contexts to filter by"
|
||||
parent-clear-track:
|
||||
description: "Clears all parents on a given track"
|
||||
args:
|
||||
"track": "the track to remove on"
|
||||
"context...": "the contexts to filter by"
|
||||
meta-info:
|
||||
description: "Shows all chat meta"
|
||||
meta-set:
|
||||
description: "Sets a meta value"
|
||||
args:
|
||||
"key": "the key to set"
|
||||
"value": "the value to set"
|
||||
"context...": "the contexts to add the meta pair in"
|
||||
meta-unset:
|
||||
description: "Unsets a meta value"
|
||||
args:
|
||||
"key": "the key to unset"
|
||||
"context...": "the contexts to remove the meta pair in"
|
||||
meta-settemp:
|
||||
description: "Sets a meta value temporarily"
|
||||
args:
|
||||
"key": "the key to set"
|
||||
"value": "the value to set"
|
||||
"duration": "the duration until the meta value expires"
|
||||
"context...": "the contexts to add the meta pair in"
|
||||
meta-unsettemp:
|
||||
description: "Unsets a temporary meta value"
|
||||
args:
|
||||
"key": "the key to unset"
|
||||
"context...": "the contexts to remove the meta pair in"
|
||||
meta-addprefix:
|
||||
description: "Adds a prefix"
|
||||
args:
|
||||
"priority": "the priority to add the prefix at"
|
||||
"prefix": "the prefix string"
|
||||
"context...": "the contexts to add the prefix in"
|
||||
meta-addsuffix:
|
||||
description: "Adds a suffix"
|
||||
args:
|
||||
"priority": "the priority to add the suffix at"
|
||||
"suffix": "the suffix string"
|
||||
"context...": "the contexts to add the suffix in"
|
||||
meta-removeprefix:
|
||||
description: "Removes a prefix"
|
||||
args:
|
||||
"priority": "the priority to remove the prefix at"
|
||||
"prefix": "the prefix string"
|
||||
"context...": "the contexts to remove the prefix in"
|
||||
meta-removesuffix:
|
||||
description: "Removes a suffix"
|
||||
args:
|
||||
"priority": "the priority to remove the suffix at"
|
||||
"suffix": "the suffix string"
|
||||
"context...": "the contexts to remove the suffix in"
|
||||
meta-addtemp-prefix:
|
||||
description: "Adds a prefix temporarily"
|
||||
args:
|
||||
"priority": "the priority to add the prefix at"
|
||||
"prefix": "the prefix string"
|
||||
"duration": "the duration until the prefix expires"
|
||||
"context...": "the contexts to add the prefix in"
|
||||
meta-addtemp-suffix:
|
||||
description: "Adds a suffix temporarily"
|
||||
args:
|
||||
"priority": "the priority to add the suffix at"
|
||||
"suffix": "the suffix string"
|
||||
"duration": "the duration until the suffix expires"
|
||||
"context...": "the contexts to add the suffix in"
|
||||
meta-removetemp-prefix:
|
||||
description: "Removes a temporary prefix"
|
||||
args:
|
||||
"priority": "the priority to remove the prefix at"
|
||||
"prefix": "the prefix string"
|
||||
"context...": "the contexts to remove the prefix in"
|
||||
meta-removetemp-suffix:
|
||||
description: "Removes a temporary suffix"
|
||||
args:
|
||||
"priority": "the priority to remove the suffix at"
|
||||
"suffix": "the suffix string"
|
||||
"context...": "the contexts to remove the suffix in"
|
||||
meta-clear:
|
||||
description: "Clears all chat meta"
|
||||
args:
|
||||
"context...": "the contexts to filter by"
|
||||
track-info:
|
||||
description: "Gives info about the track"
|
||||
track-append:
|
||||
description: "Appends a group onto the end of the track"
|
||||
args:
|
||||
"group": "the group to append"
|
||||
track-insert:
|
||||
description: "Inserts a group at a given position along the track"
|
||||
args:
|
||||
"group": "the group to insert"
|
||||
"position": "the position to insert the group at (the first position on the track is 1)"
|
||||
track-remove:
|
||||
description: "Removes a group from the track"
|
||||
args:
|
||||
"group": "the group to remove"
|
||||
track-clear:
|
||||
description: "Clears the groups on the track"
|
||||
track-rename:
|
||||
description: "Rename the track"
|
||||
args:
|
||||
"name": "the new name"
|
||||
track-clone:
|
||||
description: "Clone the track"
|
||||
args:
|
||||
"name": "the name of the track to clone onto"
|
||||
log-recent:
|
||||
description: "View recent actions"
|
||||
args:
|
||||
"user": "the name/uuid of the user to filter by"
|
||||
"page": "the page number to view"
|
||||
log-search:
|
||||
description: "Search the log for an entry"
|
||||
args:
|
||||
"query": "the query to search by"
|
||||
"page": "the page number to view"
|
||||
log-notify:
|
||||
description: "Toggle log notifications"
|
||||
args:
|
||||
"on|off": "whether to toggle on or off"
|
||||
log-user-history:
|
||||
description: "View a user's history"
|
||||
args:
|
||||
"user": "the name/uuid of the user"
|
||||
"page": "the page number to view"
|
||||
log-group-history:
|
||||
description: "View an group's history"
|
||||
args:
|
||||
"group": "the name of the group"
|
||||
"page": "the page number to view"
|
||||
log-track-history:
|
||||
description: "View a track's history"
|
||||
args:
|
||||
"track": "the name of the track"
|
||||
"page": "the page number to view"
|
||||
sponge:
|
||||
description: "Edit extra Sponge data"
|
||||
usage: "/%s sponge <collection> <subject>"
|
||||
args:
|
||||
"collection": "the collection to query"
|
||||
"subject": "the subject to modify"
|
||||
sponge-permission-info:
|
||||
description: "Shows info about the subject's permissions"
|
||||
args:
|
||||
"contexts...": "the contexts to filter by"
|
||||
sponge-permission-set:
|
||||
description: "Sets a permission for the Subject"
|
||||
args:
|
||||
"node": "the permission node to set"
|
||||
"tristate": "the value to set the permission to"
|
||||
"contexts...": "the contexts to set the permission in"
|
||||
sponge-permission-clear:
|
||||
description: "Clears the Subjects permissions"
|
||||
args:
|
||||
"contexts...": "the contexts to clear permissions in"
|
||||
sponge-parent-info:
|
||||
description: "Shows info about the subject's parents"
|
||||
args:
|
||||
"contexts...": "the contexts to filter by"
|
||||
sponge-parent-add:
|
||||
description: "Adds a parent to the Subject"
|
||||
args:
|
||||
"collection": "the subject collection where the parent Subject is"
|
||||
"subject": "the name of the parent Subject"
|
||||
"contexts...": "the contexts to add the parent in"
|
||||
sponge-parent-remove:
|
||||
description: "Removes a parent from the Subject"
|
||||
args:
|
||||
"collection": "the subject collection where the parent Subject is"
|
||||
"subject": "the name of the parent Subject"
|
||||
"contexts...": "the contexts to remove the parent in"
|
||||
sponge-parent-clear:
|
||||
description: "Clears the Subjects parents"
|
||||
args:
|
||||
"contexts...": "the contexts to clear parents in"
|
||||
sponge-option-info:
|
||||
description: "Shows info about the subject's options"
|
||||
args:
|
||||
"contexts...": "the contexts to filter by"
|
||||
sponge-option-set:
|
||||
description: "Sets an option for the Subject"
|
||||
args:
|
||||
"key": "the key to set"
|
||||
"value": "the value to set the key to"
|
||||
"contexts...": "the contexts to set the option in"
|
||||
sponge-option-unset:
|
||||
description: "Unsets an option for the Subject"
|
||||
args:
|
||||
"key": "the key to unset"
|
||||
"contexts...": "the contexts to unset the key in"
|
||||
sponge-option-clear:
|
||||
description: "Clears the Subjects options"
|
||||
args:
|
||||
"contexts...": "the contexts to clear options in"
|
||||
migration-command:
|
||||
description: "Migration command"
|
||||
migration-groupmanager:
|
||||
description: "Migration command"
|
||||
args:
|
||||
"migrate as global": "if world permissions should be ignored, and just migrated as global"
|
||||
migration-powerfulperms:
|
||||
description: "Migration command"
|
||||
args:
|
||||
"address": "the address of the PP database"
|
||||
"database": "the name of the PP database"
|
||||
"username": "the username to log into the DB"
|
||||
"password": "the password to log into the DB"
|
||||
"db table": "the name of the PP table where player data is stored"
|
||||
@@ -0,0 +1,290 @@
|
||||
# LuckPerms Language File
|
||||
# Locale: pl_PL (Polish)
|
||||
# Author: dzegarek
|
||||
|
||||
prefix: "&7&l[&b&lL&3&lP&7&l] &c"
|
||||
log-info: "&7&l[&bL&3P&7&l] &3{0}"
|
||||
log-warn: "&7&l[&bLuck&3Perms&7&l] &c[UWAGA] {0}"
|
||||
log-error: "&7&l[&bLuck&3Perms&7&l] &4[BŁĄD] {0}"
|
||||
empty: "{0}"
|
||||
player-online: "&aOnline"
|
||||
player-offline: "&cOffline"
|
||||
loading-error: "Nie można załadować danych uprawnień. Spróbuj ponownie później."
|
||||
op-disabled: "&bSystem vanilla OP jest wyłączony na tym serwerze."
|
||||
op-disabled-sponge: "&2Stan operatora serwera nie ma wpływu na instalację wtyczki uprawnień. Proszę bezpośrednio edytować dane użytkownika."
|
||||
log: "&3LOG &3&l> {0}"
|
||||
export-log: "&3Eksport &3&l> &f{0}"
|
||||
export-log-progress: "&3Eksport &3&l> &7{0}"
|
||||
migration-log: "&3MIGRACJA &7[&3{0}&7] &3&l> &f{1}"
|
||||
migration-log-progress: "&3MIGRACJA &7[&3{0}&7] &3&l> &7{1}"
|
||||
command-not-recognised: "Komenda nie została rozpoznana."
|
||||
command-no-permission: "Nie masz uprawnień do korzystania z tego polecenia!"
|
||||
already-haspermission: "{0} ma już to uprawnienie!"
|
||||
does-not-havepermission: "{0} nie ma tego zestawu uprawnień."
|
||||
already-has-temp-permission: "{0} ma już tymczasowo uprawnienie!"
|
||||
does-not-have-temp-permission: "{0} nie ma tymczasowego zezwolenia."
|
||||
user-not-found: "&bNie można znaleźć użytkownika."
|
||||
user-not-online: "&bUżytkownik &a{0}&b nie jest online."
|
||||
user-save-success: "&7(Dane użytkownika zostały zapisane w pamięci)"
|
||||
user-save-error: "Podczas zapisywania użytkownika wystąpił błąd."
|
||||
group-not-found: "&bNie można odnaleźć grupy."
|
||||
group-save-success: "&7(Dane grupy zostały zapisane w pamięci)"
|
||||
group-save-error: "Podczas zapisywania grupy wystąpił błąd."
|
||||
track-not-found: "&bŚcieżka nie została odnaleziona."
|
||||
track-save-success: "&7(Dane ścieżki zostały zapisane w pamięci)"
|
||||
track-save-error: "Podczas zapisywania ścieżki wystąpił błąd."
|
||||
user-invalid-entry: "&d{0}&c nie jest poprawną nazwą użytkownika/uuid."
|
||||
group-invalid-entry: "Nazwy grup mogą zawierać tylko znaki alfanumeryczne."
|
||||
track-invalid-entry: "Nazwy dróg mogą zawierać tylko znaki alfanumeryczne."
|
||||
server-world-invalid-entry: "Nazwy serwerów/świata mogą zawierać znaki alfanumeryczne, ale nie mogą przekraczać 36 znaków."
|
||||
use-inherit-command: "Użyj komendy 'parent add' lub 'parent remove' zamiast określenia węzła."
|
||||
verbose-invalid-filter: "&cNieprawidłowy szczegółowy filtr: &f{0}"
|
||||
verbose-on: "&bZapis szczegółowych plików wyjściowych ustawiony jest na & aTRUE & bdla wszystkich uprawnień."
|
||||
verbose-on-query: "&bZapis szczegółowych plików wyjściowych ustawiony jest na & aTRUE & bdla wszystkich pasujących do filtra: &f{0}"
|
||||
verbose-off: "&bZapis szczegółowych plików wyjściowych jest ustawiony na &cFALSE&b."
|
||||
verbose-recording-on: "&bVerbose recording set to &aTRUE &bfor all permissions."
|
||||
verbose-recording-on-query: "&bZapis szczegółowych zapisów jest ustawiony na &aTRUE &bdla wszystkich uprawnień pasujących do filtra: &f{0}"
|
||||
verbose-recording-upload-start: "&Zapis szczegółowych zapisów został wyłączony. Przesyłanie wyników..."
|
||||
verbose-recording-url: "&aSzczegółowe URL wyników:"
|
||||
tree-upload-start: "&bGenerowanie drzewa uprawnień..."
|
||||
tree-empty: "&aNie można wygenerować drzewa. Nie znaleziono żadnych wyników."
|
||||
tree-url: "&aURL drzewa uprawnień:"
|
||||
search-searching: "&aPoszukiwanie użytkowników i grup &b{0}&a..."
|
||||
search-searching-members: "&aWyszukiwanie użytkowników i grup, które dziedziczą &b{0}&a..."
|
||||
search-result: "&aZnaleziono &b{0}&a wpisy z &b{1}&a użytkowników i &b{2}&a grup."
|
||||
search-showing-users: "&bWyświetlanie wpisów użytkownika:"
|
||||
search-showing-groups: "&bWyświetlanie wpisów grup:"
|
||||
search-showing-users-with-page: "&bWyświetlanie wpisów użytkownika: {0}"
|
||||
search-showing-groups-with-page: "&bWyświetlanie wpisów grup: {0}"
|
||||
check-result: "&aWynik sprawdzenia uprawnień dla użytkownika &b{0}&a dla uprawnień &b{1}&a: &f{2}"
|
||||
create-success: "&b{0}&a został pomyślnie utworzone."
|
||||
delete-success: "&b{0}&a został pomyślnie usunięty."
|
||||
rename-success: "&b{0}&a został pomyślnie zmieniony na &b{1}&a."
|
||||
clone-success: "&b{0}&a został pomyślnie sklonowany na &b{1}&a."
|
||||
already-inherits: "{0} już dziedziczy '{1}'."
|
||||
does-not-inherit: "{0} nie dziedziczy '{1}'."
|
||||
already-temp-inherits: "{0} już tymczasowo dziedziczy '{1}'."
|
||||
does-not-temp-inherit: "{0} nie dziedziczy tymczasowo '{1}'."
|
||||
track-already-contains: "Ścieżka {0} zawiera już grupę '{1}'."
|
||||
track-does-not-contain: "Ścieżka {0} nie zawiera tej grupy '{1}'."
|
||||
track-ambiguous-call: "Podany użytkownik jest członkiem wielu grup na tej ścieżce. Nie można określić ich lokalizacji."
|
||||
group-already-exists: "Ta grupa już istnieje!"
|
||||
group-does-not-exist: "Ta grupa nie istnieje!"
|
||||
group-load-error: "Wystąpił nieoczekiwany błąd. Grupa nie została załadowana."
|
||||
groups-load-error: "Wystąpił nieoczekiwany błąd. Nie można załadować wszystkich grup."
|
||||
track-already-exists: "Ta ścieżka już istnieje!"
|
||||
track-does-not-exist: "Ta ścieżka nie istnieje!"
|
||||
track-load-error: "Wystąpił nieoczekiwany błąd. Ścieżka nie została załadowana."
|
||||
tracks-load-error: "Wystąpił nieoczekiwany błąd. Nie można wczytać wszystkich ścieżek."
|
||||
track-empty: "Ścieżka nie może być używana jako pusta lub zawierać tylko jedną grupę."
|
||||
update-task-request: "&bZaktualizuj zaplanowane zadanie."
|
||||
update-task-complete: "&aZaktualizowano zadanie."
|
||||
update-task-complete-network: "&aZaktualizowano zadanie. Teraz próbuj wejść na inne serwery."
|
||||
update-task-push-success: "&aInne serwery zostały powiadomione za pośrednictwem & b {0} wiadomości &apomyślnie."
|
||||
update-task-push-failure: "&cPodczas przesyłania zmian do innych serwerów wystąpił błąd."
|
||||
update-task-push-failure-not-setup: "&cPodczas przesyłania zmian do innych serwerów wystąpił błąd. Usługa wiadomości nie została skonfigurowana."
|
||||
reload-config-success: "&aPlik konfiguracyjny został ponownie załadowany. &7(niektóre opcje będą obowiązywać tylko po ponownym uruchomieniu serwera.)"
|
||||
info: >
|
||||
{PREFIX}&2Uruchamianie &bLuckPerms v{0}&2 by &bLuck&2.\n
|
||||
{PREFIX}&f- &3Platforma: &f{1}\n
|
||||
{PREFIX}&f- &3Metoda Składowania: &f{2}\n
|
||||
{PREFIX}&f- &3Nazwa Serwera: &f{3}\n
|
||||
{PREFIX}&f- &3Synchronizacja Czasu: &a{4} &fminuty\n
|
||||
{PREFIX}&f- &3Usługa wiadomości: &f{5}\n
|
||||
{PREFIX}&f- &bLiczba:\n
|
||||
{PREFIX}&f- &3Online Graczy: &a{6}\n
|
||||
{PREFIX}&f- &3Załadowanych użytkowników: &a{7}\n
|
||||
{PREFIX}&f- &3Załadowanych grup: &a{8}\n
|
||||
{PREFIX}&f- &3Załadowanych Ścieżek: &a{9}\n
|
||||
{PREFIX}&f- &3Rozmiar Loga: &a{10}\n
|
||||
{PREFIX}&f- &3Rozmiar pamięci podręcznej UUID: &a{11}\n
|
||||
{PREFIX}&f- &3Załadowane tłumaczenia: &a{12}\n
|
||||
{PREFIX}&f- &3Kontrole wstępne: &a{13}\n
|
||||
{PREFIX}&f- &3Kalkulatory Kontekstu: &a{14}\n
|
||||
{PREFIX}&f- &3Unikalne uprawnienia: &a{15}\n
|
||||
{PREFIX}&f- &bKonfiguracja:\n
|
||||
{PREFIX}&f- &3Używany Server UUIDs: {16}\n
|
||||
{PREFIX}&f- &bObliczanie uprawnień:\n
|
||||
{PREFIX}&f- &3Łącznie ze światem: {17}\n
|
||||
{PREFIX}&f- &3Łącznie z globalnym światem: {18}\n
|
||||
{PREFIX}&f- &3Stosowanie grup globalnych: {19}\n
|
||||
{PREFIX}&f- &3Stosowanie Globalnych Grup Światowych: {20}\n
|
||||
{PREFIX}&f- &3Stosowanie symboli wieloznacznych: {21}\n
|
||||
{PREFIX}&f- &3Stosowanie Regex: {22}\n
|
||||
{PREFIX}&f- &3Stosowanie skrótu: {23}
|
||||
create-group-error: "Podczas tworzenia grupy wystąpił błąd."
|
||||
delete-group-error: "Podczas usuwania grupy wystąpił błąd."
|
||||
delete-group-error-default: "Nie można usunąć grupy domyślnej."
|
||||
groups-list: "&aGrupy: {0}"
|
||||
create-track-error: "Podczas tworzenia ścieżki wystąpił błąd."
|
||||
delete-track-error: "Podczas usuwania ścieżki wystąpił błąd."
|
||||
tracks-list: "&aŚcieżki: {0}"
|
||||
listnodes: "&b{0}'s Węzły:"
|
||||
listnodes-with-page: "&b{0}'s Węzły: {1}"
|
||||
listnodes-temp: >
|
||||
&b{0}'s Tymczasowe Węzły:\n
|
||||
{1}
|
||||
listparents: >
|
||||
&b{0}'s Grupy Rodzicielskie:\n
|
||||
{1}
|
||||
listparents-temp: >
|
||||
&b{0}'s Tymczasowe Grupy Rodzicielskie:\n
|
||||
{1}
|
||||
list-tracks: >
|
||||
&b{0}'s Ścieżki:\n
|
||||
{1}
|
||||
list-tracks-empty: "{0} nie jest na żadnej ścieżce."
|
||||
context-pair-inline: "&3{0}=&b{1}"
|
||||
context-pair--global-inline: "&eglobalnie"
|
||||
context-pair-sep: "&a, "
|
||||
context-pair: "&8(&7{0}=&f{1}&8)"
|
||||
check-permission: "&b{0}&a ma uprawnienia &b{1}&a ustawione na {2}&a w kontekście {3}&a."
|
||||
setpermission-success: "&aUstawiono &b{0}&a na &b{1}&a dla &b{2}&a w kontekście {3}&a."
|
||||
setpermission-temp-success: "&aUstawiono &b{0}&a na &b{1}&a dla &b{2}&a na czas trwania &b{3}&a w kontekście {4}&a."
|
||||
unsetpermission-success: "&aUsunięto &b{0}&a dla &b{1}&a w kontekście {2}&a."
|
||||
unset-temp-permission-success: "&aTymczasowe uprawnienia &b{0}&a dla &b{1}&a w kontekście {2}&a."
|
||||
set-inherit-success: "&b{0}&a teraz dziedziczy uprawnienia od &b{1}&a w kontekście {2}&a."
|
||||
set-temp-inherit-success: "&b{0}&a teraz dziedziczy uprawnienia &b{1}&a na czas trwania &b{2}&a w kontekście {3}&a."
|
||||
set-parent-success: "&b{0}&a gdyby istniejące grupy macierzyste zostały wyczyszczone, a teraz tylko dziedziczą &b{1}&a w kontekście {2}&a."
|
||||
set-track-parent-success: "&b{0}&a miały istniejące grupy macierzyste na ścieżce &b{1}&a wyczyszczone, a teraz dziedziczą &b{2}&a w kontekście {3}&a."
|
||||
unset-inherit-success: "&b{0}&a już nie dziedziczy uprawnień &b{1}&a w kontekście {2}&a."
|
||||
unset-temp-inherit-success: "&b{0}&a przestaje tymczasowo dziedziczyć uprawnienia &b{1}&a w kontekście {2}&a."
|
||||
clear-success: "&b{0}&a's uprawnienia zostały wyczyszczone w kontekście {1}&a. (&b{2}&a węzły zostały usunięte.)"
|
||||
clear-success-singular: "&b{0}&a's uprawnienia zostały wyczyszczone w kontekście {1}&a. (&b{2}&a węzeł został usunięty.)"
|
||||
parent-clear-success: "&b{0}&a's rodzice zostali wyczyszczeni w kontekście {1}&a. &b{2}&a węzły zostały usunięte.)"
|
||||
parent-clear-success-singular: "&b{0}&a's rodzice zostali wyczyszczeni w kontekście {1}&a. &b{2}&a węzeł został usunięty.)"
|
||||
parent-clear-track-success: "&b{0}&a's rodzice na ścieżce &b{1}&a zostali wyczyszczeni w kontekście {2}&a. &b{3}&a węzły zostały usunięte.)"
|
||||
parent-clear-track-success-singular: "&b{0}&a's parents on track &b{1}&a were cleared in context {2}&a. &b{3}&a węzeł został usunięty.)"
|
||||
meta-clear-success: "&b{0}&a's meta zostały usunięte w kontekście {1}&a. &b{2}&a węzły zostały usunięte.)"
|
||||
meta-clear-success-singular: "&b{0}&a's meta zostały usunięte w kontekście {1}&a. &b{2}&a węzeł został usunięty.)"
|
||||
illegal-date-error: "Nie można przeanalizować daty '{0}'."
|
||||
past-date-error: "W przeszłości nie można ustawić daty!"
|
||||
chat-meta-prefix-header: "&b{0}'s Prefiksy"
|
||||
chat-meta-suffix-header: "&b{0}'s Suffiksy"
|
||||
meta-header: "&b{0}'s Meta"
|
||||
chat-meta-entry: "&b-> {0} &f- &f\"{1}&f\" &8(&7odziedziczone po &a{2}&8)"
|
||||
chat-meta-entry-with-context: "&b-> {0} &f- &f\"{1}&f\" &8(&7odziedziczone po &a{2}&8){3}"
|
||||
meta-entry: "&b-> &a{0} &f= &f\"{1}&f\" &8(&7odziedziczone po &a{2}&8)"
|
||||
meta-entry-with-context: "&b-> &a{0} &f= &f\"{1}&f\" &8(&7odziedziczone po &a{2}&8){3}"
|
||||
chat-meta-prefix-none: "&b{0} nie ma prefiksów."
|
||||
chat-meta-suffix-none: "&b{0} has no suffiksów."
|
||||
meta-none: "&b{0} nie ma meta."
|
||||
meta-invalid-priority: "Nieprawidłowy priorytet '{0}'. Spodziewany numer."
|
||||
already-has-chat-meta: "{0} już to ma {1} ustawione."
|
||||
does-not-have-chat-meta: "{0} nie ma tego {1} ustawionego."
|
||||
add-chatmeta-success: "&b{0}&a ma {1} &f\"{2}&f\"&a ustawiony priorytet z &b{3}&a w kontekście {4}&a."
|
||||
add-temp-chatmeta-success: "&b{0}&a ma {1} &f\"{2}&f\"&a ustawiony priorytet z &b{3}&a na czas trwania &b{4}&a w kontekście {5}&a."
|
||||
remove-chatmeta-success: "&b{0}&a ma {1} &f\"{2}&f\"&a at priority &b{3}&a removed in context {4}&a."
|
||||
bulk-remove-chatmeta-success: "&b{0}&a ma cały {1}es na priorytecie &b{2}&a usunięte w kontekście {3}&a."
|
||||
remove-temp-chatmeta-success: "&b{0}&a ma tymczasowo {1} &f\"{2}&f\"&a at priority &b{3}&a usunięte w kontekście {4}&a."
|
||||
bulk-remove-temp-chatmeta-success: "&b{0}&a miał wszystkie tymczasowe {1}es na priorytecie &b{2}&a usunięte w kontekście {3}&a."
|
||||
already-has-meta: "{0} ma już tę parę par kluczy meta."
|
||||
set-meta-success: "&aUstawiono wartość meta dla klucza &f\"{0}&f\"&a do &f\"{1}&f\"&a dla &b{2}&a w kontekście {3}&a."
|
||||
set-meta-temp-success: "&aUstawiono wartości meta dla klucza &f\"{0}&f\"&a do &f\"{1}&f\"&a dla &b{2}&a na czas trwania &b{3}&a w kontekście {4}&a."
|
||||
unset-meta-success: "&aUsunięto wartość meta za pomocą klucza &f\"{0}&f\"&a dla &b{1}&a w kontekście {2}&a."
|
||||
unset-meta-temp-success: "&aUsunięcie tymczasowej wartości meta za pomocą klucza &f\"{0}&f\"&a dla &b{1}&a w kontekście {2}&a."
|
||||
bulk-update-invalid-data-type: "Nieprawidłowy typ. Spodziewane 'all', 'users' lub 'groups'."
|
||||
bulk-update-invalid-constraint: "Nieprawidłowe ograniczenie &4{0}&c. Ograniczenia powinny być w formacie '&f<field> <comparison operator> <value>&c'."
|
||||
bulk-update-invalid-comparison: "Nieprawidłowy operator porównania '&4{0}&c'. Oczekiwany jeden z poniższych: &f== != ~~ ~!"
|
||||
bulk-update-queued: "&aOperacja aktualizacji została w kolejce. &7(&f{0}&7)"
|
||||
bulk-update-confirm: "&aUruchom &b/{0} uaktualnianie zbiorcze {1} &a i wykonaj aktualizacje."
|
||||
bulk-update-unknown-id: "&aOperacja z id &b{0}&a nie istnieje lub upłynął."
|
||||
bulk-update-starting: "&aUaktualnianie zbiorcze."
|
||||
bulk-update-success: "&bAktualizacja zbiorcza powiodła się pomyślnie."
|
||||
bulk-update-failure: "&cAktualizacja zbiorcza nie powiodła się. Sprawdź, czy konsola nie zawiera błędów."
|
||||
user-info-general: >
|
||||
{PREFIX}&b&l> &bInfo Użytkownika: &f{0}\n
|
||||
{PREFIX}&f- &3UUID: &f{1}\n
|
||||
{PREFIX}&f- &3Status: {2}\n
|
||||
{PREFIX}&f- &3Grupa Podstawowa: &f{3}\n
|
||||
{PREFIX}&f- &aLiczba:\n
|
||||
{PREFIX}&f- &3Uprawnień: &a{4}\n
|
||||
{PREFIX}&f- &3Tymczasowych uprawnień: &a{5}\n
|
||||
{PREFIX}&f- &3Prefiksów: &a{6}\n
|
||||
{PREFIX}&f- &3Suffiksów: &a{7}\n
|
||||
{PREFIX}&f- &3Meta: &a{8}
|
||||
user-info-data: >
|
||||
{PREFIX}&f- &aDane buforowane:\n
|
||||
{PREFIX}&f- &3Posiada dane kontekstowe: {0}\n
|
||||
{PREFIX}&f- &3Obecne konteksty: {1}\n
|
||||
{PREFIX}&f- &3Obecny Prefiks: {2}\n
|
||||
{PREFIX}&f- &3Obecny Suffiks: {3}
|
||||
info-parent-header: "&f- &aGrupy Rodziców:"
|
||||
info-temp-parent-header: "&f- &aTymczasowe Grupy Rodziców:"
|
||||
user-removegroup-error-primary: "Nie można usunąć użytkownika z podstawowej grupy."
|
||||
user-primarygroup-success: "&b{0}&a's pierwsza grupa została ustawiona na &b{1}&a."
|
||||
user-primarygroup-warn-option: "&cUwaga: Podstawowa metoda obliczania grupy jest używana przez ten serwer &7({0}) &cmoże nie odzwierciedlać tej zmiany."
|
||||
user-primarygroup-error-alreadyhas: "Użytkownik ma już tę grupę jako pierwszą."
|
||||
user-primarygroup-error-notmember: "&b{0}&a nie był już użytkownikiem z &b{1}&a, dodając je teraz."
|
||||
user-track-error-not-contain-group: "Podany przez Ciebie użytkownik nie jest jeszcze w żadnej z grup na tej ścieżce."
|
||||
user-track-added-to-first: "&b{0}&a nie jest w żadnej grupie na tej ścieżce, więc został dodany do pierwszej grupy, &b{1}&a w kontekście {2}&a."
|
||||
user-promote-success: "&aPromowanie użytkownika wzdłuż toru &b{0}&a z &b{1}&a do &b{2}&a w kontekście {3}&a."
|
||||
user-promote-error-endoftrack: "Koniec ścieżki &4{0}&c został osiągnięty. Nie można promować użytkownika."
|
||||
user-promote-error-malformed: >
|
||||
{PREFIX}Następna grupa na ścieżce, {0}, już nie istnieje. Nie można promować użytkownika..\n
|
||||
{PREFIX}Albo utwórz grupę lub usuń ją ze ścieżki i spróbuj ponownie.
|
||||
user-demote-success: "&aObniżanie użytkownika wzdłuż ścieżki &b{0}&a z &b{1}&a do &b{2}&a w kontekście {3}&a."
|
||||
user-demote-endoftrack: "Koniec ścieżki &4{0}&c został osiągnięty, więc &4{1}&c zostało usunięte z &4{2}&c."
|
||||
user-demote-error-malformed: >
|
||||
{PREFIX}Poprzednia grupa na ścieżce, {0}, już nie istnieje. Nie można obniżyć użytkownika.\n
|
||||
{PREFIX}Albo utwórz grupę lub usuń ją ze ścieżki i spróbuj ponownie.
|
||||
group-info-general: >
|
||||
{PREFIX}&b&l> &bInfo Grupy: &f{0}\n
|
||||
{PREFIX}&f- &3Wyświetlana Nazwa: &f{1}\n
|
||||
{PREFIX}&f- &3Rola: &f{2}\n
|
||||
{PREFIX}&f- &aLiczba:\n
|
||||
{PREFIX}&f- &3Uprawnienia: &a{3}\n
|
||||
{PREFIX}&f- &3Tymczasowe Uprawnienia: &a{4}\n
|
||||
{PREFIX}&f- &3Prefiksy: &a{5}\n
|
||||
{PREFIX}&f- &3Suffiksy: &a{6}\n
|
||||
{PREFIX}&f- &3Meta: &a{7}
|
||||
group-set-weight: "&aSet weight to &b{0}&a for group &b{1}&a."
|
||||
track-info: >
|
||||
{PREFIX}&b&l> &bWyświetlanie ścieżki: &f{0}\n
|
||||
{PREFIX}&f- &7Ścieżka: &f{1}
|
||||
track-clear: "&b{0}&a grupy zostały usunięte"
|
||||
track-append-success: "&aGrupa &b{0}&a została z powodzeniem dodana do śledzenia &b{1}&a."
|
||||
track-insert-success: "&aGrupa &b{0}&a została pomyślnie wstawiona do ścieżki &b{1}&a na pozycji &b{2}&a."
|
||||
track-insert-error-number: "Przewidywany numer, ale otrzymany: {0}"
|
||||
track-insert-error-invalid-pos: "Nie można wstawić w pozycji {0}. Wyloguj się z granic."
|
||||
track-remove-success: "&aGrupa &b{0}&a została z powodzeniem usunięta ze ścieżki &b{1}&a."
|
||||
log-load-error: "Nie można załadować loga."
|
||||
log-invalid-page: "Nieprawidłowy numer strony."
|
||||
log-invalid-page-range: "Nieprawidłowy numer strony. Wprowadź wartość między 1 a {0}."
|
||||
log-no-entries: "&bBrak wpisów do logów."
|
||||
log-entry: "&b#{0} -> &8(&7{1} temu&8) {2}"
|
||||
log-notify-toggle-on: "&aWłączone&b wyjście z logowania."
|
||||
log-notify-toggle-off: "&cWyłączone&b wyjście z logowania."
|
||||
log-notify-already-on: "Obecnie otrzymujesz powiadomienia."
|
||||
log-notify-already-off: "Obecnie nie otrzymujesz powiadomień."
|
||||
log-notify-unknown: "Stan nieznany. Oczekiwanie na \"on\" lub \"off\"."
|
||||
log-search-header: "&aWyświetlanie ostatnich działań dotyczących zapytania &b{0} &a(strona &f{1}&a z &f{2}&a)"
|
||||
log-recent-header: "&aWyświetlanie ostatnich działań (strona &f{0}&a z &f{1}&a)"
|
||||
log-recent-by-header: "&aPokazanie ostatnich działań przez &b{0} &a(strona &f{1}&a z &f{2}&a)"
|
||||
log-history-user-header: "&aWyświetlanie historii dla użytkowników &b{0} &a(strona &f{1}&a z &f{2}&a)"
|
||||
log-history-group-header: "&aWyświetlanie historii dla grup &b{0} &a(strona &f{1}&a z &f{2}&a)"
|
||||
log-history-track-header: "&aWyświetlanie historii dla ścieżki &b{0} &a(strona &f{1}&a z &f{2}&a)"
|
||||
log-export-already-exists: "Błąd: Plik {0} już istnieje."
|
||||
log-export-not-writable: "Błąd: Plik {0} jest tylko do odczytu."
|
||||
log-export-empty: "Log jest pusty i dlatego nie może być eksportowany"
|
||||
log-export-failure: "Podczas zapisywania do pliku wystąpił nieoczekiwany błąd."
|
||||
log-export-success: "&aPomyślnie exportowano log do &b{0}&a."
|
||||
import-already-running: "Inny proces importowania jest już uruchomiony. Spróbuj ponownie później."
|
||||
export-already-running: "Inny proces eksportowania jest już uruchomiony. Spróbuj ponownie później."
|
||||
import-log-doesnt-exist: "Błąd: Plik {0} nie istnieje."
|
||||
import-log-not-readable: "Błąd: Plik {0} nie można odczytać."
|
||||
import-log-failure: "Podczas odtwarzania loga wystąpił nieoczekiwany błąd."
|
||||
import-progress: "&b(Import) &b-> &f{0} &fprocent kompletne &7- &b{1}&f/&b{2} &foperacja zakończona z &c{3} &fbłędami."
|
||||
import-progress-sin: "&b(Import) &b-> &f{0} &fprocent kompletne &7- &b{1}&f/&b{2} &foperacja zakończona z &c{3} &fbłędami."
|
||||
import-start: "&b(Import) &b-> &fUruchamianie procesu importowania."
|
||||
import-end-complete: "&b(Import) &a&lZAKOŃCZONE &7- zajęło &b{0} &7sekundy - &7Nie ma błędów."
|
||||
import-end-complete-err: "&b(Import) &a&lZAKOŃCZONE &7- zajęło &b{0} &7sekundy - &c{1} błędy."
|
||||
import-end-complete-err-sin: "&b(Import) &a&lZAKOŃCZONE &7- zajęło &b{0} &7sekundy - &c{1} błąd."
|
||||
import-end-error-header: >
|
||||
{PREFIX}&b(Import) &7------------> &fWyświetlanie błędu #&b{0} &7<------------\n
|
||||
{PREFIX}&b(Import) &fWykonując: &3Komende #{1}\n
|
||||
{PREFIX}&b(Import) &fKomenda: &7{2}\n
|
||||
{PREFIX}&b(Import) &fWpisane: &3{3}\n
|
||||
{PREFIX}&b(Import) &fWyjście:
|
||||
import-end-error-content: "&b(Import) &b-> &c{0}"
|
||||
import-end-error-footer: "&b(Import) &7<------------------------------------------>"
|
||||
@@ -18,15 +18,34 @@ LuckPerms also includes an extensive API for developers, and support for a varie
|
||||
LuckPerms uses Maven to handle dependencies.
|
||||
|
||||
#### Requirements
|
||||
* Java 8 JDK
|
||||
* Maven 3.3.x (the older versions will not work.)
|
||||
* Git
|
||||
|
||||
#### Then run
|
||||
```sh
|
||||
git clone https://github.com/lucko/LuckPerms.git
|
||||
cd LuckPerms/
|
||||
mvn clean package
|
||||
```
|
||||
|
||||
You can find the output jars in the `target` directories.
|
||||
|
||||
## Contributing
|
||||
In order to contribute to and make changes to the plugin, you will need the dependencies listed above, plus the [Lombok plugin](https://projectlombok.org/download.html) for your IDE.
|
||||
|
||||
#### Pull Requests
|
||||
If you make any changes or improvements to the plugin which you think would be beneficial upstream, please consider making a Pull Request to merge your changes back into the upstream project. (especially if your changes are bug fixes!)
|
||||
|
||||
LuckPerms loosely follows the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html), with a few minor changes here and there. Generally, try to copy the style of code found in the class you're editing.
|
||||
|
||||
#### Project Layout
|
||||
The project is split up into 5 seperate modules.
|
||||
|
||||
* **API** - The public facing API classes used by other plugins when integrating with LuckPerms. This is basically just a collection of interfaces implemented inside of the plugin.
|
||||
* **Common** - This includes all of the classes shared by separate implementations of LuckPerms. This is where the bulk of the project is.
|
||||
* **Bukkit, BungeeCord & Sponge** - Includes all of the platform specific classes used to implement LuckPerms on each of the 3 supported platforms.
|
||||
|
||||
## License
|
||||
LuckPerms is licensed under the permissive MIT license. Please see [`LICENSE.txt`](https://github.com/lucko/LuckPerms/blob/master/LICENSE.txt) for more info.
|
||||
|
||||
|
||||
+69
-1
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>luckperms</artifactId>
|
||||
<groupId>me.lucko.luckperms</groupId>
|
||||
<version>3.2-SNAPSHOT</version>
|
||||
<version>3.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -35,6 +35,68 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>deployment</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<links>
|
||||
<link>https://google.github.io/guava/releases/21.0/api/docs/</link>
|
||||
</links>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>sign</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>${gpg.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<!-- guava -->
|
||||
<dependency>
|
||||
@@ -43,6 +105,12 @@
|
||||
<version>19.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import me.lucko.luckperms.api.LuckPermsApi;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Singleton for the {@link LuckPermsApi}.
|
||||
*
|
||||
@@ -41,6 +46,7 @@ public final class LuckPerms {
|
||||
* @return an api instance
|
||||
* @throws IllegalStateException if the api is not loaded
|
||||
*/
|
||||
@Nonnull
|
||||
public static LuckPermsApi getApi() {
|
||||
if (api == null) {
|
||||
throw new IllegalStateException("API is not loaded.");
|
||||
@@ -56,6 +62,7 @@ public final class LuckPerms {
|
||||
*
|
||||
* @return an optional api instance
|
||||
*/
|
||||
@Nonnull
|
||||
public static Optional<LuckPermsApi> getApiSafe() {
|
||||
return Optional.ofNullable(api);
|
||||
}
|
||||
|
||||
@@ -25,8 +25,12 @@
|
||||
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Represents a type of chat meta
|
||||
*
|
||||
@@ -40,17 +44,17 @@ public enum ChatMetaType {
|
||||
PREFIX {
|
||||
@Override
|
||||
public boolean matches(Node node) {
|
||||
return node.isPrefix();
|
||||
return Preconditions.checkNotNull(node, "node").isPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldIgnore(Node node) {
|
||||
return !node.isPrefix();
|
||||
return !Preconditions.checkNotNull(node, "node").isPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map.Entry<Integer, String> getEntry(Node node) {
|
||||
return node.getPrefix();
|
||||
return Preconditions.checkNotNull(node, "node").getPrefix();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -60,17 +64,17 @@ public enum ChatMetaType {
|
||||
SUFFIX {
|
||||
@Override
|
||||
public boolean matches(Node node) {
|
||||
return node.isSuffix();
|
||||
return Preconditions.checkNotNull(node, "node").isSuffix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldIgnore(Node node) {
|
||||
return !node.isSuffix();
|
||||
return !Preconditions.checkNotNull(node, "node").isSuffix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map.Entry<Integer, String> getEntry(Node node) {
|
||||
return node.getSuffix();
|
||||
return Preconditions.checkNotNull(node, "node").getSuffix();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -80,7 +84,7 @@ public enum ChatMetaType {
|
||||
* @param node the node to test
|
||||
* @return true if the node has the same type
|
||||
*/
|
||||
public abstract boolean matches(Node node);
|
||||
public abstract boolean matches(@Nonnull Node node);
|
||||
|
||||
/**
|
||||
* Returns if the passed node should be ignored when searching for meta of this type
|
||||
@@ -88,7 +92,7 @@ public enum ChatMetaType {
|
||||
* @param node the node to test
|
||||
* @return true if the node does not share the same type
|
||||
*/
|
||||
public abstract boolean shouldIgnore(Node node);
|
||||
public abstract boolean shouldIgnore(@Nonnull Node node);
|
||||
|
||||
/**
|
||||
* Maps the corresponding entry from the given node
|
||||
@@ -97,6 +101,7 @@ public enum ChatMetaType {
|
||||
* @return the entry
|
||||
* @throws IllegalStateException if the node does not share the same type
|
||||
*/
|
||||
public abstract Map.Entry<Integer, String> getEntry(Node node);
|
||||
@Nonnull
|
||||
public abstract Map.Entry<Integer, String> getEntry(@Nonnull Node node);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,6 +27,8 @@ package me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Context and options for a permission lookup.
|
||||
*
|
||||
@@ -34,18 +39,31 @@ import me.lucko.luckperms.api.context.ContextSet;
|
||||
public class Contexts {
|
||||
public static final String SERVER_KEY = "server";
|
||||
public static final String WORLD_KEY = "world";
|
||||
private static final Contexts ALLOW_ALL = new Contexts(ContextSet.empty(), true, true, true, true, true, true);
|
||||
|
||||
private static final Contexts GLOBAL = new Contexts(ContextSet.empty(), true, true, true, true, true, false);
|
||||
|
||||
/**
|
||||
* Gets a context that will allow all nodes
|
||||
* Gets the {@link FullySatisfiedContexts} instance.
|
||||
*
|
||||
* @return a context that will not apply any filters
|
||||
* @return a context that will satisfy all contextual requirements.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Contexts allowAll() {
|
||||
return ALLOW_ALL;
|
||||
return FullySatisfiedContexts.getInstance();
|
||||
}
|
||||
|
||||
public static Contexts of(ContextSet context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups, boolean op) {
|
||||
/**
|
||||
* A contexts instance with no defined context.
|
||||
*
|
||||
* @return the global contexts
|
||||
* @since 3.3
|
||||
*/
|
||||
@Nonnull
|
||||
public static Contexts global() {
|
||||
return GLOBAL;
|
||||
}
|
||||
|
||||
public static Contexts of(@Nonnull ContextSet context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups, boolean op) {
|
||||
return new Contexts(context, includeGlobal, includeGlobalWorld, applyGroups, applyGlobalGroups, applyGlobalWorldGroups, op);
|
||||
}
|
||||
|
||||
@@ -87,7 +105,7 @@ public class Contexts {
|
||||
*/
|
||||
private final boolean applyGlobalWorldGroups;
|
||||
|
||||
public Contexts(ContextSet context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups, boolean op) {
|
||||
public Contexts(@Nonnull ContextSet context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups, boolean op) {
|
||||
if (context == null) {
|
||||
throw new NullPointerException("context");
|
||||
}
|
||||
@@ -107,6 +125,7 @@ public class Contexts {
|
||||
* @return an immutable set of context key value pairs
|
||||
* @since 2.13
|
||||
*/
|
||||
@Nonnull
|
||||
public ContextSet getContexts() {
|
||||
return this.context;
|
||||
}
|
||||
@@ -166,6 +185,7 @@ public class Contexts {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public String toString() {
|
||||
return "Contexts(" +
|
||||
"context=" + this.getContexts() + ", " +
|
||||
@@ -185,7 +205,9 @@ public class Contexts {
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (o == allowAll()) return false;
|
||||
if (!(o instanceof Contexts)) return false;
|
||||
|
||||
final Contexts other = (Contexts) o;
|
||||
return this.getContexts().equals(other.getContexts()) &&
|
||||
this.isOp() == other.isOp() &&
|
||||
@@ -201,7 +223,7 @@ public class Contexts {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
final Object contexts = this.getContexts();
|
||||
result = result * PRIME + (contexts == null ? 43 : contexts.hashCode());
|
||||
result = result * PRIME + contexts.hashCode();
|
||||
result = result * PRIME + (this.isOp() ? 79 : 97);
|
||||
result = result * PRIME + (this.isIncludeGlobal() ? 79 : 97);
|
||||
result = result * PRIME + (this.isIncludeGlobalWorld() ? 79 : 97);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.api.caching.MetaContexts;
|
||||
import me.lucko.luckperms.api.caching.UserData;
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* A special instance of {@link Contexts}, which when passed to:
|
||||
*
|
||||
* <p><ul>
|
||||
* <li>{@link UserData#getPermissionData(Contexts)}</li>
|
||||
* <li>{@link UserData#getMetaData(Contexts)}</li>
|
||||
* <li>{@link UserData#getMetaData(MetaContexts)}</li>
|
||||
* </ul></p>
|
||||
*
|
||||
* <p>will always satisfy all contextual requirements.</p>
|
||||
*
|
||||
* <p>This effectively allows you to do lookups which ignore context.</p>
|
||||
*
|
||||
* @since 3.3
|
||||
*/
|
||||
public final class FullySatisfiedContexts extends Contexts {
|
||||
private static final FullySatisfiedContexts INSTANCE = new FullySatisfiedContexts();
|
||||
|
||||
@Nonnull
|
||||
public static Contexts getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private FullySatisfiedContexts() {
|
||||
super(ContextSet.empty(), true, true, true, true, true, false);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FullySatisfiedContexts";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return o == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return System.identityHashCode(this);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -29,6 +32,8 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
import java.util.List;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* A group which holds permission data.
|
||||
*/
|
||||
@@ -39,6 +44,7 @@ public interface Group extends PermissionHolder {
|
||||
*
|
||||
* @return the name of the group
|
||||
*/
|
||||
@Nonnull
|
||||
String getName();
|
||||
|
||||
/**
|
||||
@@ -49,7 +55,7 @@ public interface Group extends PermissionHolder {
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
boolean inheritsGroup(Group group);
|
||||
boolean inheritsGroup(@Nonnull Group group);
|
||||
|
||||
/**
|
||||
* Check to see if a group inherits another group directly
|
||||
@@ -61,7 +67,7 @@ public interface Group extends PermissionHolder {
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @since 3.2
|
||||
*/
|
||||
boolean inheritsGroup(Group group, ContextSet contextSet);
|
||||
boolean inheritsGroup(@Nonnull Group group, @Nonnull ContextSet contextSet);
|
||||
|
||||
/**
|
||||
* Gets the weight of this group, if present.
|
||||
@@ -69,6 +75,7 @@ public interface Group extends PermissionHolder {
|
||||
* @return the group weight
|
||||
* @since 2.17
|
||||
*/
|
||||
@Nonnull
|
||||
OptionalInt getWeight();
|
||||
|
||||
/**
|
||||
@@ -83,7 +90,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link #inheritsGroup(Group, ContextSet)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean inheritsGroup(Group group, String server);
|
||||
boolean inheritsGroup(@Nonnull Group group, @Nonnull String server);
|
||||
|
||||
/**
|
||||
* Check to see if the group inherits a group on a specific server and world
|
||||
@@ -98,7 +105,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link #inheritsGroup(Group, ContextSet)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean inheritsGroup(Group group, String server, String world);
|
||||
boolean inheritsGroup(@Nonnull Group group, @Nonnull String server, @Nonnull String world);
|
||||
|
||||
/**
|
||||
* Make this group inherit another group
|
||||
@@ -110,7 +117,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setInheritGroup(Group group) throws ObjectAlreadyHasException;
|
||||
void setInheritGroup(@Nonnull Group group) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
@@ -124,7 +131,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setInheritGroup(Group group, String server) throws ObjectAlreadyHasException;
|
||||
void setInheritGroup(@Nonnull Group group, @Nonnull String server) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server and world
|
||||
@@ -139,7 +146,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setInheritGroup(Group group, String server, String world) throws ObjectAlreadyHasException;
|
||||
void setInheritGroup(@Nonnull Group group, @Nonnull String server, @Nonnull String world) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group temporarily
|
||||
@@ -153,7 +160,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setInheritGroup(Group group, long expireAt) throws ObjectAlreadyHasException;
|
||||
void setInheritGroup(@Nonnull Group group, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server temporarily
|
||||
@@ -168,7 +175,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setInheritGroup(Group group, String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
void setInheritGroup(@Nonnull Group group, @Nonnull String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server and world temporarily
|
||||
@@ -184,7 +191,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setInheritGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
void setInheritGroup(@Nonnull Group group, @Nonnull String server, @Nonnull String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule
|
||||
@@ -196,7 +203,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetInheritGroup(Group group) throws ObjectLacksException;
|
||||
void unsetInheritGroup(@Nonnull Group group) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule
|
||||
@@ -209,7 +216,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetInheritGroup(Group group, boolean temporary) throws ObjectLacksException;
|
||||
void unsetInheritGroup(@Nonnull Group group, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule on a specific server
|
||||
@@ -223,7 +230,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetInheritGroup(Group group, String server) throws ObjectLacksException;
|
||||
void unsetInheritGroup(@Nonnull Group group, @Nonnull String server) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule on a specific server and world
|
||||
@@ -238,7 +245,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetInheritGroup(Group group, String server, String world) throws ObjectLacksException;
|
||||
void unsetInheritGroup(@Nonnull Group group, @Nonnull String server, @Nonnull String world) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule on a specific server
|
||||
@@ -253,7 +260,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetInheritGroup(Group group, String server, boolean temporary) throws ObjectLacksException;
|
||||
void unsetInheritGroup(@Nonnull Group group, @Nonnull String server, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule on a specific server and world
|
||||
@@ -269,7 +276,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetInheritGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
|
||||
void unsetInheritGroup(@Nonnull Group group, @Nonnull String server, @Nonnull String world, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Get a {@link List} of all of the groups the group inherits, on all servers
|
||||
@@ -278,6 +285,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of just querying a users permissions
|
||||
*/
|
||||
@Deprecated
|
||||
@Nonnull
|
||||
List<String> getGroupNames();
|
||||
|
||||
/**
|
||||
@@ -290,7 +298,8 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of just querying a users permissions
|
||||
*/
|
||||
@Deprecated
|
||||
List<String> getLocalGroups(String server);
|
||||
@Nonnull
|
||||
List<String> getLocalGroups(@Nonnull String server);
|
||||
|
||||
|
||||
/**
|
||||
@@ -304,6 +313,7 @@ public interface Group extends PermissionHolder {
|
||||
* @deprecated in favour of just querying a users permissions
|
||||
*/
|
||||
@Deprecated
|
||||
List<String> getLocalGroups(String server, String world);
|
||||
@Nonnull
|
||||
List<String> getLocalGroups(@Nonnull String server, @Nonnull String world);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,6 +30,8 @@ import com.google.common.collect.Multimap;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalLong;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* A relationship between a Holder and a permission
|
||||
*
|
||||
@@ -40,6 +45,7 @@ public interface HeldPermission<T> {
|
||||
*
|
||||
* @return the holder
|
||||
*/
|
||||
@Nonnull
|
||||
T getHolder();
|
||||
|
||||
/**
|
||||
@@ -47,6 +53,7 @@ public interface HeldPermission<T> {
|
||||
*
|
||||
* @return the permission
|
||||
*/
|
||||
@Nonnull
|
||||
String getPermission();
|
||||
|
||||
/**
|
||||
@@ -61,6 +68,7 @@ public interface HeldPermission<T> {
|
||||
*
|
||||
* @return the server
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<String> getServer();
|
||||
|
||||
/**
|
||||
@@ -68,6 +76,7 @@ public interface HeldPermission<T> {
|
||||
*
|
||||
* @return the world
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<String> getWorld();
|
||||
|
||||
/**
|
||||
@@ -82,6 +91,7 @@ public interface HeldPermission<T> {
|
||||
*
|
||||
* @return the context
|
||||
*/
|
||||
@Nonnull
|
||||
Multimap<String, String> getContext();
|
||||
|
||||
/**
|
||||
@@ -89,6 +99,7 @@ public interface HeldPermission<T> {
|
||||
*
|
||||
* @return a Node copy of this permission
|
||||
*/
|
||||
@Nonnull
|
||||
Node asNode();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import me.lucko.luckperms.api.data.DatastoreConfiguration;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Read-only access to the LuckPerms configuration settings
|
||||
*/
|
||||
@@ -35,6 +40,7 @@ public interface LPConfiguration {
|
||||
* Returns the name of this server
|
||||
* @return the name of this server
|
||||
*/
|
||||
@Nonnull
|
||||
String getServer();
|
||||
|
||||
/**
|
||||
@@ -127,6 +133,7 @@ public interface LPConfiguration {
|
||||
* @return the name of the server used within Vault operations
|
||||
* @since 2.7
|
||||
*/
|
||||
@Nonnull
|
||||
String getVaultServer();
|
||||
|
||||
/**
|
||||
@@ -140,12 +147,14 @@ public interface LPConfiguration {
|
||||
* Returns the values set for data storage in the configuration
|
||||
* @return the values set for data storage in the configuration
|
||||
*/
|
||||
@Nonnull
|
||||
DatastoreConfiguration getDatastoreConfig();
|
||||
|
||||
/**
|
||||
* Returns the storage method string from the configuration
|
||||
* @return the storage method string from the configuration
|
||||
*/
|
||||
@Nonnull
|
||||
String getStorageMethod();
|
||||
|
||||
/**
|
||||
@@ -161,6 +170,27 @@ public interface LPConfiguration {
|
||||
* method. For example: key = user, value = json
|
||||
* @since 2.7
|
||||
*/
|
||||
@Nonnull
|
||||
Map<String, String> getSplitStorageOptions();
|
||||
|
||||
@Nonnull
|
||||
Unsafe unsafe();
|
||||
|
||||
interface Unsafe {
|
||||
|
||||
/**
|
||||
* Gets an Object from the config.
|
||||
*
|
||||
* <p>This method is nested under {@link Unsafe} because the keys
|
||||
* and return types may change between versions without warning.</p>
|
||||
*
|
||||
* @param key the key, as defined as a parameter name in
|
||||
* the "ConfigKeys" class.
|
||||
* @return the corresponding object, if one is present
|
||||
* @throws IllegalArgumentException if the key isn't known
|
||||
*/
|
||||
@Nonnull
|
||||
Object getObject(String key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* A node with a traceable origin
|
||||
*
|
||||
@@ -34,6 +39,7 @@ public interface LocalizedNode extends Node {
|
||||
*
|
||||
* @return the node this instance is representing
|
||||
*/
|
||||
@Nonnull
|
||||
Node getNode();
|
||||
|
||||
/**
|
||||
@@ -42,6 +48,7 @@ public interface LocalizedNode extends Node {
|
||||
* @return where the node was inherited from. Will not return null.
|
||||
* @see PermissionHolder#getObjectName()
|
||||
*/
|
||||
@Nonnull
|
||||
String getLocation();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import java.util.SortedMap;
|
||||
import java.util.SortedSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Represents the internal LuckPerms log.
|
||||
*
|
||||
@@ -37,11 +42,13 @@ public interface Log {
|
||||
/**
|
||||
* @return a {@link SortedSet} of all of the {@link LogEntry} objects in this {@link Log}
|
||||
*/
|
||||
@Nonnull
|
||||
SortedSet<LogEntry> getContent();
|
||||
|
||||
/**
|
||||
* @return all content in this log
|
||||
*/
|
||||
@Nonnull
|
||||
SortedSet<LogEntry> getRecent();
|
||||
|
||||
/**
|
||||
@@ -52,6 +59,7 @@ public interface Log {
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getRecentMaxPages()}}
|
||||
*/
|
||||
@Nonnull
|
||||
SortedMap<Integer, LogEntry> getRecent(int pageNo);
|
||||
|
||||
/**
|
||||
@@ -64,7 +72,8 @@ public interface Log {
|
||||
* @param actor the uuid of the actor to filter by
|
||||
* @return all content in this log where is actor = uuid
|
||||
*/
|
||||
SortedSet<LogEntry> getRecent(UUID actor);
|
||||
@Nonnull
|
||||
SortedSet<LogEntry> getRecent(@Nonnull UUID actor);
|
||||
|
||||
/**
|
||||
* Gets the recent content for the uuid, separated into pages
|
||||
@@ -75,20 +84,22 @@ public interface Log {
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getRecentMaxPages(UUID)}}
|
||||
*/
|
||||
SortedMap<Integer, LogEntry> getRecent(int pageNo, UUID actor);
|
||||
@Nonnull
|
||||
SortedMap<Integer, LogEntry> getRecent(int pageNo, @Nonnull UUID actor);
|
||||
|
||||
/**
|
||||
* @param actor the actor to filter by
|
||||
* @return the max page number allowed in the {@link #getRecent(int, UUID)} method
|
||||
*/
|
||||
int getRecentMaxPages(UUID actor);
|
||||
int getRecentMaxPages(@Nonnull UUID actor);
|
||||
|
||||
|
||||
/**
|
||||
* @param uuid the uuid to filter by
|
||||
* @return all content in this log where the user = uuid
|
||||
*/
|
||||
SortedSet<LogEntry> getUserHistory(UUID uuid);
|
||||
@Nonnull
|
||||
SortedSet<LogEntry> getUserHistory(@Nonnull UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets the user history content, separated by pages
|
||||
@@ -99,20 +110,22 @@ public interface Log {
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getUserHistoryMaxPages(UUID)}}
|
||||
*/
|
||||
SortedMap<Integer, LogEntry> getUserHistory(int pageNo, UUID uuid);
|
||||
@Nonnull
|
||||
SortedMap<Integer, LogEntry> getUserHistory(int pageNo, @Nonnull UUID uuid);
|
||||
|
||||
/**
|
||||
* @param uuid the uuid to filter by
|
||||
* @return the max page number allowed in the {@link #getUserHistory(int, UUID)} method
|
||||
*/
|
||||
int getUserHistoryMaxPages(UUID uuid);
|
||||
int getUserHistoryMaxPages(@Nonnull UUID uuid);
|
||||
|
||||
|
||||
/**
|
||||
* @param name the name to filter by
|
||||
* @return all content in this log where the group = name
|
||||
*/
|
||||
SortedSet<LogEntry> getGroupHistory(String name);
|
||||
@Nonnull
|
||||
SortedSet<LogEntry> getGroupHistory(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Gets the group history content, separated by pages
|
||||
@@ -123,20 +136,22 @@ public interface Log {
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getGroupHistoryMaxPages(String)}}
|
||||
*/
|
||||
SortedMap<Integer, LogEntry> getGroupHistory(int pageNo, String name);
|
||||
@Nonnull
|
||||
SortedMap<Integer, LogEntry> getGroupHistory(int pageNo, @Nonnull String name);
|
||||
|
||||
/**
|
||||
* @param name the name to filter by
|
||||
* @return the max page number allowed in the {@link #getGroupHistory(int, String)} method
|
||||
*/
|
||||
int getGroupHistoryMaxPages(String name);
|
||||
int getGroupHistoryMaxPages(@Nonnull String name);
|
||||
|
||||
|
||||
/**
|
||||
* @param name the name to filter by
|
||||
* @return all content in this log where the track = name
|
||||
*/
|
||||
SortedSet<LogEntry> getTrackHistory(String name);
|
||||
@Nonnull
|
||||
SortedSet<LogEntry> getTrackHistory(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Gets the track history content, separated by pages
|
||||
@@ -145,7 +160,8 @@ public interface Log {
|
||||
* @param name the name of the acted track to filter by
|
||||
* @return the page content
|
||||
*/
|
||||
SortedMap<Integer, LogEntry> getTrackHistory(int pageNo, String name);
|
||||
@Nonnull
|
||||
SortedMap<Integer, LogEntry> getTrackHistory(int pageNo, @Nonnull String name);
|
||||
|
||||
/**
|
||||
* @param name the name to filter by
|
||||
@@ -153,14 +169,15 @@ public interface Log {
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getTrackHistoryMaxPages(String)}}
|
||||
*/
|
||||
int getTrackHistoryMaxPages(String name);
|
||||
int getTrackHistoryMaxPages(@Nonnull String name);
|
||||
|
||||
|
||||
/**
|
||||
* @param query the query to filter by
|
||||
* @return all content in this log where the content matches query
|
||||
*/
|
||||
SortedSet<LogEntry> getSearch(String query);
|
||||
@Nonnull
|
||||
SortedSet<LogEntry> getSearch(@Nonnull String query);
|
||||
|
||||
/**
|
||||
* Gets the search content, separated by pages
|
||||
@@ -171,11 +188,12 @@ public interface Log {
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getSearchMaxPages(String)}}
|
||||
*/
|
||||
SortedMap<Integer, LogEntry> getSearch(int pageNo, String query);
|
||||
@Nonnull
|
||||
SortedMap<Integer, LogEntry> getSearch(int pageNo, @Nonnull String query);
|
||||
|
||||
/**
|
||||
* @param query the query to filter by
|
||||
* @return the max page number allowed in the {@link #getSearch(int, String)} method
|
||||
*/
|
||||
int getSearchMaxPages(String query);
|
||||
int getSearchMaxPages(@Nonnull String query);
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,6 +27,9 @@ package me.lucko.luckperms.api;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A single entry in the log
|
||||
*
|
||||
@@ -32,6 +38,7 @@ import java.util.UUID;
|
||||
public class LogEntry implements Comparable<LogEntry> {
|
||||
private static final String FORMAT = "&8(&e%s&8) [&a%s&8] (&b%s&8) &7--> &f%s";
|
||||
|
||||
@Nonnull
|
||||
public static LogEntryBuilder builder() {
|
||||
return new LogEntryBuilder();
|
||||
}
|
||||
@@ -44,7 +51,7 @@ public class LogEntry implements Comparable<LogEntry> {
|
||||
private String actedName;
|
||||
private String action;
|
||||
|
||||
public LogEntry(long timestamp, UUID actor, String actorName, char type, UUID acted, String actedName, String action) {
|
||||
public LogEntry(long timestamp, @Nonnull UUID actor, @Nonnull String actorName, char type, @Nullable UUID acted, @Nonnull String actedName, @Nonnull String action) {
|
||||
if (actor == null) {
|
||||
throw new NullPointerException("actor");
|
||||
}
|
||||
@@ -82,12 +89,13 @@ public class LogEntry implements Comparable<LogEntry> {
|
||||
return equals(o) ? 0 : (Long.compare(timestamp, o.getTimestamp()) == 0 ? 1 : Long.compare(timestamp, o.getTimestamp()));
|
||||
}
|
||||
|
||||
public boolean matchesSearch(String query) {
|
||||
public boolean matchesSearch(@Nonnull String query) {
|
||||
query = query.toLowerCase();
|
||||
return actorName.toLowerCase().contains(query) || actedName.toLowerCase().contains(query)
|
||||
|| action.toLowerCase().contains(query);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getFormatted() {
|
||||
return String.format(FORMAT,
|
||||
String.valueOf(actorName).equals("null") ? actor.toString() : actorName,
|
||||
@@ -105,19 +113,21 @@ public class LogEntry implements Comparable<LogEntry> {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public UUID getActor() {
|
||||
return actor;
|
||||
}
|
||||
|
||||
void setActor(UUID actor) {
|
||||
void setActor(@Nonnull UUID actor) {
|
||||
this.actor = actor;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getActorName() {
|
||||
return actorName;
|
||||
}
|
||||
|
||||
void setActorName(String actorName) {
|
||||
void setActorName(@Nonnull String actorName) {
|
||||
this.actorName = actorName;
|
||||
}
|
||||
|
||||
@@ -129,27 +139,30 @@ public class LogEntry implements Comparable<LogEntry> {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public UUID getActed() {
|
||||
return acted;
|
||||
}
|
||||
|
||||
void setActed(UUID acted) {
|
||||
void setActed(@Nullable UUID acted) {
|
||||
this.acted = acted;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getActedName() {
|
||||
return actedName;
|
||||
}
|
||||
|
||||
void setActedName(String actedName) {
|
||||
void setActedName(@Nonnull String actedName) {
|
||||
this.actedName = actedName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
void setAction(String action) {
|
||||
void setAction(@Nonnull String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Represents the logger instance being used by LuckPerms on the platform.
|
||||
*
|
||||
@@ -30,10 +35,10 @@ package me.lucko.luckperms.api;
|
||||
*/
|
||||
public interface Logger {
|
||||
|
||||
void info(String s);
|
||||
void info(@Nonnull String s);
|
||||
|
||||
void warn(String s);
|
||||
void warn(@Nonnull String s);
|
||||
|
||||
void severe(String s);
|
||||
void severe(@Nonnull String s);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,6 +34,9 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* The root API interface for LuckPerms
|
||||
*/
|
||||
@@ -54,6 +60,7 @@ public interface LuckPermsApi {
|
||||
*
|
||||
* @return the version of the plugin running on the platform
|
||||
*/
|
||||
@Nonnull
|
||||
String getVersion();
|
||||
|
||||
/**
|
||||
@@ -62,6 +69,7 @@ public interface LuckPermsApi {
|
||||
* @return the platform LuckPerms is running on
|
||||
* @since 2.7
|
||||
*/
|
||||
@Nonnull
|
||||
PlatformType getPlatformType();
|
||||
|
||||
/**
|
||||
@@ -70,6 +78,7 @@ public interface LuckPermsApi {
|
||||
* @return the event bus
|
||||
* @since 3.0
|
||||
*/
|
||||
@Nonnull
|
||||
EventBus getEventBus();
|
||||
|
||||
/**
|
||||
@@ -77,6 +86,7 @@ public interface LuckPermsApi {
|
||||
*
|
||||
* @return a configuration instance
|
||||
*/
|
||||
@Nonnull
|
||||
LPConfiguration getConfiguration();
|
||||
|
||||
/**
|
||||
@@ -85,6 +95,7 @@ public interface LuckPermsApi {
|
||||
* @return a storage instance
|
||||
* @since 2.14
|
||||
*/
|
||||
@Nonnull
|
||||
Storage getStorage();
|
||||
|
||||
/**
|
||||
@@ -92,6 +103,7 @@ public interface LuckPermsApi {
|
||||
*
|
||||
* @return an optional that may contain a messaging service instance.
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<MessagingService> getMessagingService();
|
||||
|
||||
/**
|
||||
@@ -99,6 +111,7 @@ public interface LuckPermsApi {
|
||||
*
|
||||
* @return the logger instance
|
||||
*/
|
||||
@Nonnull
|
||||
Logger getLogger();
|
||||
|
||||
/**
|
||||
@@ -106,6 +119,7 @@ public interface LuckPermsApi {
|
||||
*
|
||||
* @return a uuid cache instance
|
||||
*/
|
||||
@Nonnull
|
||||
UuidCache getUuidCache();
|
||||
|
||||
/**
|
||||
@@ -115,7 +129,8 @@ public interface LuckPermsApi {
|
||||
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
|
||||
* @throws NullPointerException if the uuid is null
|
||||
*/
|
||||
User getUser(UUID uuid);
|
||||
@Nullable
|
||||
User getUser(@Nonnull UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets a wrapped user object from the user storage.
|
||||
@@ -126,7 +141,8 @@ public interface LuckPermsApi {
|
||||
* @return an optional {@link User} object
|
||||
* @throws NullPointerException if the uuid is null
|
||||
*/
|
||||
Optional<User> getUserSafe(UUID uuid);
|
||||
@Nonnull
|
||||
Optional<User> getUserSafe(@Nonnull UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets a wrapped user object from the user storage
|
||||
@@ -135,7 +151,8 @@ public interface LuckPermsApi {
|
||||
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
User getUser(String name);
|
||||
@Nullable
|
||||
User getUser(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Gets a wrapped user object from the user storage.
|
||||
@@ -146,13 +163,15 @@ public interface LuckPermsApi {
|
||||
* @return an optional {@link User} object
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Optional<User> getUserSafe(String name);
|
||||
@Nonnull
|
||||
Optional<User> getUserSafe(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Gets a set of all loaded users.
|
||||
*
|
||||
* @return a {@link Set} of {@link User} objects
|
||||
*/
|
||||
@Nonnull
|
||||
Set<User> getUsers();
|
||||
|
||||
/**
|
||||
@@ -162,7 +181,7 @@ public interface LuckPermsApi {
|
||||
* @return true if the user is loaded
|
||||
* @throws NullPointerException if the uuid is null
|
||||
*/
|
||||
boolean isUserLoaded(UUID uuid);
|
||||
boolean isUserLoaded(@Nonnull UUID uuid);
|
||||
|
||||
/**
|
||||
* Unload a user from the internal storage, if they're not currently online.
|
||||
@@ -171,7 +190,7 @@ public interface LuckPermsApi {
|
||||
* @throws NullPointerException if the user is null
|
||||
* @since 2.6
|
||||
*/
|
||||
void cleanupUser(User user);
|
||||
void cleanupUser(@Nonnull User user);
|
||||
|
||||
/**
|
||||
* Gets a wrapped group object from the group storage
|
||||
@@ -180,7 +199,8 @@ public interface LuckPermsApi {
|
||||
* @return a {@link Group} object, if one matching the name exists, or null if not
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Group getGroup(String name);
|
||||
@Nullable
|
||||
Group getGroup(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Gets a wrapped group object from the group storage.
|
||||
@@ -191,13 +211,15 @@ public interface LuckPermsApi {
|
||||
* @return an optional {@link Group} object
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Optional<Group> getGroupSafe(String name);
|
||||
@Nonnull
|
||||
Optional<Group> getGroupSafe(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Gets a set of all loaded groups.
|
||||
*
|
||||
* @return a {@link Set} of {@link Group} objects
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Group> getGroups();
|
||||
|
||||
/**
|
||||
@@ -207,7 +229,7 @@ public interface LuckPermsApi {
|
||||
* @return true if the group is loaded
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
boolean isGroupLoaded(String name);
|
||||
boolean isGroupLoaded(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Gets a wrapped track object from the track storage
|
||||
@@ -216,7 +238,8 @@ public interface LuckPermsApi {
|
||||
* @return a {@link Track} object, if one matching the name exists, or null if not
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Track getTrack(String name);
|
||||
@Nullable
|
||||
Track getTrack(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Gets a wrapped track object from the track storage.
|
||||
@@ -227,13 +250,15 @@ public interface LuckPermsApi {
|
||||
* @return an optional {@link Track} object
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Optional<Track> getTrackSafe(String name);
|
||||
@Nonnull
|
||||
Optional<Track> getTrackSafe(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Gets a set of all loaded tracks.
|
||||
*
|
||||
* @return a {@link Set} of {@link Track} objects
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Track> getTracks();
|
||||
|
||||
/**
|
||||
@@ -243,13 +268,14 @@ public interface LuckPermsApi {
|
||||
* @return true if the track is loaded
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
boolean isTrackLoaded(String name);
|
||||
boolean isTrackLoaded(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Gets the node factory instance for the platform
|
||||
*
|
||||
* @return the node factory
|
||||
*/
|
||||
@Nonnull
|
||||
NodeFactory getNodeFactory();
|
||||
|
||||
/**
|
||||
@@ -258,6 +284,7 @@ public interface LuckPermsApi {
|
||||
* @return the meta stack factory
|
||||
* @since 3.2
|
||||
*/
|
||||
@Nonnull
|
||||
MetaStackFactory getMetaStackFactory();
|
||||
|
||||
/**
|
||||
@@ -269,7 +296,8 @@ public interface LuckPermsApi {
|
||||
* @throws NullPointerException if the permission is null
|
||||
* @since 2.6
|
||||
*/
|
||||
Node.Builder buildNode(String permission) throws IllegalArgumentException;
|
||||
@Nonnull
|
||||
Node.Builder buildNode(@Nonnull String permission) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Register a custom context calculator to the server
|
||||
@@ -277,7 +305,7 @@ public interface LuckPermsApi {
|
||||
* @param contextCalculator the context calculator to register. The type MUST be the player class of the platform.
|
||||
* @throws ClassCastException if the type is not the player class of the platform.
|
||||
*/
|
||||
void registerContextCalculator(ContextCalculator<?> contextCalculator);
|
||||
void registerContextCalculator(@Nonnull ContextCalculator<?> contextCalculator);
|
||||
|
||||
/**
|
||||
* Gets a calculated context instance for the user using the rules of the platform.
|
||||
@@ -287,7 +315,8 @@ public interface LuckPermsApi {
|
||||
* @param user the user to get contexts for
|
||||
* @return an optional containing contexts. Will return empty if the user is not online.
|
||||
*/
|
||||
Optional<Contexts> getContextForUser(User user);
|
||||
@Nonnull
|
||||
Optional<Contexts> getContextForUser(@Nonnull User user);
|
||||
|
||||
/**
|
||||
* Gets set of contexts applicable to a player using the platforms {@link ContextCalculator}s.
|
||||
@@ -296,6 +325,34 @@ public interface LuckPermsApi {
|
||||
* @return a set of contexts.
|
||||
* @since 2.17
|
||||
*/
|
||||
ContextSet getContextForPlayer(Object player);
|
||||
@Nonnull
|
||||
ContextSet getContextForPlayer(@Nonnull Object player);
|
||||
|
||||
/**
|
||||
* Gets a Contexts instance for the player using the platforms {@link ContextCalculator}s.
|
||||
*
|
||||
* @param player the player to calculate for. Must be the player instance for the platform.
|
||||
* @return a set of contexts.
|
||||
* @since 3.3
|
||||
*/
|
||||
@Nonnull
|
||||
Contexts getContextsForPlayer(@Nonnull Object player);
|
||||
|
||||
/**
|
||||
* Gets the unique players which have connected to the server since it started.
|
||||
*
|
||||
* @return the unique connections
|
||||
* @since 3.3
|
||||
*/
|
||||
@Nonnull
|
||||
Set<UUID> getUniqueConnections();
|
||||
|
||||
/**
|
||||
* Gets the time when the plugin first started in milliseconds.
|
||||
*
|
||||
* @return the enable time
|
||||
* @since 3.3
|
||||
*/
|
||||
long getStartTime();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,6 +33,9 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* An immutable permission node
|
||||
*
|
||||
@@ -44,6 +50,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
*
|
||||
* @return the actual permission node
|
||||
*/
|
||||
@Nonnull
|
||||
String getPermission();
|
||||
|
||||
/**
|
||||
@@ -52,6 +59,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return the permission's value
|
||||
*/
|
||||
@Override
|
||||
@Nonnull
|
||||
Boolean getValue();
|
||||
|
||||
/**
|
||||
@@ -59,6 +67,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
*
|
||||
* @return the value of this node as a Tristate
|
||||
*/
|
||||
@Nonnull
|
||||
default Tristate getTristate() {
|
||||
return Tristate.fromBoolean(getValue());
|
||||
}
|
||||
@@ -85,6 +94,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
*
|
||||
* @return an {@link Optional} containing the server, if one is defined
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<String> getServer();
|
||||
|
||||
/**
|
||||
@@ -92,6 +102,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
*
|
||||
* @return an {@link Optional} containing the world, if one is defined
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<String> getWorld();
|
||||
|
||||
/**
|
||||
@@ -136,7 +147,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return true if the node should apply, otherwise false
|
||||
* @since 3.1
|
||||
*/
|
||||
boolean shouldApply(boolean includeGlobal, boolean includeGlobalWorld, String server, String world, ContextSet context, boolean applyRegex);
|
||||
boolean shouldApply(boolean includeGlobal, boolean includeGlobalWorld, @Nullable String server, @Nullable String world, @Nullable ContextSet context, boolean applyRegex);
|
||||
|
||||
/**
|
||||
* If this node should apply on a specific server
|
||||
@@ -146,7 +157,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @param applyRegex if regex should be applied
|
||||
* @return true if the node should apply
|
||||
*/
|
||||
boolean shouldApplyOnServer(String server, boolean includeGlobal, boolean applyRegex);
|
||||
boolean shouldApplyOnServer(@Nullable String server, boolean includeGlobal, boolean applyRegex);
|
||||
|
||||
/**
|
||||
* If this node should apply on a specific world
|
||||
@@ -156,7 +167,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @param applyRegex if regex should be applied
|
||||
* @return true if the node should apply
|
||||
*/
|
||||
boolean shouldApplyOnWorld(String world, boolean includeGlobal, boolean applyRegex);
|
||||
boolean shouldApplyOnWorld(@Nullable String world, boolean includeGlobal, boolean applyRegex);
|
||||
|
||||
/**
|
||||
* If this node should apply in the given context
|
||||
@@ -166,7 +177,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return true if the node should apply
|
||||
* @since 2.13
|
||||
*/
|
||||
boolean shouldApplyWithContext(ContextSet context, boolean worldAndServer);
|
||||
boolean shouldApplyWithContext(@Nonnull ContextSet context, boolean worldAndServer);
|
||||
|
||||
/**
|
||||
* If this node should apply in the given context
|
||||
@@ -175,7 +186,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return true if the node should apply
|
||||
* @since 2.13
|
||||
*/
|
||||
boolean shouldApplyWithContext(ContextSet context);
|
||||
boolean shouldApplyWithContext(@Nonnull ContextSet context);
|
||||
|
||||
/**
|
||||
* Similar to {@link #shouldApplyOnServer(String, boolean, boolean)}, except this method accepts a List
|
||||
@@ -184,7 +195,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @param includeGlobal if global permissions should apply
|
||||
* @return true if the node should apply
|
||||
*/
|
||||
boolean shouldApplyOnAnyServers(List<String> servers, boolean includeGlobal);
|
||||
boolean shouldApplyOnAnyServers(@Nonnull List<String> servers, boolean includeGlobal);
|
||||
|
||||
/**
|
||||
* Similar to {@link #shouldApplyOnWorld(String, boolean, boolean)}, except this method accepts a List
|
||||
@@ -193,7 +204,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @param includeGlobal if global permissions should apply
|
||||
* @return true if the node should apply
|
||||
*/
|
||||
boolean shouldApplyOnAnyWorlds(List<String> worlds, boolean includeGlobal);
|
||||
boolean shouldApplyOnAnyWorlds(@Nonnull List<String> worlds, boolean includeGlobal);
|
||||
|
||||
/**
|
||||
* Resolves a list of wildcards that match this node
|
||||
@@ -201,13 +212,15 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @param possibleNodes a list of possible permission nodes
|
||||
* @return a list of permissions that match this wildcard
|
||||
*/
|
||||
List<String> resolveWildcard(List<String> possibleNodes);
|
||||
@Nonnull
|
||||
List<String> resolveWildcard(@Nonnull List<String> possibleNodes);
|
||||
|
||||
/**
|
||||
* Resolves any shorthand parts of this node and returns the full list
|
||||
*
|
||||
* @return a list of full nodes
|
||||
*/
|
||||
@Nonnull
|
||||
List<String> resolveShorthand();
|
||||
|
||||
/**
|
||||
@@ -232,7 +245,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return the time in Unix time when this node will expire
|
||||
* @throws IllegalStateException if the node is not temporary
|
||||
*/
|
||||
long getExpiryUnixTime();
|
||||
long getExpiryUnixTime() throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Returns the date when this node will expire
|
||||
@@ -240,7 +253,8 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return the {@link Date} when this node will expire
|
||||
* @throws IllegalStateException if the node is not temporary
|
||||
*/
|
||||
Date getExpiry();
|
||||
@Nonnull
|
||||
Date getExpiry() throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Return the number of seconds until this permission will expire
|
||||
@@ -248,7 +262,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return the number of seconds until this permission will expire
|
||||
* @throws IllegalStateException if the node is not temporary
|
||||
*/
|
||||
long getSecondsTilExpiry();
|
||||
long getSecondsTilExpiry() throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Return true if the node has expired.
|
||||
@@ -264,6 +278,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return the extra contexts required for this node to apply
|
||||
* @since 2.13
|
||||
*/
|
||||
@Nonnull
|
||||
ContextSet getContexts();
|
||||
|
||||
/**
|
||||
@@ -272,6 +287,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return the full contexts required for this node to apply
|
||||
* @since 3.1
|
||||
*/
|
||||
@Nonnull
|
||||
ContextSet getFullContexts();
|
||||
|
||||
/**
|
||||
@@ -281,6 +297,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @deprecated because this serialized form is no longer used by the implementation.
|
||||
*/
|
||||
@Deprecated
|
||||
@Nonnull
|
||||
String toSerializedNode();
|
||||
|
||||
/**
|
||||
@@ -296,7 +313,8 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return the name of the group
|
||||
* @throws IllegalStateException if this is not a group node. See {@link #isGroupNode()}
|
||||
*/
|
||||
String getGroupName();
|
||||
@Nonnull
|
||||
String getGroupName() throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Returns if this node is a wildcard node
|
||||
@@ -311,7 +329,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return the wildcard level
|
||||
* @throws IllegalStateException if this is not a wildcard
|
||||
*/
|
||||
int getWildcardLevel();
|
||||
int getWildcardLevel() throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Returns if this node is a meta node
|
||||
@@ -326,7 +344,8 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return the meta value
|
||||
* @throws IllegalStateException if this node is not a meta node
|
||||
*/
|
||||
Map.Entry<String, String> getMeta();
|
||||
@Nonnull
|
||||
Map.Entry<String, String> getMeta() throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Returns if this node is a prefix node
|
||||
@@ -341,7 +360,8 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return the prefix value
|
||||
* @throws IllegalStateException if this node is a not a prefix node
|
||||
*/
|
||||
Map.Entry<Integer, String> getPrefix();
|
||||
@Nonnull
|
||||
Map.Entry<Integer, String> getPrefix() throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Returns if this node is a suffix node
|
||||
@@ -356,7 +376,8 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return the suffix value
|
||||
* @throws IllegalStateException if this node is a not a suffix node
|
||||
*/
|
||||
Map.Entry<Integer, String> getSuffix();
|
||||
@Nonnull
|
||||
Map.Entry<Integer, String> getSuffix() throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Checks if this Node is equal to another node
|
||||
@@ -365,6 +386,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return true if this node is equal to the other provided
|
||||
* @see #equalsIgnoringValue(Node) for a less strict implementation of this method
|
||||
*/
|
||||
@Override
|
||||
boolean equals(Object obj);
|
||||
|
||||
/**
|
||||
@@ -373,7 +395,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @param other the other node
|
||||
* @return true if the two nodes are almost equal
|
||||
*/
|
||||
boolean equalsIgnoringValue(Node other);
|
||||
boolean equalsIgnoringValue(@Nonnull Node other);
|
||||
|
||||
/**
|
||||
* Similar to {@link Node#equals(Object)}, except doesn't take note of the expiry time or value
|
||||
@@ -381,7 +403,7 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @param other the other node
|
||||
* @return true if the two nodes are almost equal
|
||||
*/
|
||||
boolean almostEquals(Node other);
|
||||
boolean almostEquals(@Nonnull Node other);
|
||||
|
||||
/**
|
||||
* Similar to {@link Node#equals(Object)}, except doesn't take note of the value or if the node is temporary
|
||||
@@ -390,38 +412,51 @@ public interface Node extends Map.Entry<String, Boolean> {
|
||||
* @return true if the two nodes are almost equal
|
||||
* @since 2.8
|
||||
*/
|
||||
boolean equalsIgnoringValueOrTemp(Node other);
|
||||
boolean equalsIgnoringValueOrTemp(@Nonnull Node other);
|
||||
|
||||
/**
|
||||
* Builds a Node instance
|
||||
*/
|
||||
interface Builder {
|
||||
|
||||
@Nonnull
|
||||
Builder setNegated(boolean negated);
|
||||
|
||||
@Nonnull
|
||||
Builder setValue(boolean value);
|
||||
|
||||
/**
|
||||
* Warning: this value does not persist, and disappears when the holder is re-loaded.
|
||||
* It is therefore only useful for transient nodes.
|
||||
*/
|
||||
@Nonnull
|
||||
Builder setOverride(boolean override);
|
||||
|
||||
@Nonnull
|
||||
Builder setExpiry(long expireAt);
|
||||
|
||||
Builder setWorld(String world);
|
||||
@Nonnull
|
||||
Builder setWorld(@Nonnull String world);
|
||||
|
||||
Builder setServer(String server) throws IllegalArgumentException;
|
||||
@Nonnull
|
||||
Builder setServer(@Nonnull String server) throws IllegalArgumentException;
|
||||
|
||||
Builder withExtraContext(String key, String value);
|
||||
@Nonnull
|
||||
Builder withExtraContext(@Nonnull String key, @Nonnull String value);
|
||||
|
||||
Builder withExtraContext(Map<String, String> map);
|
||||
@Nonnull
|
||||
Builder withExtraContext(@Nonnull Map<String, String> map);
|
||||
|
||||
Builder withExtraContext(Set<Map.Entry<String, String>> context);
|
||||
@Nonnull
|
||||
Builder withExtraContext(@Nonnull Set<Map.Entry<String, String>> context);
|
||||
|
||||
Builder withExtraContext(Map.Entry<String, String> entry);
|
||||
@Nonnull
|
||||
Builder withExtraContext(@Nonnull Map.Entry<String, String> entry);
|
||||
|
||||
Builder withExtraContext(ContextSet set);
|
||||
@Nonnull
|
||||
Builder withExtraContext(@Nonnull ContextSet set);
|
||||
|
||||
@Nonnull
|
||||
Node build();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Builds {@link Node} instances
|
||||
*
|
||||
@@ -40,7 +45,8 @@ public interface NodeFactory {
|
||||
* @see Node#toSerializedNode()
|
||||
*/
|
||||
@Deprecated
|
||||
Node fromSerialisedNode(String serialisedPermission, boolean value);
|
||||
@Nonnull
|
||||
Node fromSerialisedNode(@Nonnull String serialisedPermission, boolean value);
|
||||
|
||||
|
||||
/**
|
||||
@@ -50,7 +56,8 @@ public interface NodeFactory {
|
||||
* @return a node builder instance
|
||||
* @throws NullPointerException if the permission is null
|
||||
*/
|
||||
Node.Builder newBuilder(String permission);
|
||||
@Nonnull
|
||||
Node.Builder newBuilder(@Nonnull String permission);
|
||||
|
||||
/**
|
||||
* Creates a node builder instance from an existing node
|
||||
@@ -59,7 +66,8 @@ public interface NodeFactory {
|
||||
* @return a node builder instance
|
||||
* @throws NullPointerException if the other node is null
|
||||
*/
|
||||
Node.Builder newBuilderFromExisting(Node other);
|
||||
@Nonnull
|
||||
Node.Builder newBuilderFromExisting(@Nonnull Node other);
|
||||
|
||||
/**
|
||||
* Creates a node builder from a serialised node string
|
||||
@@ -72,7 +80,8 @@ public interface NodeFactory {
|
||||
* @see Node#toSerializedNode()
|
||||
*/
|
||||
@Deprecated
|
||||
Node.Builder newBuilderFromSerialisedNode(String serialisedPermission, boolean value);
|
||||
@Nonnull
|
||||
Node.Builder newBuilderFromSerialisedNode(@Nonnull String serialisedPermission, boolean value);
|
||||
|
||||
|
||||
/**
|
||||
@@ -84,7 +93,8 @@ public interface NodeFactory {
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @since 3.1
|
||||
*/
|
||||
Node.Builder makeGroupNode(Group group);
|
||||
@Nonnull
|
||||
Node.Builder makeGroupNode(@Nonnull Group group);
|
||||
|
||||
/**
|
||||
* Creates a node builder from a key value pair
|
||||
@@ -94,7 +104,8 @@ public interface NodeFactory {
|
||||
* @return a node builder instance
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
Node.Builder makeMetaNode(String key, String value);
|
||||
@Nonnull
|
||||
Node.Builder makeMetaNode(@Nonnull String key, @Nonnull String value);
|
||||
|
||||
/**
|
||||
* Creates a node builder for the given chat meta type
|
||||
@@ -105,7 +116,8 @@ public interface NodeFactory {
|
||||
* @throws NullPointerException if the type or value is null
|
||||
* @since 3.2
|
||||
*/
|
||||
Node.Builder makeChatMetaNode(ChatMetaType type, int priority, String value);
|
||||
@Nonnull
|
||||
Node.Builder makeChatMetaNode(@Nonnull ChatMetaType type, int priority, @Nonnull String value);
|
||||
|
||||
/**
|
||||
* Creates a node builder from a prefix string and priority
|
||||
@@ -115,7 +127,8 @@ public interface NodeFactory {
|
||||
* @return a node builder instance
|
||||
* @throws NullPointerException if the prefix is null
|
||||
*/
|
||||
Node.Builder makePrefixNode(int priority, String prefix);
|
||||
@Nonnull
|
||||
Node.Builder makePrefixNode(int priority, @Nonnull String prefix);
|
||||
|
||||
/**
|
||||
* Creates a node builder from a prefix string and priority
|
||||
@@ -125,6 +138,7 @@ public interface NodeFactory {
|
||||
* @return a node builder instance
|
||||
* @throws NullPointerException if the suffix is null
|
||||
*/
|
||||
Node.Builder makeSuffixNode(int priority, String suffix);
|
||||
@Nonnull
|
||||
Node.Builder makeSuffixNode(int priority, @Nonnull String suffix);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,15 +25,23 @@
|
||||
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* An object capable of holding permissions
|
||||
*
|
||||
@@ -46,6 +57,7 @@ public interface PermissionHolder {
|
||||
*
|
||||
* @return the identifier for this object. Either a uuid string or name.
|
||||
*/
|
||||
@Nonnull
|
||||
String getObjectName();
|
||||
|
||||
/**
|
||||
@@ -57,14 +69,57 @@ public interface PermissionHolder {
|
||||
* @return a friendly identifier for this holder
|
||||
* @since 3.2
|
||||
*/
|
||||
@Nonnull
|
||||
String getFriendlyName();
|
||||
|
||||
/**
|
||||
* Gets the backing multimap containing every permission this holder has.
|
||||
*
|
||||
* <p>This method <b>does not</b> resolve inheritance rules, and returns a
|
||||
* view of what's 'in the file'.</p>
|
||||
*
|
||||
* @return the holders own permissions
|
||||
* @since 3.3
|
||||
*/
|
||||
@Nonnull
|
||||
ImmutableSetMultimap<ImmutableContextSet, Node> getNodes();
|
||||
|
||||
/**
|
||||
* Gets the backing multimap containing every transient permission this holder has.
|
||||
*
|
||||
* <p>This method <b>does not</b> resolve inheritance rules.</p>
|
||||
*
|
||||
* <p>Transient permissions only exist for the duration of the session.</p>
|
||||
*
|
||||
* @return the holders own permissions
|
||||
* @since 3.3
|
||||
*/
|
||||
@Nonnull
|
||||
ImmutableSetMultimap<ImmutableContextSet, Node> getTransientNodes();
|
||||
|
||||
/**
|
||||
* Gets a flattened/squashed view of the holders permissions.
|
||||
*
|
||||
* <p>This list is constructed using the {@link Multimap#values()} method
|
||||
* of both the transient and enduring backing multimaps.</p>
|
||||
*
|
||||
* <p>This means that it <b>may contain</b> duplicate entries.</p>
|
||||
*
|
||||
* <p>Use {@link #getPermissions()} for a view without duplicates.</p>
|
||||
*
|
||||
* @return a list of the holders own nodes.
|
||||
* @since 3.3
|
||||
*/
|
||||
@Nonnull
|
||||
List<Node> getOwnNodes();
|
||||
|
||||
/**
|
||||
* Gets a sorted set of all held permissions.
|
||||
*
|
||||
* @return an immutable set of permissions in priority order
|
||||
* @since 2.6
|
||||
*/
|
||||
@Nonnull
|
||||
SortedSet<? extends Node> getPermissions();
|
||||
|
||||
/**
|
||||
@@ -75,6 +130,7 @@ public interface PermissionHolder {
|
||||
* @return a set of nodes
|
||||
* @since 2.6
|
||||
*/
|
||||
@Nonnull
|
||||
Set<? extends Node> getEnduringPermissions();
|
||||
|
||||
/**
|
||||
@@ -85,6 +141,7 @@ public interface PermissionHolder {
|
||||
* @return a set of nodes
|
||||
* @since 2.6
|
||||
*/
|
||||
@Nonnull
|
||||
Set<? extends Node> getTransientPermissions();
|
||||
|
||||
/**
|
||||
@@ -93,6 +150,7 @@ public interface PermissionHolder {
|
||||
* @return a set of permanent nodes
|
||||
* @since 2.6
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Node> getPermanentPermissionNodes();
|
||||
|
||||
/**
|
||||
@@ -101,8 +159,41 @@ public interface PermissionHolder {
|
||||
* @return a set of temporary nodes
|
||||
* @since 2.6
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Node> getTemporaryPermissionNodes();
|
||||
|
||||
/**
|
||||
* Recursively resolves this holders permissions.
|
||||
*
|
||||
* <p>The returned list will contain every inherited
|
||||
* node the holder has, in the order that they were inherited in.</p>
|
||||
*
|
||||
* <p>This means the list will contain duplicates.</p>
|
||||
*
|
||||
* @param contexts the contexts for the lookup
|
||||
* @return a list of nodes
|
||||
* @since 3.3
|
||||
*/
|
||||
@Nonnull
|
||||
List<LocalizedNode> resolveInheritances(Contexts contexts);
|
||||
|
||||
/**
|
||||
* Recursively resolves this holders permissions.
|
||||
*
|
||||
* <p>The returned list will contain every inherited
|
||||
* node the holder has, in the order that they were inherited in.</p>
|
||||
*
|
||||
* <p>This means the list will contain duplicates.</p>
|
||||
*
|
||||
* <p>Unlike {@link #resolveInheritances(Contexts)}, this method does not
|
||||
* filter by context, at all.</p>
|
||||
*
|
||||
* @return a list of nodes
|
||||
* @since 3.3
|
||||
*/
|
||||
@Nonnull
|
||||
List<LocalizedNode> resolveInheritances();
|
||||
|
||||
/**
|
||||
* Gets a mutable sorted set of the nodes that this object has and inherits, filtered by context
|
||||
*
|
||||
@@ -116,7 +207,22 @@ public interface PermissionHolder {
|
||||
* @throws NullPointerException if the context is null
|
||||
* @since 2.11
|
||||
*/
|
||||
SortedSet<LocalizedNode> getAllNodes(Contexts contexts);
|
||||
@Nonnull
|
||||
SortedSet<LocalizedNode> getAllNodes(@Nonnull Contexts contexts);
|
||||
|
||||
/**
|
||||
* Gets a mutable sorted set of the nodes that this object has and inherits.
|
||||
*
|
||||
* <p>Unlike {@link #getAllNodes(Contexts)}, this method does not filter by context, at all.</p>
|
||||
*
|
||||
* <p>Nodes are sorted into priority order.</p>
|
||||
*
|
||||
* @return a mutable sorted set of permissions
|
||||
* @throws NullPointerException if the context is null
|
||||
* @since 3.3
|
||||
*/
|
||||
@Nonnull
|
||||
SortedSet<LocalizedNode> getAllNodes();
|
||||
|
||||
/**
|
||||
* Gets a mutable set of the nodes that this object has and inherits, filtered by context.
|
||||
@@ -129,7 +235,8 @@ public interface PermissionHolder {
|
||||
* @throws NullPointerException if the context is null
|
||||
* @since 2.11
|
||||
*/
|
||||
Set<LocalizedNode> getAllNodesFiltered(Contexts contexts);
|
||||
@Nonnull
|
||||
Set<LocalizedNode> getAllNodesFiltered(@Nonnull Contexts contexts);
|
||||
|
||||
/**
|
||||
* Converts the output of {@link #getAllNodesFiltered(Contexts)}, and expands shorthand permissions.
|
||||
@@ -138,7 +245,8 @@ public interface PermissionHolder {
|
||||
* @param lowerCase if the keys should be made lowercase whilst being exported
|
||||
* @return a mutable map of permissions
|
||||
*/
|
||||
Map<String, Boolean> exportNodes(Contexts contexts, boolean lowerCase);
|
||||
@Nonnull
|
||||
Map<String, Boolean> exportNodes(@Nonnull Contexts contexts, boolean lowerCase);
|
||||
|
||||
/**
|
||||
* Removes temporary permissions that have expired
|
||||
@@ -153,7 +261,8 @@ public interface PermissionHolder {
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
Tristate hasPermission(Node node);
|
||||
@Nonnull
|
||||
Tristate hasPermission(@Nonnull Node node);
|
||||
|
||||
/**
|
||||
* Checks to see if the object has a certain permission
|
||||
@@ -163,7 +272,8 @@ public interface PermissionHolder {
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
Tristate hasTransientPermission(Node node);
|
||||
@Nonnull
|
||||
Tristate hasTransientPermission(@Nonnull Node node);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a certain permission
|
||||
@@ -173,7 +283,8 @@ public interface PermissionHolder {
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
Tristate inheritsPermission(Node node);
|
||||
@Nonnull
|
||||
Tristate inheritsPermission(@Nonnull Node node);
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
@@ -183,7 +294,7 @@ public interface PermissionHolder {
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
void setPermission(Node node) throws ObjectAlreadyHasException;
|
||||
void setPermission(@Nonnull Node node) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
@@ -193,7 +304,8 @@ public interface PermissionHolder {
|
||||
* @return the result of the operation
|
||||
* @since 3.1
|
||||
*/
|
||||
DataMutateResult setPermissionUnchecked(Node node);
|
||||
@Nonnull
|
||||
DataMutateResult setPermissionUnchecked(@Nonnull Node node);
|
||||
|
||||
/**
|
||||
* Sets a transient permission for the object
|
||||
@@ -212,7 +324,7 @@ public interface PermissionHolder {
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
void setTransientPermission(Node node) throws ObjectAlreadyHasException;
|
||||
void setTransientPermission(@Nonnull Node node) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a transient permission for the object
|
||||
@@ -231,7 +343,8 @@ public interface PermissionHolder {
|
||||
* @return the result of the operation
|
||||
* @since 3.1
|
||||
*/
|
||||
DataMutateResult setTransientPermissionUnchecked(Node node);
|
||||
@Nonnull
|
||||
DataMutateResult setTransientPermissionUnchecked(@Nonnull Node node);
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
@@ -241,7 +354,7 @@ public interface PermissionHolder {
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
void unsetPermission(Node node) throws ObjectLacksException;
|
||||
void unsetPermission(@Nonnull Node node) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
@@ -251,7 +364,8 @@ public interface PermissionHolder {
|
||||
* @return the result of the operation
|
||||
* @since 3.1
|
||||
*/
|
||||
DataMutateResult unsetPermissionUnchecked(Node node);
|
||||
@Nonnull
|
||||
DataMutateResult unsetPermissionUnchecked(@Nonnull Node node);
|
||||
|
||||
/**
|
||||
* Unsets a transient permission for the object
|
||||
@@ -261,7 +375,7 @@ public interface PermissionHolder {
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
void unsetTransientPermission(Node node) throws ObjectLacksException;
|
||||
void unsetTransientPermission(@Nonnull Node node) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a transient permission for the object
|
||||
@@ -271,7 +385,8 @@ public interface PermissionHolder {
|
||||
* @return the result of the operation
|
||||
* @since 3.1
|
||||
*/
|
||||
DataMutateResult unsetTransientPermissionUnchecked(Node node);
|
||||
@Nonnull
|
||||
DataMutateResult unsetTransientPermissionUnchecked(@Nonnull Node node);
|
||||
|
||||
/**
|
||||
* Clears any nodes from the holder which pass the predicate
|
||||
@@ -279,7 +394,7 @@ public interface PermissionHolder {
|
||||
* @param test the predicate to test for nodes which should be removed
|
||||
* @since 3.2
|
||||
*/
|
||||
void clearMatching(Predicate<Node> test);
|
||||
void clearMatching(@Nonnull Predicate<Node> test);
|
||||
|
||||
/**
|
||||
* Clears any transient nodes from the holder which pass the predicate
|
||||
@@ -287,7 +402,7 @@ public interface PermissionHolder {
|
||||
* @param test the predicate to test for nodes which should be removed
|
||||
* @since 3.2
|
||||
*/
|
||||
void clearMatchingTransient(Predicate<Node> test);
|
||||
void clearMatchingTransient(@Nonnull Predicate<Node> test);
|
||||
|
||||
/**
|
||||
* Clears all nodes held by the object
|
||||
@@ -302,7 +417,7 @@ public interface PermissionHolder {
|
||||
* @param contextSet the contexts to filter by
|
||||
* @since 3.2
|
||||
*/
|
||||
void clearNodes(ContextSet contextSet);
|
||||
void clearNodes(@Nonnull ContextSet contextSet);
|
||||
|
||||
/**
|
||||
* Clears all parent groups
|
||||
@@ -317,7 +432,7 @@ public interface PermissionHolder {
|
||||
* @param contextSet the contexts to filter by
|
||||
* @since 3.2
|
||||
*/
|
||||
void clearParents(ContextSet contextSet);
|
||||
void clearParents(@Nonnull ContextSet contextSet);
|
||||
|
||||
/**
|
||||
* Clears all meta held by the object
|
||||
@@ -332,7 +447,7 @@ public interface PermissionHolder {
|
||||
* @param contextSet the contexts to filter by
|
||||
* @since 3.2
|
||||
*/
|
||||
void clearMeta(ContextSet contextSet);
|
||||
void clearMeta(@Nonnull ContextSet contextSet);
|
||||
|
||||
/**
|
||||
* Clears all transient permissions the holder has.
|
||||
@@ -350,7 +465,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasPermission(String node, boolean b);
|
||||
boolean hasPermission(@Nonnull String node, boolean b);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
@@ -364,7 +479,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasPermission(String node, boolean b, String server);
|
||||
boolean hasPermission(@Nonnull String node, boolean b, @Nonnull String server);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server and world
|
||||
@@ -379,7 +494,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasPermission(String node, boolean b, String server, String world);
|
||||
boolean hasPermission(@Nonnull String node, boolean b, @Nonnull String server, @Nonnull String world);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission
|
||||
@@ -393,7 +508,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasPermission(String node, boolean b, boolean temporary);
|
||||
boolean hasPermission(@Nonnull String node, boolean b, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
@@ -408,7 +523,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasPermission(String node, boolean b, String server, boolean temporary);
|
||||
boolean hasPermission(@Nonnull String node, boolean b, @Nonnull String server, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server and world
|
||||
@@ -424,7 +539,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasPermission(String node, boolean b, String server, String world, boolean temporary);
|
||||
boolean hasPermission(@Nonnull String node, boolean b, @Nonnull String server, @Nonnull String world, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a certain permission
|
||||
@@ -437,7 +552,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean inheritsPermission(String node, boolean b);
|
||||
boolean inheritsPermission(@Nonnull String node, boolean b);
|
||||
|
||||
/**
|
||||
* Checks to see the the object inherits a permission on a certain server
|
||||
@@ -451,7 +566,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean inheritsPermission(String node, boolean b, String server);
|
||||
boolean inheritsPermission(@Nonnull String node, boolean b, @Nonnull String server);
|
||||
|
||||
/**
|
||||
* Checks to see the the object inherits a permission on a certain server and world
|
||||
@@ -466,7 +581,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean inheritsPermission(String node, boolean b, String server, String world);
|
||||
boolean inheritsPermission(@Nonnull String node, boolean b, @Nonnull String server, @Nonnull String world);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a permission
|
||||
@@ -480,7 +595,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean inheritsPermission(String node, boolean b, boolean temporary);
|
||||
boolean inheritsPermission(@Nonnull String node, boolean b, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a permission on a certain server
|
||||
@@ -495,7 +610,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean inheritsPermission(String node, boolean b, String server, boolean temporary);
|
||||
boolean inheritsPermission(@Nonnull String node, boolean b, @Nonnull String server, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a permission on a certain server and world
|
||||
@@ -511,7 +626,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #hasPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean inheritsPermission(String node, boolean b, String server, String world, boolean temporary);
|
||||
boolean inheritsPermission(@Nonnull String node, boolean b, @Nonnull String server, @Nonnull String world, boolean temporary);
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
@@ -524,7 +639,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value) throws ObjectAlreadyHasException;
|
||||
void setPermission(@Nonnull String node, boolean value) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a permission for the object on a specific server
|
||||
@@ -538,7 +653,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value, String server) throws ObjectAlreadyHasException;
|
||||
void setPermission(@Nonnull String node, boolean value, @Nonnull String server) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a permission for the object on a specific server and world
|
||||
@@ -553,7 +668,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value, String server, String world) throws ObjectAlreadyHasException;
|
||||
void setPermission(@Nonnull String node, boolean value, @Nonnull String server, @Nonnull String world) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a temporary permission for the object
|
||||
@@ -567,7 +682,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value, long expireAt) throws ObjectAlreadyHasException;
|
||||
void setPermission(@Nonnull String node, boolean value, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a temporary permission for the object on a specific server
|
||||
@@ -582,7 +697,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value, String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
void setPermission(@Nonnull String node, boolean value, @Nonnull String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a temporary permission for the object on a specific server and world
|
||||
@@ -598,7 +713,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value, String server, String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
void setPermission(String node, boolean value, @Nonnull String server, @Nonnull String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
@@ -611,7 +726,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node, boolean temporary) throws ObjectLacksException;
|
||||
void unsetPermission(@Nonnull String node, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
@@ -623,7 +738,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node) throws ObjectLacksException;
|
||||
void unsetPermission(@Nonnull String node) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object on a specific server
|
||||
@@ -636,7 +751,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node, String server) throws ObjectLacksException;
|
||||
void unsetPermission(@Nonnull String node, @Nonnull String server) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object on a specific server and world
|
||||
@@ -650,7 +765,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node, String server, String world) throws ObjectLacksException;
|
||||
void unsetPermission(@Nonnull String node, @Nonnull String server, @Nonnull String world) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object on a specific server
|
||||
@@ -664,7 +779,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node, String server, boolean temporary) throws ObjectLacksException;
|
||||
void unsetPermission(@Nonnull String node, @Nonnull String server, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object on a specific server and world
|
||||
@@ -679,7 +794,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node, String server, String world, boolean temporary) throws ObjectLacksException;
|
||||
void unsetPermission(@Nonnull String node, @Nonnull String server, @Nonnull String world, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Clears all nodes held by the object on a specific server
|
||||
@@ -689,7 +804,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #clearNodes(ContextSet)}
|
||||
*/
|
||||
@Deprecated
|
||||
void clearNodes(String server);
|
||||
void clearNodes(@Nullable String server);
|
||||
|
||||
/**
|
||||
* Clears all nodes held by the object on a specific server and world
|
||||
@@ -700,7 +815,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #clearNodes(ContextSet)}
|
||||
*/
|
||||
@Deprecated
|
||||
void clearNodes(String server, String world);
|
||||
void clearNodes(@Nullable String server, @Nullable String world);
|
||||
|
||||
/**
|
||||
* Clears all parents on a specific server
|
||||
@@ -710,7 +825,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #clearParents(ContextSet)}
|
||||
*/
|
||||
@Deprecated
|
||||
void clearParents(String server);
|
||||
void clearParents(@Nullable String server);
|
||||
|
||||
/**
|
||||
* Clears all parents on a specific server and world
|
||||
@@ -721,7 +836,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #clearParents(ContextSet)}
|
||||
*/
|
||||
@Deprecated
|
||||
void clearParents(String server, String world);
|
||||
void clearParents(@Nullable String server, @Nullable String world);
|
||||
|
||||
/**
|
||||
* Clears all meta held by the object on a specific server
|
||||
@@ -731,7 +846,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #clearMeta(ContextSet)}
|
||||
*/
|
||||
@Deprecated
|
||||
void clearMeta(String server);
|
||||
void clearMeta(@Nullable String server);
|
||||
|
||||
/**
|
||||
* Clears all meta held by the object on a specific server and world
|
||||
@@ -742,7 +857,7 @@ public interface PermissionHolder {
|
||||
* @deprecated in favour of {@link #clearMeta(ContextSet)}
|
||||
*/
|
||||
@Deprecated
|
||||
void clearMeta(String server, String world);
|
||||
void clearMeta(@Nullable String server, @Nullable String world);
|
||||
|
||||
/**
|
||||
* Clears all meta for a given key.
|
||||
@@ -751,9 +866,9 @@ public interface PermissionHolder {
|
||||
* @param server the server to filter by, can be null
|
||||
* @param world the world to filter by, can be null
|
||||
* @param temporary whether the query is for temporary nodes or not.
|
||||
* @deprecated in favour of {@link #removeIf(Predicate)}
|
||||
* @deprecated in favour of {@link #clearMatching(Predicate)}
|
||||
*/
|
||||
@Deprecated
|
||||
void clearMetaKeys(String key, String server, String world, boolean temporary);
|
||||
void clearMetaKeys(@Nonnull String key, @Nullable String server, @Nullable String world, boolean temporary);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* The platforms which LuckPerms can run on
|
||||
*
|
||||
@@ -39,6 +44,7 @@ public enum PlatformType {
|
||||
this.friendlyName = friendlyName;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getFriendlyName() {
|
||||
return friendlyName;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -29,6 +32,9 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A means of loading and saving data to/from the Storage provider.
|
||||
*
|
||||
@@ -49,6 +55,7 @@ public interface Storage {
|
||||
*
|
||||
* @return the name of the implementation
|
||||
*/
|
||||
@Nonnull
|
||||
String getName();
|
||||
|
||||
/**
|
||||
@@ -63,6 +70,7 @@ public interface Storage {
|
||||
*
|
||||
* @return an executor instance
|
||||
*/
|
||||
@Nonnull
|
||||
Executor getSyncExecutor();
|
||||
|
||||
/**
|
||||
@@ -71,6 +79,7 @@ public interface Storage {
|
||||
*
|
||||
* @return an executor instance
|
||||
*/
|
||||
@Nonnull
|
||||
Executor getAsyncExecutor();
|
||||
|
||||
/**
|
||||
@@ -80,13 +89,15 @@ public interface Storage {
|
||||
* @return true if the operation completed successfully.
|
||||
* @throws NullPointerException if entry is null
|
||||
*/
|
||||
CompletableFuture<Boolean> logAction(LogEntry entry);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> logAction(@Nonnull LogEntry entry);
|
||||
|
||||
/**
|
||||
* Loads and returns the entire log from storage
|
||||
*
|
||||
* @return a log instance, could be null if loading failed
|
||||
*/
|
||||
@Nonnull
|
||||
CompletableFuture<Log> getLog();
|
||||
|
||||
/**
|
||||
@@ -97,7 +108,8 @@ public interface Storage {
|
||||
* @return if the operation completed successfully
|
||||
* @throws NullPointerException if uuid is null
|
||||
*/
|
||||
CompletableFuture<Boolean> loadUser(UUID uuid, String username);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> loadUser(@Nonnull UUID uuid, @Nullable String username);
|
||||
|
||||
/**
|
||||
* Loads a user's data from the main storage into the plugins local storage.
|
||||
@@ -106,7 +118,8 @@ public interface Storage {
|
||||
* @return if the operation completed successfully
|
||||
* @throws NullPointerException if uuid is null
|
||||
*/
|
||||
default CompletableFuture<Boolean> loadUser(UUID uuid) {
|
||||
@Nonnull
|
||||
default CompletableFuture<Boolean> loadUser(@Nonnull UUID uuid) {
|
||||
return loadUser(uuid, null);
|
||||
}
|
||||
|
||||
@@ -118,13 +131,15 @@ public interface Storage {
|
||||
* @throws NullPointerException if user is null
|
||||
* @throws IllegalStateException if the user instance was not obtained from LuckPerms.
|
||||
*/
|
||||
CompletableFuture<Boolean> saveUser(User user);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> saveUser(@Nonnull User user);
|
||||
|
||||
/**
|
||||
* Removes users from the main storage who are "default". This is called every time the plugin loads.
|
||||
*
|
||||
* @return true if the operation completed successfully
|
||||
*/
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> cleanupUsers();
|
||||
|
||||
/**
|
||||
@@ -133,6 +148,7 @@ public interface Storage {
|
||||
*
|
||||
* @return a set of uuids, or null if the operation failed.
|
||||
*/
|
||||
@Nonnull
|
||||
CompletableFuture<Set<UUID>> getUniqueUsers();
|
||||
|
||||
/**
|
||||
@@ -143,7 +159,8 @@ public interface Storage {
|
||||
* @throws NullPointerException if the permission is null
|
||||
* @since 2.17
|
||||
*/
|
||||
CompletableFuture<List<HeldPermission<UUID>>> getUsersWithPermission(String permission);
|
||||
@Nonnull
|
||||
CompletableFuture<List<HeldPermission<UUID>>> getUsersWithPermission(@Nonnull String permission);
|
||||
|
||||
/**
|
||||
* Creates and loads a group into the plugins local storage
|
||||
@@ -153,7 +170,8 @@ public interface Storage {
|
||||
* @throws NullPointerException if name is null
|
||||
* @throws IllegalArgumentException if the name is invalid
|
||||
*/
|
||||
CompletableFuture<Boolean> createAndLoadGroup(String name);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> createAndLoadGroup(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Loads a group into the plugins local storage.
|
||||
@@ -163,13 +181,15 @@ public interface Storage {
|
||||
* @throws NullPointerException if name is null
|
||||
* @throws IllegalArgumentException if the name is invalid
|
||||
*/
|
||||
CompletableFuture<Boolean> loadGroup(String name);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> loadGroup(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Loads all groups from the storage into memory
|
||||
*
|
||||
* @return true if the operation completed successfully.
|
||||
*/
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> loadAllGroups();
|
||||
|
||||
/**
|
||||
@@ -180,7 +200,8 @@ public interface Storage {
|
||||
* @throws NullPointerException if group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
CompletableFuture<Boolean> saveGroup(Group group);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> saveGroup(@Nonnull Group group);
|
||||
|
||||
/**
|
||||
* Permanently deletes a group from storage.
|
||||
@@ -190,7 +211,8 @@ public interface Storage {
|
||||
* @throws NullPointerException if group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
CompletableFuture<Boolean> deleteGroup(Group group);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> deleteGroup(@Nonnull Group group);
|
||||
|
||||
/**
|
||||
* Searches for a list of groups with a given permission.
|
||||
@@ -200,7 +222,8 @@ public interface Storage {
|
||||
* @throws NullPointerException if the permission is null
|
||||
* @since 2.17
|
||||
*/
|
||||
CompletableFuture<List<HeldPermission<String>>> getGroupsWithPermission(String permission);
|
||||
@Nonnull
|
||||
CompletableFuture<List<HeldPermission<String>>> getGroupsWithPermission(@Nonnull String permission);
|
||||
|
||||
/**
|
||||
* Creates and loads a track into the plugins local storage
|
||||
@@ -210,7 +233,8 @@ public interface Storage {
|
||||
* @throws NullPointerException if name is null
|
||||
* @throws IllegalArgumentException if the name is invalid
|
||||
*/
|
||||
CompletableFuture<Boolean> createAndLoadTrack(String name);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> createAndLoadTrack(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Loads a track into the plugins local storage.
|
||||
@@ -220,13 +244,15 @@ public interface Storage {
|
||||
* @throws NullPointerException if name is null
|
||||
* @throws IllegalArgumentException if the name is invalid
|
||||
*/
|
||||
CompletableFuture<Boolean> loadTrack(String name);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> loadTrack(@Nonnull String name);
|
||||
|
||||
/**
|
||||
* Loads all tracks from the storage into memory
|
||||
*
|
||||
* @return true if the operation completed successfully.
|
||||
*/
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> loadAllTracks();
|
||||
|
||||
/**
|
||||
@@ -237,7 +263,8 @@ public interface Storage {
|
||||
* @throws NullPointerException if track is null
|
||||
* @throws IllegalStateException if the track instance was not obtained from LuckPerms.
|
||||
*/
|
||||
CompletableFuture<Boolean> saveTrack(Track track);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> saveTrack(@Nonnull Track track);
|
||||
|
||||
/**
|
||||
* Permanently deletes a track from storage
|
||||
@@ -247,7 +274,8 @@ public interface Storage {
|
||||
* @throws NullPointerException if track is null
|
||||
* @throws IllegalStateException if the track instance was not obtained from LuckPerms.
|
||||
*/
|
||||
CompletableFuture<Boolean> deleteTrack(Track track);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> deleteTrack(@Nonnull Track track);
|
||||
|
||||
/**
|
||||
* Saves UUID caching data to the global cache
|
||||
@@ -258,7 +286,8 @@ public interface Storage {
|
||||
* @throws NullPointerException if either parameters are null
|
||||
* @throws IllegalArgumentException if the username is invalid
|
||||
*/
|
||||
CompletableFuture<Boolean> saveUUIDData(String username, UUID uuid);
|
||||
@Nonnull
|
||||
CompletableFuture<Boolean> saveUUIDData(@Nonnull String username, @Nonnull UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets a UUID from a username
|
||||
@@ -268,7 +297,8 @@ public interface Storage {
|
||||
* @throws NullPointerException if either parameters are null
|
||||
* @throws IllegalArgumentException if the username is invalid
|
||||
*/
|
||||
CompletableFuture<UUID> getUUID(String username);
|
||||
@Nonnull
|
||||
CompletableFuture<UUID> getUUID(@Nonnull String username);
|
||||
|
||||
/**
|
||||
* Gets a username from a UUID
|
||||
@@ -278,6 +308,7 @@ public interface Storage {
|
||||
* @throws NullPointerException if either parameters are null
|
||||
* @since 2.17
|
||||
*/
|
||||
CompletableFuture<String> getName(UUID uuid);
|
||||
@Nonnull
|
||||
CompletableFuture<String> getName(@Nonnull UUID uuid);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,6 +30,9 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* An ordered collection of groups for easy promotions and demotions
|
||||
*/
|
||||
@@ -36,6 +42,7 @@ public interface Track {
|
||||
* Gets the name of this track
|
||||
* @return the name of this track
|
||||
*/
|
||||
@Nonnull
|
||||
String getName();
|
||||
|
||||
/**
|
||||
@@ -45,6 +52,7 @@ public interface Track {
|
||||
*
|
||||
* @return an ordered {@link List} of the groups on this track
|
||||
*/
|
||||
@Nonnull
|
||||
List<String> getGroups();
|
||||
|
||||
/**
|
||||
@@ -63,7 +71,8 @@ public interface Track {
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
String getNext(Group current) throws ObjectLacksException;
|
||||
@Nullable
|
||||
String getNext(@Nonnull Group current) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Gets the previous group on the track, before the one provided
|
||||
@@ -74,7 +83,8 @@ public interface Track {
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
String getPrevious(Group current) throws ObjectLacksException;
|
||||
@Nullable
|
||||
String getPrevious(@Nonnull Group current) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Appends a group to the end of this track
|
||||
@@ -84,7 +94,7 @@ public interface Track {
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
void appendGroup(Group group) throws ObjectAlreadyHasException;
|
||||
void appendGroup(@Nonnull Group group) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Inserts a group at a certain position on this track
|
||||
@@ -96,7 +106,7 @@ public interface Track {
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
void insertGroup(Group group, int position) throws ObjectAlreadyHasException, IndexOutOfBoundsException;
|
||||
void insertGroup(@Nonnull Group group, int position) throws ObjectAlreadyHasException, IndexOutOfBoundsException;
|
||||
|
||||
/**
|
||||
* Removes a group from this track
|
||||
@@ -106,7 +116,7 @@ public interface Track {
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
void removeGroup(Group group) throws ObjectLacksException;
|
||||
void removeGroup(@Nonnull Group group) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Removes a group from this track
|
||||
@@ -115,7 +125,7 @@ public interface Track {
|
||||
* @throws ObjectLacksException if the group is not on this track
|
||||
* @throws NullPointerException if the group is null
|
||||
*/
|
||||
void removeGroup(String group) throws ObjectLacksException;
|
||||
void removeGroup(@Nonnull String group) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Checks if a group features on this track
|
||||
@@ -125,7 +135,7 @@ public interface Track {
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
boolean containsGroup(Group group);
|
||||
boolean containsGroup(@Nonnull Group group);
|
||||
|
||||
/**
|
||||
* Checks if a group features on this track
|
||||
@@ -134,7 +144,7 @@ public interface Track {
|
||||
* @return true if the group is on this track
|
||||
* @throws NullPointerException if the group is null
|
||||
*/
|
||||
boolean containsGroup(String group);
|
||||
boolean containsGroup(@Nonnull String group);
|
||||
|
||||
/**
|
||||
* Clear all of the groups from this track
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Represents a permission setting.
|
||||
*
|
||||
@@ -51,6 +56,7 @@ public enum Tristate {
|
||||
* @param b the boolean
|
||||
* @return {@link #TRUE} or {@link #FALSE}, depending on the value of the boolean.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Tristate fromBoolean(boolean b) {
|
||||
return b ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,6 +34,9 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A player holding permission data
|
||||
*/
|
||||
@@ -41,6 +47,7 @@ public interface User extends PermissionHolder {
|
||||
*
|
||||
* @return the users Mojang assigned unique id
|
||||
*/
|
||||
@Nonnull
|
||||
UUID getUuid();
|
||||
|
||||
/**
|
||||
@@ -48,16 +55,18 @@ public interface User extends PermissionHolder {
|
||||
*
|
||||
* @return the users username
|
||||
*/
|
||||
@Nullable
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the users current primary group.
|
||||
* Gets the users current primary group.
|
||||
*
|
||||
* <p>The result of this method depends on which method is configured for primary group calculation. It may not
|
||||
* be the same as any value set through {@link #setPrimaryGroup(String)}.</p>
|
||||
*
|
||||
* @return the users primary group
|
||||
*/
|
||||
@Nonnull
|
||||
String getPrimaryGroup();
|
||||
|
||||
/**
|
||||
@@ -68,7 +77,7 @@ public interface User extends PermissionHolder {
|
||||
* @throws IllegalStateException if the user is not a member of that group
|
||||
* @throws NullPointerException if the group is null
|
||||
*/
|
||||
void setPrimaryGroup(String group) throws ObjectAlreadyHasException;
|
||||
void setPrimaryGroup(@Nonnull String group) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Refresh and re-assign the users permissions.
|
||||
@@ -84,6 +93,7 @@ public interface User extends PermissionHolder {
|
||||
* @return the users cached data.
|
||||
* @since 3.2
|
||||
*/
|
||||
@Nonnull
|
||||
UserData getCachedData();
|
||||
|
||||
/**
|
||||
@@ -94,7 +104,7 @@ public interface User extends PermissionHolder {
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
boolean isInGroup(Group group);
|
||||
boolean isInGroup(@Nonnull Group group);
|
||||
|
||||
/**
|
||||
* Check to see if the user is a direct member of a group in a specific context
|
||||
@@ -105,7 +115,7 @@ public interface User extends PermissionHolder {
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @since 3.2
|
||||
*/
|
||||
boolean isInGroup(Group group, ContextSet contextSet);
|
||||
boolean isInGroup(@Nonnull Group group, @Nonnull ContextSet contextSet);
|
||||
|
||||
/**
|
||||
* Gets the user's {@link UserData} cache, if they have one setup.
|
||||
@@ -115,15 +125,17 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in version 3.2, as this cache is now always loaded
|
||||
*/
|
||||
@Deprecated
|
||||
@Nonnull
|
||||
Optional<UserData> getUserDataCache();
|
||||
|
||||
/**
|
||||
* Sets up the users data cache, if the don't have one setup already.
|
||||
* Pre-calculates some values in the user's data cache.
|
||||
*
|
||||
* <p>Is it <b>not</b> necessary to call this method before
|
||||
* using {@link #getCachedData()}.</p>
|
||||
*
|
||||
* @since 2.17
|
||||
* @deprecated in version 3.2, as this cache is now always loaded.
|
||||
*/
|
||||
@Deprecated
|
||||
void setupDataCache();
|
||||
|
||||
/**
|
||||
@@ -137,7 +149,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link #isInGroup(Group, ContextSet)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isInGroup(Group group, String server);
|
||||
boolean isInGroup(@Nonnull Group group, @Nonnull String server);
|
||||
|
||||
/**
|
||||
* Check to see if a user is a member of a group on a specific server and world
|
||||
@@ -151,7 +163,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link #isInGroup(Group, ContextSet)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isInGroup(Group group, String server, String world);
|
||||
boolean isInGroup(@Nonnull Group group, @Nonnull String server, @Nonnull String world);
|
||||
|
||||
/**
|
||||
* Add a user to a group
|
||||
@@ -163,7 +175,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void addGroup(Group group) throws ObjectAlreadyHasException;
|
||||
void addGroup(@Nonnull Group group) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group on a specific server
|
||||
@@ -177,7 +189,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void addGroup(Group group, String server) throws ObjectAlreadyHasException;
|
||||
void addGroup(@Nonnull Group group, @Nonnull String server) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group on a specific server and world
|
||||
@@ -192,7 +204,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void addGroup(Group group, String server, String world) throws ObjectAlreadyHasException;
|
||||
void addGroup(@Nonnull Group group, @Nonnull String server, @Nonnull String world) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group temporarily on a specific server
|
||||
@@ -206,7 +218,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void addGroup(Group group, long expireAt) throws ObjectAlreadyHasException;
|
||||
void addGroup(@Nonnull Group group, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group temporarily on a specific server
|
||||
@@ -221,7 +233,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void addGroup(Group group, String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
void addGroup(@Nonnull Group group, @Nonnull String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group temporarily on a specific server and world
|
||||
@@ -237,7 +249,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void addGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
void addGroup(@Nonnull Group group, @Nonnull String server, @Nonnull String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
@@ -249,7 +261,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void removeGroup(Group group) throws ObjectLacksException;
|
||||
void removeGroup(@Nonnull Group group) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
@@ -262,7 +274,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void removeGroup(Group group, boolean temporary) throws ObjectLacksException;
|
||||
void removeGroup(@Nonnull Group group, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group on a specific server
|
||||
@@ -276,7 +288,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void removeGroup(Group group, String server) throws ObjectLacksException;
|
||||
void removeGroup(@Nonnull Group group, @Nonnull String server) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group on a specific server and world
|
||||
@@ -291,7 +303,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void removeGroup(Group group, String server, String world) throws ObjectLacksException;
|
||||
void removeGroup(@Nonnull Group group, @Nonnull String server, @Nonnull String world) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group on a specific server
|
||||
@@ -306,7 +318,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void removeGroup(Group group, String server, boolean temporary) throws ObjectLacksException;
|
||||
void removeGroup(@Nonnull Group group, @Nonnull String server, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group on a specific server and world
|
||||
@@ -322,7 +334,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of {@link NodeFactory#makeGroupNode(Group)}
|
||||
*/
|
||||
@Deprecated
|
||||
void removeGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
|
||||
void removeGroup(@Nonnull Group group, @Nonnull String server, @Nonnull String world, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Get a {@link List} of all of the groups the user is a member of, on all servers
|
||||
@@ -331,6 +343,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of just querying a users permissions
|
||||
*/
|
||||
@Deprecated
|
||||
@Nonnull
|
||||
List<String> getGroupNames();
|
||||
|
||||
/**
|
||||
@@ -344,7 +357,8 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of just querying a users permissions
|
||||
*/
|
||||
@Deprecated
|
||||
List<String> getLocalGroups(String server, String world);
|
||||
@Nonnull
|
||||
List<String> getLocalGroups(@Nonnull String server, @Nonnull String world);
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the user is a member of on a specific server
|
||||
@@ -356,6 +370,7 @@ public interface User extends PermissionHolder {
|
||||
* @deprecated in favour of just querying a users permissions
|
||||
*/
|
||||
@Deprecated
|
||||
List<String> getLocalGroups(String server);
|
||||
@Nonnull
|
||||
List<String> getLocalGroups(@Nonnull String server);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,6 +27,8 @@ package me.lucko.luckperms.api;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* A UUID cache for online users, between external Mojang UUIDs, and internal LuckPerms UUIDs.
|
||||
*
|
||||
@@ -45,7 +50,8 @@ public interface UuidCache {
|
||||
* @param external the UUID assigned by the server, through Player#getUniqueId or ProxiedPlayer#getUniqueId
|
||||
* @return the corresponding internal UUID
|
||||
*/
|
||||
UUID getUUID(UUID external);
|
||||
@Nonnull
|
||||
UUID getUUID(@Nonnull UUID external);
|
||||
|
||||
/**
|
||||
* Gets a users external, server assigned or Mojang assigned unique id, from the internal one used within LuckPerms.
|
||||
@@ -53,6 +59,7 @@ public interface UuidCache {
|
||||
* @param internal the UUID used within LuckPerms, through User#getUuid
|
||||
* @return the corresponding external UUID
|
||||
*/
|
||||
UUID getExternalUUID(UUID internal);
|
||||
@Nonnull
|
||||
UUID getExternalUUID(@Nonnull UUID internal);
|
||||
|
||||
}
|
||||
@@ -30,6 +30,8 @@ import com.google.common.base.Preconditions;
|
||||
import me.lucko.luckperms.api.Contexts;
|
||||
import me.lucko.luckperms.api.metastacking.MetaStackDefinition;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Represents the context for a meta lookup, consisting of a standard {@link Contexts} element, plus options to define how
|
||||
* the meta stack should be constructed.
|
||||
@@ -46,7 +48,7 @@ public final class MetaContexts {
|
||||
* @param suffixStackDefinition the suffix stack definition to be used
|
||||
* @return the new instance
|
||||
*/
|
||||
public static MetaContexts of(Contexts contexts, MetaStackDefinition prefixStackDefinition, MetaStackDefinition suffixStackDefinition) {
|
||||
public static MetaContexts of(@Nonnull Contexts contexts, @Nonnull MetaStackDefinition prefixStackDefinition, @Nonnull MetaStackDefinition suffixStackDefinition) {
|
||||
return new MetaContexts(contexts, prefixStackDefinition, suffixStackDefinition);
|
||||
}
|
||||
|
||||
@@ -61,25 +63,29 @@ public final class MetaContexts {
|
||||
* @param prefixStackDefinition the prefix stack definition to be used
|
||||
* @param suffixStackDefinition the suffix stack definition to be used
|
||||
*/
|
||||
public MetaContexts(Contexts contexts, MetaStackDefinition prefixStackDefinition, MetaStackDefinition suffixStackDefinition) {
|
||||
public MetaContexts(@Nonnull Contexts contexts, @Nonnull MetaStackDefinition prefixStackDefinition, @Nonnull MetaStackDefinition suffixStackDefinition) {
|
||||
this.contexts = Preconditions.checkNotNull(contexts, "contexts");
|
||||
this.prefixStackDefinition = Preconditions.checkNotNull(prefixStackDefinition, "prefixStackDefinition");
|
||||
this.suffixStackDefinition = Preconditions.checkNotNull(suffixStackDefinition, "suffixStackDefinition");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Contexts getContexts() {
|
||||
return this.contexts;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public MetaStackDefinition getPrefixStackDefinition() {
|
||||
return this.prefixStackDefinition;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public MetaStackDefinition getSuffixStackDefinition() {
|
||||
return this.suffixStackDefinition;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public String toString() {
|
||||
return "MetaContexts(" +
|
||||
"contexts=" + this.getContexts() + ", " +
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,11 +25,16 @@
|
||||
|
||||
package me.lucko.luckperms.api.caching;
|
||||
|
||||
import com.google.common.collect.ListMultimap;
|
||||
|
||||
import me.lucko.luckperms.api.metastacking.MetaStackDefinition;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Holds cached Meta lookup data for a specific set of contexts
|
||||
*
|
||||
@@ -35,10 +43,29 @@ import java.util.SortedMap;
|
||||
public interface MetaData {
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the meta this user has
|
||||
* Gets an immutable copy of the meta this user has.
|
||||
*
|
||||
* <p>A list multimap is used because when inherited values are included, each key can be
|
||||
* mapped to multiple values.</p>
|
||||
*
|
||||
* <p>The first value to be accumulated (and used to represent the key in {@link #getMeta()} is at index 0
|
||||
* in the list. Any additional values are stored in order of accumulation.</p>
|
||||
*
|
||||
* @return an immutable multimap of meta
|
||||
* @since 3.3
|
||||
*/
|
||||
@Nonnull
|
||||
ListMultimap<String, String> getMetaMultimap();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the meta this user has.
|
||||
*
|
||||
* <p>This map is formed by taking the entries in {@link #getMetaMultimap()}, and mapping each key
|
||||
* to the value at index 0 in the corresponding list.</p>
|
||||
*
|
||||
* @return an immutable map of meta
|
||||
*/
|
||||
@Nonnull
|
||||
Map<String, String> getMeta();
|
||||
|
||||
/**
|
||||
@@ -47,6 +74,7 @@ public interface MetaData {
|
||||
*
|
||||
* @return a sorted map of prefixes
|
||||
*/
|
||||
@Nonnull
|
||||
SortedMap<Integer, String> getPrefixes();
|
||||
|
||||
/**
|
||||
@@ -55,6 +83,7 @@ public interface MetaData {
|
||||
*
|
||||
* @return a sorted map of suffixes
|
||||
*/
|
||||
@Nonnull
|
||||
SortedMap<Integer, String> getSuffixes();
|
||||
|
||||
/**
|
||||
@@ -62,6 +91,7 @@ public interface MetaData {
|
||||
*
|
||||
* @return a prefix string, or null
|
||||
*/
|
||||
@Nullable
|
||||
String getPrefix();
|
||||
|
||||
/**
|
||||
@@ -69,6 +99,7 @@ public interface MetaData {
|
||||
*
|
||||
* @return a suffix string, or null
|
||||
*/
|
||||
@Nullable
|
||||
String getSuffix();
|
||||
|
||||
/**
|
||||
@@ -77,6 +108,7 @@ public interface MetaData {
|
||||
* @return the definition used for the prefix stack
|
||||
* @since 3.2
|
||||
*/
|
||||
@Nonnull
|
||||
MetaStackDefinition getPrefixStackDefinition();
|
||||
|
||||
/**
|
||||
@@ -85,6 +117,7 @@ public interface MetaData {
|
||||
* @return the definition used for the suffix stack
|
||||
* @since 3.2
|
||||
*/
|
||||
@Nonnull
|
||||
MetaStackDefinition getSuffixStackDefinition();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import me.lucko.luckperms.api.Tristate;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Holds cached Permission lookup data for a specific set of contexts
|
||||
*
|
||||
@@ -40,7 +45,8 @@ public interface PermissionData {
|
||||
* @return a tristate result
|
||||
* @throws NullPointerException if permission is null
|
||||
*/
|
||||
Tristate getPermissionValue(String permission);
|
||||
@Nonnull
|
||||
Tristate getPermissionValue(@Nonnull String permission);
|
||||
|
||||
/**
|
||||
* Invalidates the underlying permission calculator cache.
|
||||
@@ -54,6 +60,7 @@ public interface PermissionData {
|
||||
*
|
||||
* @return an immutable set of permissions
|
||||
*/
|
||||
@Nonnull
|
||||
Map<String, Boolean> getImmutableBacking();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import me.lucko.luckperms.api.Contexts;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Holds cached permission and meta lookup data for a {@link me.lucko.luckperms.api.User}.
|
||||
*
|
||||
@@ -49,7 +54,8 @@ public interface UserData {
|
||||
* @return a permission data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
PermissionData getPermissionData(Contexts contexts);
|
||||
@Nonnull
|
||||
PermissionData getPermissionData(@Nonnull Contexts contexts);
|
||||
|
||||
/**
|
||||
* Gets MetaData from the cache, given a specified context.
|
||||
@@ -61,7 +67,8 @@ public interface UserData {
|
||||
* @throws NullPointerException if contexts is null
|
||||
* @since 3.2
|
||||
*/
|
||||
MetaData getMetaData(MetaContexts contexts);
|
||||
@Nonnull
|
||||
MetaData getMetaData(@Nonnull MetaContexts contexts);
|
||||
|
||||
/**
|
||||
* Gets MetaData from the cache, given a specified context.
|
||||
@@ -72,7 +79,8 @@ public interface UserData {
|
||||
* @return a meta data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
MetaData getMetaData(Contexts contexts);
|
||||
@Nonnull
|
||||
MetaData getMetaData(@Nonnull Contexts contexts);
|
||||
|
||||
/**
|
||||
* Calculates permission data, bypassing the cache.
|
||||
@@ -81,7 +89,8 @@ public interface UserData {
|
||||
* @return a permission data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
PermissionData calculatePermissions(Contexts contexts);
|
||||
@Nonnull
|
||||
PermissionData calculatePermissions(@Nonnull Contexts contexts);
|
||||
|
||||
/**
|
||||
* Calculates meta data, bypassing the cache.
|
||||
@@ -91,7 +100,8 @@ public interface UserData {
|
||||
* @throws NullPointerException if contexts is null
|
||||
* @since 3.2
|
||||
*/
|
||||
MetaData calculateMeta(MetaContexts contexts);
|
||||
@Nonnull
|
||||
MetaData calculateMeta(@Nonnull MetaContexts contexts);
|
||||
|
||||
/**
|
||||
* Calculates meta data, bypassing the cache.
|
||||
@@ -100,7 +110,8 @@ public interface UserData {
|
||||
* @return a meta data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
MetaData calculateMeta(Contexts contexts);
|
||||
@Nonnull
|
||||
MetaData calculateMeta(@Nonnull Contexts contexts);
|
||||
|
||||
/**
|
||||
* Calculates permission data and stores it in the cache.
|
||||
@@ -111,7 +122,7 @@ public interface UserData {
|
||||
* @param contexts the contexts to recalculate in.
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
void recalculatePermissions(Contexts contexts);
|
||||
void recalculatePermissions(@Nonnull Contexts contexts);
|
||||
|
||||
/**
|
||||
* Calculates meta data and stores it in the cache.
|
||||
@@ -123,7 +134,7 @@ public interface UserData {
|
||||
* @throws NullPointerException if contexts is null
|
||||
* @since 3.2
|
||||
*/
|
||||
void recalculateMeta(MetaContexts contexts);
|
||||
void recalculateMeta(@Nonnull MetaContexts contexts);
|
||||
|
||||
/**
|
||||
* Calculates meta data and stores it in the cache.
|
||||
@@ -134,7 +145,7 @@ public interface UserData {
|
||||
* @param contexts the contexts to recalculate in.
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
void recalculateMeta(Contexts contexts);
|
||||
void recalculateMeta(@Nonnull Contexts contexts);
|
||||
|
||||
/**
|
||||
* Calls {@link #recalculatePermissions(Contexts)} for all current loaded contexts
|
||||
@@ -152,7 +163,7 @@ public interface UserData {
|
||||
* @param contexts a set of contexts
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
void preCalculate(Set<Contexts> contexts);
|
||||
void preCalculate(@Nonnull Set<Contexts> contexts);
|
||||
|
||||
/**
|
||||
* Ensures that PermissionData and MetaData is cached for a context.
|
||||
@@ -162,7 +173,7 @@ public interface UserData {
|
||||
* @param contexts the contexts to pre-calculate for
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
void preCalculate(Contexts contexts);
|
||||
void preCalculate(@Nonnull Contexts contexts);
|
||||
|
||||
/**
|
||||
* Invalidates all of the underlying Permission calculators.
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api.context;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Calculates whether contexts are applicable to {@link T}
|
||||
*
|
||||
@@ -38,6 +43,7 @@ public interface ContextCalculator<T> {
|
||||
* @return the map
|
||||
* @since 2.13
|
||||
*/
|
||||
MutableContextSet giveApplicableContext(T subject, MutableContextSet accumulator);
|
||||
@Nonnull
|
||||
MutableContextSet giveApplicableContext(@Nonnull T subject, @Nonnull MutableContextSet accumulator);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,12 +25,15 @@
|
||||
|
||||
package me.lucko.luckperms.api.context;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Holder of contexts.
|
||||
*
|
||||
@@ -45,7 +51,8 @@ public interface ContextSet {
|
||||
* @return a new ImmutableContextSet containing one KV pair
|
||||
* @throws NullPointerException if key or value is null
|
||||
*/
|
||||
static ImmutableContextSet singleton(String key, String value) {
|
||||
@Nonnull
|
||||
static ImmutableContextSet singleton(@Nonnull String key, @Nonnull String value) {
|
||||
return ImmutableContextSet.singleton(key, value);
|
||||
}
|
||||
|
||||
@@ -60,7 +67,8 @@ public interface ContextSet {
|
||||
* @throws NullPointerException if any of the keys or values are null
|
||||
* @since 3.1
|
||||
*/
|
||||
static ImmutableContextSet of(String key1, String value1, String key2, String value2) {
|
||||
@Nonnull
|
||||
static ImmutableContextSet of(@Nonnull String key1, @Nonnull String value1, @Nonnull String key2, @Nonnull String value2) {
|
||||
return ImmutableContextSet.of(key1, value1, key2, value2);
|
||||
}
|
||||
|
||||
@@ -71,7 +79,8 @@ public interface ContextSet {
|
||||
* @return a new ImmutableContextSet representing the pairs from the map
|
||||
* @throws NullPointerException if the map is null
|
||||
*/
|
||||
static ImmutableContextSet fromMap(Map<String, String> map) {
|
||||
@Nonnull
|
||||
static ImmutableContextSet fromMap(@Nonnull Map<String, String> map) {
|
||||
return ImmutableContextSet.fromMap(map);
|
||||
}
|
||||
|
||||
@@ -82,7 +91,8 @@ public interface ContextSet {
|
||||
* @return a new ImmutableContextSet representing the pairs in the iterable
|
||||
* @throws NullPointerException if the iterable is null
|
||||
*/
|
||||
static ImmutableContextSet fromEntries(Iterable<? extends Map.Entry<String, String>> iterable) {
|
||||
@Nonnull
|
||||
static ImmutableContextSet fromEntries(@Nonnull Iterable<? extends Map.Entry<String, String>> iterable) {
|
||||
return ImmutableContextSet.fromEntries(iterable);
|
||||
}
|
||||
|
||||
@@ -94,7 +104,8 @@ public interface ContextSet {
|
||||
* @throws NullPointerException if the multimap is null
|
||||
* @since 2.16
|
||||
*/
|
||||
static ImmutableContextSet fromMultimap(Multimap<String, String> multimap) {
|
||||
@Nonnull
|
||||
static ImmutableContextSet fromMultimap(@Nonnull Multimap<String, String> multimap) {
|
||||
return ImmutableContextSet.fromMultimap(multimap);
|
||||
}
|
||||
|
||||
@@ -106,7 +117,8 @@ public interface ContextSet {
|
||||
* @return a new ImmutableContextSet with the same content and the one provided
|
||||
* @throws NullPointerException if contextSet is null
|
||||
*/
|
||||
static ImmutableContextSet fromSet(ContextSet contextSet) {
|
||||
@Nonnull
|
||||
static ImmutableContextSet fromSet(@Nonnull ContextSet contextSet) {
|
||||
return ImmutableContextSet.fromSet(contextSet);
|
||||
}
|
||||
|
||||
@@ -115,6 +127,7 @@ public interface ContextSet {
|
||||
*
|
||||
* @return a new ImmutableContextSet
|
||||
*/
|
||||
@Nonnull
|
||||
static ImmutableContextSet empty() {
|
||||
return ImmutableContextSet.empty();
|
||||
}
|
||||
@@ -131,6 +144,7 @@ public interface ContextSet {
|
||||
*
|
||||
* @return an immutable ContextSet
|
||||
*/
|
||||
@Nonnull
|
||||
ImmutableContextSet makeImmutable();
|
||||
|
||||
/**
|
||||
@@ -139,6 +153,7 @@ public interface ContextSet {
|
||||
* @return a mutable ContextSet
|
||||
* @since 2.16
|
||||
*/
|
||||
@Nonnull
|
||||
MutableContextSet mutableCopy();
|
||||
|
||||
/**
|
||||
@@ -146,6 +161,7 @@ public interface ContextSet {
|
||||
*
|
||||
* @return an immutable set
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Map.Entry<String, String>> toSet();
|
||||
|
||||
/**
|
||||
@@ -156,6 +172,7 @@ public interface ContextSet {
|
||||
*
|
||||
* @return an immutable map
|
||||
*/
|
||||
@Nonnull
|
||||
Map<String, String> toMap();
|
||||
|
||||
/**
|
||||
@@ -164,6 +181,7 @@ public interface ContextSet {
|
||||
* @return a multimap
|
||||
* @since 2.16
|
||||
*/
|
||||
@Nonnull
|
||||
Multimap<String, String> toMultimap();
|
||||
|
||||
/**
|
||||
@@ -173,7 +191,7 @@ public interface ContextSet {
|
||||
* @return true if the set contains a value for the key
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
boolean containsKey(String key);
|
||||
boolean containsKey(@Nonnull String key);
|
||||
|
||||
/**
|
||||
* Gets a set of all of the values mapped to the given key
|
||||
@@ -182,7 +200,8 @@ public interface ContextSet {
|
||||
* @return a set of values
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
Set<String> getValues(String key);
|
||||
@Nonnull
|
||||
Set<String> getValues(@Nonnull String key);
|
||||
|
||||
/**
|
||||
* Returns any value from this set matching the key, if present.
|
||||
@@ -191,7 +210,8 @@ public interface ContextSet {
|
||||
* @return an optional containing any match
|
||||
* @since 3.1
|
||||
*/
|
||||
default Optional<String> getAnyValue(String key) {
|
||||
@Nonnull
|
||||
default Optional<String> getAnyValue(@Nonnull String key) {
|
||||
return getValues(key).stream().findAny();
|
||||
}
|
||||
|
||||
@@ -203,7 +223,7 @@ public interface ContextSet {
|
||||
* @return true if the set contains the KV pair
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
boolean has(String key, String value);
|
||||
boolean has(@Nonnull String key, @Nonnull String value);
|
||||
|
||||
/**
|
||||
* Same as {@link #has(String, String)}, except ignores the case of the value.
|
||||
@@ -213,7 +233,7 @@ public interface ContextSet {
|
||||
* @return true if the set contains the KV pair
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
boolean hasIgnoreCase(String key, String value);
|
||||
boolean hasIgnoreCase(@Nonnull String key, @Nonnull String value);
|
||||
|
||||
/**
|
||||
* Checks to see if all entries in this context set are also included in another set.
|
||||
@@ -222,7 +242,8 @@ public interface ContextSet {
|
||||
* @return true if all entries in this set are also in the other set
|
||||
* @since 3.1
|
||||
*/
|
||||
default boolean isSatisfiedBy(ContextSet other) {
|
||||
default boolean isSatisfiedBy(@Nonnull ContextSet other) {
|
||||
Preconditions.checkNotNull(other, "other");
|
||||
if (this.isEmpty()) {
|
||||
// this is empty, so is therefore always satisfied.
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +25,7 @@
|
||||
|
||||
package me.lucko.luckperms.api.context;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
@@ -32,6 +36,8 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* An immutable implementation of {@link ContextSet}.
|
||||
*
|
||||
@@ -48,14 +54,10 @@ public final class ImmutableContextSet implements ContextSet {
|
||||
* @return a new ImmutableContextSet containing one KV pair
|
||||
* @throws NullPointerException if key or value is null
|
||||
*/
|
||||
public static ImmutableContextSet singleton(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static ImmutableContextSet singleton(@Nonnull String key, @Nonnull String value) {
|
||||
Preconditions.checkNotNull(key, "key");
|
||||
Preconditions.checkNotNull(value, "value");
|
||||
return new ImmutableContextSet(ImmutableSetMultimap.of(key.toLowerCase(), value));
|
||||
}
|
||||
|
||||
@@ -70,20 +72,12 @@ public final class ImmutableContextSet implements ContextSet {
|
||||
* @throws NullPointerException if any of the keys or values are null
|
||||
* @since 3.1
|
||||
*/
|
||||
public static ImmutableContextSet of(String key1, String value1, String key2, String value2) {
|
||||
if (key1 == null) {
|
||||
throw new NullPointerException("key1");
|
||||
}
|
||||
if (value1 == null) {
|
||||
throw new NullPointerException("value1");
|
||||
}
|
||||
if (key2 == null) {
|
||||
throw new NullPointerException("key2");
|
||||
}
|
||||
if (value2 == null) {
|
||||
throw new NullPointerException("value2");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static ImmutableContextSet of(@Nonnull String key1, @Nonnull String value1, @Nonnull String key2, @Nonnull String value2) {
|
||||
Preconditions.checkNotNull(key1, "key1");
|
||||
Preconditions.checkNotNull(value1, "value1");
|
||||
Preconditions.checkNotNull(key2, "key2");
|
||||
Preconditions.checkNotNull(value2, "value2");
|
||||
return new ImmutableContextSet(ImmutableSetMultimap.of(key1.toLowerCase(), value1, key2.toLowerCase(), value2));
|
||||
}
|
||||
|
||||
@@ -94,10 +88,9 @@ public final class ImmutableContextSet implements ContextSet {
|
||||
* @return a new ImmutableContextSet representing the pairs from the map
|
||||
* @throws NullPointerException if the map is null
|
||||
*/
|
||||
public static ImmutableContextSet fromMap(Map<String, String> map) {
|
||||
if (map == null) {
|
||||
throw new NullPointerException("map");
|
||||
}
|
||||
@Nonnull
|
||||
public static ImmutableContextSet fromMap(@Nonnull Map<String, String> map) {
|
||||
Preconditions.checkNotNull(map, "map");
|
||||
|
||||
ImmutableSetMultimap.Builder<String, String> b = ImmutableSetMultimap.builder();
|
||||
for (Map.Entry<String, String> e : map.entrySet()) {
|
||||
@@ -114,11 +107,9 @@ public final class ImmutableContextSet implements ContextSet {
|
||||
* @return a new ImmutableContextSet representing the pairs in the iterable
|
||||
* @throws NullPointerException if the iterable is null
|
||||
*/
|
||||
public static ImmutableContextSet fromEntries(Iterable<? extends Map.Entry<String, String>> iterable) {
|
||||
if (iterable == null) {
|
||||
throw new NullPointerException("iterable");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static ImmutableContextSet fromEntries(@Nonnull Iterable<? extends Map.Entry<String, String>> iterable) {
|
||||
Preconditions.checkNotNull(iterable, "iterable");
|
||||
return MutableContextSet.fromEntries(iterable).makeImmutable();
|
||||
}
|
||||
|
||||
@@ -129,11 +120,9 @@ public final class ImmutableContextSet implements ContextSet {
|
||||
* @return a new ImmutableContextSet representing the pairs in the multimap
|
||||
* @throws NullPointerException if the multimap is null
|
||||
*/
|
||||
public static ImmutableContextSet fromMultimap(Multimap<String, String> multimap) {
|
||||
if (multimap == null) {
|
||||
throw new NullPointerException("multimap");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static ImmutableContextSet fromMultimap(@Nonnull Multimap<String, String> multimap) {
|
||||
Preconditions.checkNotNull(multimap, "multimap");
|
||||
return MutableContextSet.fromMultimap(multimap).makeImmutable();
|
||||
}
|
||||
|
||||
@@ -145,8 +134,9 @@ public final class ImmutableContextSet implements ContextSet {
|
||||
* @return a new ImmutableContextSet with the same content and the one provided
|
||||
* @throws NullPointerException if contextSet is null
|
||||
*/
|
||||
public static ImmutableContextSet fromSet(ContextSet contextSet) {
|
||||
return contextSet.makeImmutable();
|
||||
@Nonnull
|
||||
public static ImmutableContextSet fromSet(@Nonnull ContextSet contextSet) {
|
||||
return Preconditions.checkNotNull(contextSet, "contextSet").makeImmutable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,6 +144,7 @@ public final class ImmutableContextSet implements ContextSet {
|
||||
*
|
||||
* @return a new ContextSet
|
||||
*/
|
||||
@Nonnull
|
||||
public static ImmutableContextSet empty() {
|
||||
return EMPTY;
|
||||
}
|
||||
@@ -171,21 +162,25 @@ public final class ImmutableContextSet implements ContextSet {
|
||||
|
||||
@Override
|
||||
@Deprecated // This set is already immutable!
|
||||
@Nonnull
|
||||
public ImmutableContextSet makeImmutable() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public MutableContextSet mutableCopy() {
|
||||
return MutableContextSet.fromSet(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public Set<Map.Entry<String, String>> toSet() {
|
||||
return ImmutableSet.copyOf(map.entries());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public Map<String, String> toMap() {
|
||||
ImmutableMap.Builder<String, String> m = ImmutableMap.builder();
|
||||
for (Map.Entry<String, String> e : map.entries()) {
|
||||
@@ -196,49 +191,35 @@ public final class ImmutableContextSet implements ContextSet {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public Multimap<String, String> toMultimap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(String key) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
|
||||
public boolean containsKey(@Nonnull String key) {
|
||||
Preconditions.checkNotNull(key, "key");
|
||||
return map.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getValues(String key) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
|
||||
public Set<String> getValues(@Nonnull String key) {
|
||||
Preconditions.checkNotNull(key, "key");
|
||||
Collection<String> c = map.get(key);
|
||||
return c != null && !c.isEmpty() ? ImmutableSet.copyOf(c) : ImmutableSet.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
public boolean has(@Nonnull String key, @Nonnull String value) {
|
||||
Preconditions.checkNotNull(key, "key");
|
||||
Preconditions.checkNotNull(value, "value");
|
||||
return map.containsEntry(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIgnoreCase(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
public boolean hasIgnoreCase(@Nonnull String key, @Nonnull String value) {
|
||||
Preconditions.checkNotNull(key, "key");
|
||||
Preconditions.checkNotNull(value, "value");
|
||||
|
||||
Collection<String> c = map.get(key);
|
||||
if (c == null || c.isEmpty()) {
|
||||
@@ -271,7 +252,7 @@ public final class ImmutableContextSet implements ContextSet {
|
||||
|
||||
final Multimap<String, String> thisContexts = this.toMultimap();
|
||||
final Multimap<String, String> otherContexts = other.toMultimap();
|
||||
return thisContexts == null ? otherContexts == null : thisContexts.equals(otherContexts);
|
||||
return thisContexts.equals(otherContexts);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +25,7 @@
|
||||
|
||||
package me.lucko.luckperms.api.context;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
@@ -34,6 +38,8 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* A mutable implementation of {@link ContextSet}.
|
||||
*
|
||||
@@ -49,14 +55,10 @@ public final class MutableContextSet implements ContextSet {
|
||||
* @return a new MutableContextSet containing one KV pair
|
||||
* @throws NullPointerException if key or value is null
|
||||
*/
|
||||
public static MutableContextSet singleton(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static MutableContextSet singleton(@Nonnull String key, @Nonnull String value) {
|
||||
Preconditions.checkNotNull(key, "key");
|
||||
Preconditions.checkNotNull(value, "value");
|
||||
MutableContextSet set = new MutableContextSet();
|
||||
set.add(key, value);
|
||||
return set;
|
||||
@@ -73,20 +75,12 @@ public final class MutableContextSet implements ContextSet {
|
||||
* @throws NullPointerException if any of the keys or values are null
|
||||
* @since 3.1
|
||||
*/
|
||||
public static MutableContextSet of(String key1, String value1, String key2, String value2) {
|
||||
if (key1 == null) {
|
||||
throw new NullPointerException("key1");
|
||||
}
|
||||
if (value1 == null) {
|
||||
throw new NullPointerException("value1");
|
||||
}
|
||||
if (key2 == null) {
|
||||
throw new NullPointerException("key2");
|
||||
}
|
||||
if (value2 == null) {
|
||||
throw new NullPointerException("value2");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static MutableContextSet of(@Nonnull String key1, @Nonnull String value1, @Nonnull String key2, @Nonnull String value2) {
|
||||
Preconditions.checkNotNull(key1, "key1");
|
||||
Preconditions.checkNotNull(value1, "value1");
|
||||
Preconditions.checkNotNull(key2, "key2");
|
||||
Preconditions.checkNotNull(value2, "value2");
|
||||
MutableContextSet ret = singleton(key1, value1);
|
||||
ret.add(key2, value2);
|
||||
return ret;
|
||||
@@ -99,11 +93,9 @@ public final class MutableContextSet implements ContextSet {
|
||||
* @return a new MutableContextSet representing the pairs from the map
|
||||
* @throws NullPointerException if the map is null
|
||||
*/
|
||||
public static MutableContextSet fromMap(Map<String, String> map) {
|
||||
if (map == null) {
|
||||
throw new NullPointerException("map");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static MutableContextSet fromMap(@Nonnull Map<String, String> map) {
|
||||
Preconditions.checkNotNull(map, "map");
|
||||
MutableContextSet set = new MutableContextSet();
|
||||
set.addAll(map);
|
||||
return set;
|
||||
@@ -116,11 +108,9 @@ public final class MutableContextSet implements ContextSet {
|
||||
* @return a new MutableContextSet representing the pairs in the iterable
|
||||
* @throws NullPointerException if the iterable is null
|
||||
*/
|
||||
public static MutableContextSet fromEntries(Iterable<? extends Map.Entry<String, String>> iterable) {
|
||||
if (iterable == null) {
|
||||
throw new NullPointerException("iterable");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static MutableContextSet fromEntries(@Nonnull Iterable<? extends Map.Entry<String, String>> iterable) {
|
||||
Preconditions.checkNotNull(iterable, "iterable");
|
||||
MutableContextSet set = new MutableContextSet();
|
||||
set.addAll(iterable);
|
||||
return set;
|
||||
@@ -133,11 +123,9 @@ public final class MutableContextSet implements ContextSet {
|
||||
* @return a new MutableContextSet representing the pairs in the multimap
|
||||
* @throws NullPointerException if the multimap is null
|
||||
*/
|
||||
public static MutableContextSet fromMultimap(Multimap<String, String> multimap) {
|
||||
if (multimap == null) {
|
||||
throw new NullPointerException("multimap");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static MutableContextSet fromMultimap(@Nonnull Multimap<String, String> multimap) {
|
||||
Preconditions.checkNotNull(multimap, "multimap");
|
||||
return fromEntries(multimap.entries());
|
||||
}
|
||||
|
||||
@@ -149,11 +137,9 @@ public final class MutableContextSet implements ContextSet {
|
||||
* @return a new MutableContextSet with the same content and the one provided
|
||||
* @throws NullPointerException if contextSet is null
|
||||
*/
|
||||
public static MutableContextSet fromSet(ContextSet contextSet) {
|
||||
if (contextSet == null) {
|
||||
throw new NullPointerException("contextSet");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static MutableContextSet fromSet(@Nonnull ContextSet contextSet) {
|
||||
Preconditions.checkNotNull(contextSet, "contextSet");
|
||||
MutableContextSet set = new MutableContextSet();
|
||||
set.addAll(contextSet.toSet());
|
||||
return set;
|
||||
@@ -164,6 +150,7 @@ public final class MutableContextSet implements ContextSet {
|
||||
*
|
||||
* @return a new MutableContextSet
|
||||
*/
|
||||
@Nonnull
|
||||
public static MutableContextSet create() {
|
||||
return new MutableContextSet();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,18 +25,24 @@
|
||||
|
||||
package me.lucko.luckperms.api.data;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Represents the data section of the main LuckPerms configuration.
|
||||
* All methods could return null.
|
||||
*/
|
||||
public interface DatastoreConfiguration {
|
||||
|
||||
@Nullable
|
||||
String getAddress();
|
||||
|
||||
@Nullable
|
||||
String getDatabase();
|
||||
|
||||
@Nullable
|
||||
String getUsername();
|
||||
|
||||
@Nullable
|
||||
String getPassword();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,6 +27,8 @@ package me.lucko.luckperms.api.event;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Represents an event that can be cancelled
|
||||
*/
|
||||
@@ -34,6 +39,7 @@ public interface Cancellable {
|
||||
*
|
||||
* @return the cancellation
|
||||
*/
|
||||
@Nonnull
|
||||
AtomicBoolean getCancellationState();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,6 +28,8 @@ package me.lucko.luckperms.api.event;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* The LuckPerms event bus. Used for subscribing (or registering listeners) to events.
|
||||
*
|
||||
@@ -40,7 +45,8 @@ public interface EventBus {
|
||||
* @param <T> the event class
|
||||
* @return an event handler instance representing this subscription
|
||||
*/
|
||||
<T extends LuckPermsEvent> EventHandler<T> subscribe(Class<T> eventClass, Consumer<T> handler);
|
||||
@Nonnull
|
||||
<T extends LuckPermsEvent> EventHandler<T> subscribe(@Nonnull Class<T> eventClass, @Nonnull Consumer<T> handler);
|
||||
|
||||
/**
|
||||
* Gets a set of all registered handlers for a given event
|
||||
@@ -49,6 +55,7 @@ public interface EventBus {
|
||||
* @param <T> the event class
|
||||
* @return an immutable set of event handlers
|
||||
*/
|
||||
<T extends LuckPermsEvent> Set<EventHandler<T>> getHandlers(Class<T> eventClass);
|
||||
@Nonnull
|
||||
<T extends LuckPermsEvent> Set<EventHandler<T>> getHandlers(@Nonnull Class<T> eventClass);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,6 +27,8 @@ package me.lucko.luckperms.api.event;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Represents a handler for a LuckPerms event
|
||||
*
|
||||
@@ -36,6 +41,7 @@ public interface EventHandler<T extends LuckPermsEvent> {
|
||||
*
|
||||
* @return the event class
|
||||
*/
|
||||
@Nonnull
|
||||
Class<T> getEventClass();
|
||||
|
||||
/**
|
||||
@@ -57,6 +63,7 @@ public interface EventHandler<T extends LuckPermsEvent> {
|
||||
*
|
||||
* @return the event consumer
|
||||
*/
|
||||
@Nonnull
|
||||
Consumer<T> getConsumer();
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,6 +27,8 @@ package me.lucko.luckperms.api.event;
|
||||
|
||||
import me.lucko.luckperms.api.LuckPermsApi;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* The base event interface
|
||||
*
|
||||
@@ -36,6 +41,7 @@ public interface LuckPermsEvent {
|
||||
*
|
||||
* @return the api instance
|
||||
*/
|
||||
@Nonnull
|
||||
LuckPermsApi getApi();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a group is created
|
||||
*/
|
||||
@@ -36,6 +41,7 @@ public interface GroupCreateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the new group
|
||||
*/
|
||||
@Nonnull
|
||||
Group getGroup();
|
||||
|
||||
/**
|
||||
@@ -43,6 +49,7 @@ public interface GroupCreateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the cause of the creation
|
||||
*/
|
||||
@Nonnull
|
||||
CreationCause getCause();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -28,6 +31,8 @@ import me.lucko.luckperms.api.event.cause.DeletionCause;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a group is deleted
|
||||
*/
|
||||
@@ -38,6 +43,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the name of the deleted group
|
||||
*/
|
||||
@Nonnull
|
||||
String getGroupName();
|
||||
|
||||
/**
|
||||
@@ -45,6 +51,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return a copy of the groups existing data
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Node> getExistingData();
|
||||
|
||||
/**
|
||||
@@ -52,6 +59,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the cause of the deletion
|
||||
*/
|
||||
@Nonnull
|
||||
DeletionCause getCause();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,6 +28,8 @@ package me.lucko.luckperms.api.event.group;
|
||||
import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a group is loaded into memory from the storage.
|
||||
*
|
||||
@@ -37,6 +42,7 @@ public interface GroupLoadEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the group that was loaded
|
||||
*/
|
||||
@Nonnull
|
||||
Group getGroup();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a log entry is about to be sent to notifiable players on the platform
|
||||
*/
|
||||
@@ -36,6 +41,7 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
|
||||
*
|
||||
* @return the log entry to be broadcasted
|
||||
*/
|
||||
@Nonnull
|
||||
LogEntry getEntry();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a log is about to be published to the storage file/table
|
||||
*/
|
||||
@@ -36,6 +41,7 @@ public interface LogPublishEvent extends LuckPermsEvent, Cancellable {
|
||||
*
|
||||
* @return the log entry to be published
|
||||
*/
|
||||
@Nonnull
|
||||
LogEntry getEntry();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,6 +27,8 @@ package me.lucko.luckperms.api.event.node;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a node is added to a holder
|
||||
*/
|
||||
@@ -34,6 +39,7 @@ public interface NodeAddEvent extends NodeMutateEvent {
|
||||
*
|
||||
* @return the node that was added
|
||||
*/
|
||||
@Nonnull
|
||||
Node getNode();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -28,6 +31,8 @@ import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a node is added to/removed from a user/group
|
||||
*/
|
||||
@@ -38,6 +43,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the event target
|
||||
*/
|
||||
@Nonnull
|
||||
PermissionHolder getTarget();
|
||||
|
||||
/**
|
||||
@@ -45,6 +51,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the data before the change
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Node> getDataBefore();
|
||||
|
||||
/**
|
||||
@@ -52,6 +59,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the data after the change
|
||||
*/
|
||||
@Nonnull
|
||||
Set<Node> getDataAfter();
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,6 +27,8 @@ package me.lucko.luckperms.api.event.node;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a node is removed from a holder
|
||||
*/
|
||||
@@ -34,6 +39,7 @@ public interface NodeRemoveEvent extends NodeMutateEvent {
|
||||
*
|
||||
* @return the node that was removed
|
||||
*/
|
||||
@Nonnull
|
||||
Node getNode();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,6 +30,8 @@ import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called before a network sync task runs
|
||||
*/
|
||||
@@ -37,6 +42,7 @@ public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
|
||||
*
|
||||
* @return the id of the sync request
|
||||
*/
|
||||
@Nonnull
|
||||
UUID getSyncId();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import me.lucko.luckperms.api.Track;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a track is created
|
||||
*/
|
||||
@@ -36,6 +41,7 @@ public interface TrackCreateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the new track
|
||||
*/
|
||||
@Nonnull
|
||||
Track getTrack();
|
||||
|
||||
/**
|
||||
@@ -43,6 +49,7 @@ public interface TrackCreateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the cause of the creation
|
||||
*/
|
||||
@Nonnull
|
||||
CreationCause getCause();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,6 +30,8 @@ import me.lucko.luckperms.api.event.cause.DeletionCause;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a track is deleted
|
||||
*/
|
||||
@@ -37,6 +42,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the name of the deleted track
|
||||
*/
|
||||
@Nonnull
|
||||
String getTrackName();
|
||||
|
||||
/**
|
||||
@@ -44,6 +50,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return a copy of the tracks existing data
|
||||
*/
|
||||
@Nonnull
|
||||
List<String> getExistingData();
|
||||
|
||||
/**
|
||||
@@ -51,6 +58,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the cause of the deletion
|
||||
*/
|
||||
@Nonnull
|
||||
DeletionCause getCause();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,6 +28,8 @@ package me.lucko.luckperms.api.event.track;
|
||||
import me.lucko.luckperms.api.Track;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a track is loaded into memory from the storage.
|
||||
*
|
||||
@@ -37,6 +42,7 @@ public interface TrackLoadEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the track that was loaded
|
||||
*/
|
||||
@Nonnull
|
||||
Track getTrack();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api.event.track.mutate;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a group is added to a track
|
||||
*/
|
||||
@@ -32,6 +37,7 @@ public interface TrackAddGroupEvent extends TrackMutateEvent {
|
||||
*
|
||||
* @return the group that was added
|
||||
*/
|
||||
@Nonnull
|
||||
String getGroup();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,6 +30,8 @@ import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a track is changed
|
||||
*/
|
||||
@@ -37,6 +42,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the track that was mutated
|
||||
*/
|
||||
@Nonnull
|
||||
Track getTrack();
|
||||
|
||||
/**
|
||||
@@ -44,6 +50,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the data before the change
|
||||
*/
|
||||
@Nonnull
|
||||
List<String> getDataBefore();
|
||||
|
||||
/**
|
||||
@@ -51,6 +58,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the data after the change
|
||||
*/
|
||||
@Nonnull
|
||||
List<String> getDataAfter();
|
||||
|
||||
}
|
||||
+7
-1
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.api.event.track.mutate;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a group is removed from a track
|
||||
*/
|
||||
@@ -32,6 +37,7 @@ public interface TrackRemoveGroupEvent extends TrackMutateEvent {
|
||||
*
|
||||
* @return the group that was removed
|
||||
*/
|
||||
@Nonnull
|
||||
String getGroup();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.caching.UserData;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a users {@link me.lucko.luckperms.api.caching.UserData} is loaded.
|
||||
*/
|
||||
@@ -36,6 +41,7 @@ public interface UserCacheLoadEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the user
|
||||
*/
|
||||
@Nonnull
|
||||
User getUser();
|
||||
|
||||
/**
|
||||
@@ -43,6 +49,7 @@ public interface UserCacheLoadEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the loaded data
|
||||
*/
|
||||
@Nonnull
|
||||
UserData getLoadedData();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.caching.UserData;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a users cached data is refreshed
|
||||
*/
|
||||
@@ -36,6 +41,7 @@ public interface UserDataRecalculateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the user
|
||||
*/
|
||||
@Nonnull
|
||||
User getUser();
|
||||
|
||||
/**
|
||||
@@ -43,6 +49,7 @@ public interface UserDataRecalculateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the data
|
||||
*/
|
||||
@Nonnull
|
||||
UserData getData();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,6 +29,8 @@ import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when the user logs into the network for the first time.
|
||||
*
|
||||
@@ -44,6 +49,7 @@ public interface UserFirstLoginEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the uuid of the user
|
||||
*/
|
||||
@Nonnull
|
||||
UUID getUuid();
|
||||
|
||||
/**
|
||||
@@ -51,6 +57,7 @@ public interface UserFirstLoginEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the username of the user
|
||||
*/
|
||||
@Nonnull
|
||||
String getUsername();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,6 +28,8 @@ package me.lucko.luckperms.api.event.user;
|
||||
import me.lucko.luckperms.api.User;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a user is loaded into memory from the storage.
|
||||
*/
|
||||
@@ -35,6 +40,7 @@ public interface UserLoadEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the user that was loaded
|
||||
*/
|
||||
@Nonnull
|
||||
User getUser();
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -28,6 +31,8 @@ import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when a user interacts with a track through a promotion or demotion
|
||||
*/
|
||||
@@ -38,6 +43,7 @@ public interface UserTrackEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the track involved in the event
|
||||
*/
|
||||
@Nonnull
|
||||
Track getTrack();
|
||||
|
||||
/**
|
||||
@@ -45,6 +51,7 @@ public interface UserTrackEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the user involved in the event
|
||||
*/
|
||||
@Nonnull
|
||||
User getUser();
|
||||
|
||||
/**
|
||||
@@ -52,6 +59,7 @@ public interface UserTrackEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the action performed
|
||||
*/
|
||||
@Nonnull
|
||||
TrackAction getAction();
|
||||
|
||||
/**
|
||||
@@ -61,6 +69,7 @@ public interface UserTrackEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the group the user was promoted/demoted from
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<String> getGroupFrom();
|
||||
|
||||
/**
|
||||
@@ -68,6 +77,7 @@ public interface UserTrackEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the group the user was promoted/demoted to
|
||||
*/
|
||||
@Nonnull
|
||||
Optional<String> getGroupTo();
|
||||
|
||||
}
|
||||
@@ -27,6 +27,8 @@ package me.lucko.luckperms.api.metastacking;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Represents a meta stack model, consisting of a chain of elements, separated by spacers.
|
||||
*
|
||||
@@ -45,6 +47,7 @@ public interface MetaStackDefinition {
|
||||
*
|
||||
* @return the elements in this stack
|
||||
*/
|
||||
@Nonnull
|
||||
List<MetaStackElement> getElements();
|
||||
|
||||
/**
|
||||
@@ -52,6 +55,7 @@ public interface MetaStackDefinition {
|
||||
*
|
||||
* @return the start spacer
|
||||
*/
|
||||
@Nonnull
|
||||
String getStartSpacer();
|
||||
|
||||
/**
|
||||
@@ -59,6 +63,7 @@ public interface MetaStackDefinition {
|
||||
*
|
||||
* @return the middle spacer
|
||||
*/
|
||||
@Nonnull
|
||||
String getMiddleSpacer();
|
||||
|
||||
/**
|
||||
@@ -66,6 +71,7 @@ public interface MetaStackDefinition {
|
||||
*
|
||||
* @return the end spacer
|
||||
*/
|
||||
@Nonnull
|
||||
String getEndSpacer();
|
||||
|
||||
}
|
||||
@@ -31,6 +31,9 @@ import me.lucko.luckperms.api.Node;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Represents an element within a {@link MetaStackDefinition}.
|
||||
*
|
||||
@@ -48,6 +51,6 @@ public interface MetaStackElement {
|
||||
* @param current the current value being used. If this returns true, the current value will be replaced by this entry
|
||||
* @return true if the node should be accumulated into this element, replacing the current value
|
||||
*/
|
||||
boolean shouldAccumulate(LocalizedNode node, ChatMetaType type, Map.Entry<Integer, String> current);
|
||||
boolean shouldAccumulate(@Nonnull LocalizedNode node, @Nonnull ChatMetaType type, @Nullable Map.Entry<Integer, String> current);
|
||||
|
||||
}
|
||||
@@ -28,6 +28,8 @@ package me.lucko.luckperms.api.metastacking;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Factory to create meta stack elements and definitions.
|
||||
*
|
||||
@@ -41,7 +43,8 @@ public interface MetaStackFactory {
|
||||
* @param definition the definition
|
||||
* @return the parsed element, if present
|
||||
*/
|
||||
Optional<MetaStackElement> fromString(String definition);
|
||||
@Nonnull
|
||||
Optional<MetaStackElement> fromString(@Nonnull String definition);
|
||||
|
||||
/**
|
||||
* Parses a list of {@link MetaStackElement}s from string, using the pre-defined elements in the plugin.
|
||||
@@ -51,7 +54,8 @@ public interface MetaStackFactory {
|
||||
* @param definitions the definition strings
|
||||
* @return a list of parsed elements
|
||||
*/
|
||||
List<MetaStackElement> fromStrings(List<String> definitions);
|
||||
@Nonnull
|
||||
List<MetaStackElement> fromStrings(@Nonnull List<String> definitions);
|
||||
|
||||
/**
|
||||
* Creates a new {@link MetaStackDefinition} with the given properties.
|
||||
@@ -62,6 +66,7 @@ public interface MetaStackFactory {
|
||||
* @param endSpacer the spacer to be included at the end of the stacks output
|
||||
* @return the new stack definition instance
|
||||
*/
|
||||
MetaStackDefinition createDefinition(List<MetaStackElement> elements, String startSpacer, String middleSpacer, String endSpacer);
|
||||
@Nonnull
|
||||
MetaStackDefinition createDefinition(@Nonnull List<MetaStackElement> elements, @Nonnull String startSpacer, @Nonnull String middleSpacer, @Nonnull String endSpacer);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
+27
-3
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>luckperms</artifactId>
|
||||
<groupId>me.lucko.luckperms</groupId>
|
||||
<version>3.2-SNAPSHOT</version>
|
||||
<version>3.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
<shadedPattern>me.lucko.luckperms.lib.gson</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>io.github.mkremins.fanciful</pattern>
|
||||
<shadedPattern>me.lucko.luckperms.lib.fanciful</shadedPattern>
|
||||
<pattern>net.kyori.text</pattern>
|
||||
<shadedPattern>me.lucko.luckperms.lib.text</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
@@ -58,6 +58,30 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>sign</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<!-- LuckPerms Bukkit -->
|
||||
<dependency>
|
||||
|
||||
+28
-4
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>luckperms</artifactId>
|
||||
<groupId>me.lucko.luckperms</groupId>
|
||||
<version>3.2-SNAPSHOT</version>
|
||||
<version>3.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>io.github.mkremins.fanciful</pattern>
|
||||
<shadedPattern>me.lucko.luckperms.lib.fanciful</shadedPattern>
|
||||
<pattern>net.kyori.text</pattern>
|
||||
<shadedPattern>me.lucko.luckperms.lib.text</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
@@ -57,12 +57,36 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>sign</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>${gpg.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.11.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.12-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Vault -->
|
||||
|
||||
@@ -30,8 +30,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import me.lucko.luckperms.bukkit.model.Injector;
|
||||
import me.lucko.luckperms.bukkit.model.LPPermissible;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.Message;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.utils.LoginHelper;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -71,14 +71,6 @@ public class BukkitListener implements Listener {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
/* the player was denied entry to the server before this priority.
|
||||
log this, so we can handle appropriately later. */
|
||||
if (e.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
|
||||
plugin.getLog().warn("Connection from " + e.getUniqueId() + " was already denied. No permissions data will be loaded.");
|
||||
deniedAsyncLogin.add(e.getUniqueId());
|
||||
return;
|
||||
}
|
||||
|
||||
/* there was an issue connecting to the DB, performing file i/o, etc.
|
||||
we don't let players join in this case, because it means they can connect to the server without their permissions data.
|
||||
some server admins rely on negating perms to stop users from causing damage etc, so it's really important that
|
||||
@@ -89,11 +81,13 @@ public class BukkitListener implements Listener {
|
||||
deniedAsyncLogin.add(e.getUniqueId());
|
||||
|
||||
// actually deny the connection.
|
||||
plugin.getLog().warn("Permissions storage is not loaded yet. Denying connection from: " + e.getUniqueId() + " - " + e.getName());
|
||||
plugin.getLog().warn("Permissions storage is not loaded. Denying connection from: " + e.getUniqueId() + " - " + e.getName());
|
||||
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, Message.LOADING_ERROR.asString(plugin.getLocaleManager()));
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getUniqueConnections().add(e.getUniqueId());
|
||||
|
||||
/* Actually process the login for the connection.
|
||||
We do this here to delay the login until the data is ready.
|
||||
If the login gets cancelled later on, then this will be cleaned up.
|
||||
@@ -121,6 +115,7 @@ public class BukkitListener implements Listener {
|
||||
|
||||
// Check to see if this connection was denied at LOW.
|
||||
if (deniedAsyncLogin.remove(e.getUniqueId())) {
|
||||
// their data was never loaded at LOW priority, now check to see if they have been magically allowed since then.
|
||||
|
||||
// This is a problem, as they were denied at low priority, but are now being allowed.
|
||||
if (e.getLoginResult() == AsyncPlayerPreLoginEvent.Result.ALLOWED) {
|
||||
@@ -131,26 +126,17 @@ public class BukkitListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
// Login event was cancelled by another plugin
|
||||
// Login event was cancelled by another plugin, but it wasn't cancelled when we handled it at LOW
|
||||
if (e.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
|
||||
// Schedule cleanup of this user.
|
||||
plugin.getUserManager().scheduleUnload(e.getUniqueId());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerLogin(PlayerLoginEvent e) {
|
||||
/* Called when the player starts logging into the server.
|
||||
At this point, the users data should be present and loaded.
|
||||
Listening on LOW priority to allow plugins to further modify data here. (auth plugins, etc.) */
|
||||
|
||||
/* the player was denied entry to the server before this priority.
|
||||
log this, so we can handle appropriately later. */
|
||||
if (e.getResult() != PlayerLoginEvent.Result.ALLOWED) {
|
||||
plugin.getLog().warn("Login from " + e.getPlayer().getUniqueId() + " was denied before an attachment could be injected.");
|
||||
deniedLogin.add(e.getPlayer().getUniqueId());
|
||||
return;
|
||||
}
|
||||
At this point, the users data should be present and loaded. */
|
||||
|
||||
final Player player = e.getPlayer();
|
||||
final User user = plugin.getUserManager().getIfLoaded(plugin.getUuidCache().getUUID(player.getUniqueId()));
|
||||
@@ -190,20 +176,20 @@ public class BukkitListener implements Listener {
|
||||
/* Listen to see if the event was cancelled after we initially handled the login
|
||||
If the connection was cancelled here, we need to do something to clean up the data that was loaded. */
|
||||
|
||||
// Check to see if this connection was denied at LOW.
|
||||
// Check to see if this connection was denied at LOW. Even if it was denied at LOW, their data will still be present.
|
||||
boolean denied = false;
|
||||
if (deniedLogin.remove(e.getPlayer().getUniqueId())) {
|
||||
denied = true;
|
||||
|
||||
// This is a problem, as they were denied at low priority, but are now being allowed.
|
||||
if (e.getResult() == PlayerLoginEvent.Result.ALLOWED) {
|
||||
plugin.getLog().severe("Player connection was re-allowed for " + e.getPlayer().getUniqueId());
|
||||
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, "");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Login event was cancelled by another plugin
|
||||
if (e.getResult() != PlayerLoginEvent.Result.ALLOWED) {
|
||||
// Login event was cancelled by another plugin since we first loaded their data
|
||||
if (denied || e.getResult() != PlayerLoginEvent.Result.ALLOWED) {
|
||||
// Schedule cleanup of this user.
|
||||
plugin.getUserManager().scheduleUnload(e.getPlayer().getUniqueId());
|
||||
return;
|
||||
@@ -219,7 +205,11 @@ public class BukkitListener implements Listener {
|
||||
final Player player = e.getPlayer();
|
||||
|
||||
// Remove the custom permissible
|
||||
Injector.unInject(player, true, true);
|
||||
try {
|
||||
Injector.unInject(player, true, true);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
// Handle auto op
|
||||
if (plugin.getConfiguration().get(ConfigKeys.AUTO_OP)) {
|
||||
@@ -236,8 +226,7 @@ public class BukkitListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
String s = e.getMessage().toLowerCase()
|
||||
.replace("/", "")
|
||||
String s = e.getMessage().substring(1).toLowerCase()
|
||||
.replace("bukkit:", "")
|
||||
.replace("spigot:", "")
|
||||
.replace("minecraft:", "");
|
||||
@@ -255,8 +244,9 @@ public class BukkitListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onWorldChange(PlayerChangedWorldEvent e) {
|
||||
plugin.getContextManager().invalidateCache(e.getPlayer());
|
||||
plugin.refreshAutoOp(e.getPlayer());
|
||||
}
|
||||
}
|
||||
@@ -25,16 +25,18 @@
|
||||
|
||||
package me.lucko.luckperms.bukkit;
|
||||
|
||||
import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.bukkit.compat.MessageHandler;
|
||||
import me.lucko.luckperms.common.commands.sender.SenderFactory;
|
||||
import me.lucko.luckperms.common.constants.Constants;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
|
||||
import net.kyori.text.Component;
|
||||
|
||||
import org.bukkit.command.BlockCommandSender;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.mkremins.fanciful.FancyMessage;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BukkitSenderFactory extends SenderFactory<CommandSender> {
|
||||
@@ -63,14 +65,29 @@ public class BukkitSenderFactory extends SenderFactory<CommandSender> {
|
||||
|
||||
@Override
|
||||
protected void sendMessage(CommandSender sender, String s) {
|
||||
|
||||
// send sync if command block
|
||||
if (sender instanceof BlockCommandSender) {
|
||||
getPlugin().getScheduler().doSync(() -> sender.sendMessage(s));
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendMessage(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendMessage(CommandSender sender, FancyMessage message) {
|
||||
protected void sendMessage(CommandSender sender, Component message) {
|
||||
messageHandler.sendJsonMessage(sender, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Tristate getPermissionValue(CommandSender sender, String node) {
|
||||
boolean isSet = sender.isPermissionSet(node);
|
||||
boolean val = sender.hasPermission(node);
|
||||
|
||||
return !isSet ? val ? Tristate.TRUE : Tristate.UNDEFINED : Tristate.fromBoolean(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasPermission(CommandSender sender, String node) {
|
||||
return sender.hasPermission(node);
|
||||
|
||||
@@ -32,52 +32,55 @@ import me.lucko.luckperms.api.Logger;
|
||||
import me.lucko.luckperms.api.LuckPermsApi;
|
||||
import me.lucko.luckperms.api.PlatformType;
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
import me.lucko.luckperms.api.context.ImmutableContextSet;
|
||||
import me.lucko.luckperms.api.context.MutableContextSet;
|
||||
import me.lucko.luckperms.bukkit.calculators.BukkitCalculatorFactory;
|
||||
import me.lucko.luckperms.bukkit.contexts.WorldCalculator;
|
||||
import me.lucko.luckperms.bukkit.messaging.BungeeMessagingService;
|
||||
import me.lucko.luckperms.bukkit.messaging.LilyPadMessagingService;
|
||||
import me.lucko.luckperms.bukkit.model.ChildPermissionProvider;
|
||||
import me.lucko.luckperms.bukkit.model.DefaultsProvider;
|
||||
import me.lucko.luckperms.bukkit.model.Injector;
|
||||
import me.lucko.luckperms.bukkit.model.LPPermissible;
|
||||
import me.lucko.luckperms.bukkit.vault.VaultHook;
|
||||
import me.lucko.luckperms.bukkit.processors.ChildPermissionProvider;
|
||||
import me.lucko.luckperms.bukkit.processors.DefaultsProvider;
|
||||
import me.lucko.luckperms.bukkit.vault.VaultHookManager;
|
||||
import me.lucko.luckperms.common.api.ApiHandler;
|
||||
import me.lucko.luckperms.common.api.ApiProvider;
|
||||
import me.lucko.luckperms.common.buffers.BufferedRequest;
|
||||
import me.lucko.luckperms.common.caching.handlers.CachedStateManager;
|
||||
import me.lucko.luckperms.common.calculators.CalculatorFactory;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.config.LuckPermsConfiguration;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.constants.CommandPermission;
|
||||
import me.lucko.luckperms.common.contexts.ContextManager;
|
||||
import me.lucko.luckperms.common.contexts.StaticCalculator;
|
||||
import me.lucko.luckperms.common.core.UuidCache;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.contexts.LuckPermsCalculator;
|
||||
import me.lucko.luckperms.common.dependencies.Dependency;
|
||||
import me.lucko.luckperms.common.dependencies.DependencyManager;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.NoopLocaleManager;
|
||||
import me.lucko.luckperms.common.locale.SimpleLocaleManager;
|
||||
import me.lucko.luckperms.common.logging.SenderLogger;
|
||||
import me.lucko.luckperms.common.managers.GenericGroupManager;
|
||||
import me.lucko.luckperms.common.managers.GenericTrackManager;
|
||||
import me.lucko.luckperms.common.managers.GenericUserManager;
|
||||
import me.lucko.luckperms.common.managers.GroupManager;
|
||||
import me.lucko.luckperms.common.managers.TrackManager;
|
||||
import me.lucko.luckperms.common.managers.UserManager;
|
||||
import me.lucko.luckperms.common.managers.impl.GenericGroupManager;
|
||||
import me.lucko.luckperms.common.managers.impl.GenericTrackManager;
|
||||
import me.lucko.luckperms.common.managers.impl.GenericUserManager;
|
||||
import me.lucko.luckperms.common.messaging.InternalMessagingService;
|
||||
import me.lucko.luckperms.common.messaging.NoopMessagingService;
|
||||
import me.lucko.luckperms.common.messaging.RedisMessaging;
|
||||
import me.lucko.luckperms.common.messaging.RedisMessagingService;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.storage.Storage;
|
||||
import me.lucko.luckperms.common.storage.StorageFactory;
|
||||
import me.lucko.luckperms.common.storage.StorageType;
|
||||
import me.lucko.luckperms.common.storage.backing.file.FileWatcher;
|
||||
import me.lucko.luckperms.common.tasks.CacheHousekeepingTask;
|
||||
import me.lucko.luckperms.common.tasks.ExpireTemporaryTask;
|
||||
import me.lucko.luckperms.common.tasks.UpdateTask;
|
||||
import me.lucko.luckperms.common.treeview.PermissionVault;
|
||||
import me.lucko.luckperms.common.utils.BufferedRequest;
|
||||
import me.lucko.luckperms.common.utils.FileWatcher;
|
||||
import me.lucko.luckperms.common.utils.LoginHelper;
|
||||
import me.lucko.luckperms.common.utils.SenderLogger;
|
||||
import me.lucko.luckperms.common.utils.UuidCache;
|
||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||
|
||||
import org.bukkit.World;
|
||||
@@ -107,9 +110,11 @@ import java.util.stream.Collectors;
|
||||
@Getter
|
||||
public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
private Set<UUID> ignoringLogs;
|
||||
private Set<UUID> uniqueConnections;
|
||||
private long startTime;
|
||||
private LPBukkitScheduler scheduler;
|
||||
private BukkitCommand commandManager;
|
||||
private VaultHook vaultHook = null;
|
||||
private VaultHookManager vaultHookManager = null;
|
||||
private LuckPermsConfiguration configuration;
|
||||
private UserManager userManager;
|
||||
private GroupManager groupManager;
|
||||
@@ -141,7 +146,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
scheduler = new LPBukkitScheduler(this);
|
||||
localeManager = new NoopLocaleManager();
|
||||
senderFactory = new BukkitSenderFactory(this);
|
||||
log = new SenderLogger(getConsoleSender());
|
||||
log = new SenderLogger(this, getConsoleSender());
|
||||
|
||||
DependencyManager.loadDependencies(this, Collections.singletonList(Dependency.CAFFEINE));
|
||||
}
|
||||
@@ -159,9 +164,11 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
}
|
||||
|
||||
private void enable() {
|
||||
startTime = System.currentTimeMillis();
|
||||
LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this);
|
||||
|
||||
ignoringLogs = ConcurrentHashMap.newKeySet();
|
||||
uniqueConnections = ConcurrentHashMap.newKeySet();
|
||||
verboseHandler = new VerboseHandler(scheduler.getAsyncBukkitExecutor(), getVersion());
|
||||
permissionVault = new PermissionVault(scheduler.getAsyncBukkitExecutor());
|
||||
|
||||
@@ -192,9 +199,8 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
}, 1L);
|
||||
|
||||
// register events
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
listener = new BukkitListener(this);
|
||||
pm.registerEvents(listener, this);
|
||||
getServer().getPluginManager().registerEvents(listener, this);
|
||||
|
||||
if (getConfiguration().get(ConfigKeys.WATCH_FILES)) {
|
||||
fileWatcher = new FileWatcher(this);
|
||||
@@ -209,14 +215,16 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
if (messagingType.equals("none") && getConfiguration().get(ConfigKeys.REDIS_ENABLED)) {
|
||||
messagingType = "redis";
|
||||
}
|
||||
|
||||
if (!messagingType.equals("none")) {
|
||||
getLog().info("Loading messaging service... [" + messagingType.toUpperCase() + "]");
|
||||
}
|
||||
|
||||
if (messagingType.equals("redis")) {
|
||||
getLog().info("Loading redis...");
|
||||
if (getConfiguration().get(ConfigKeys.REDIS_ENABLED)) {
|
||||
RedisMessaging redis = new RedisMessaging(this);
|
||||
RedisMessagingService redis = new RedisMessagingService(this);
|
||||
try {
|
||||
redis.init(getConfiguration().get(ConfigKeys.REDIS_ADDRESS), getConfiguration().get(ConfigKeys.REDIS_PASSWORD));
|
||||
getLog().info("Loaded redis successfully...");
|
||||
|
||||
messagingService = redis;
|
||||
} catch (Exception e) {
|
||||
getLog().warn("Couldn't load redis...");
|
||||
@@ -226,12 +234,10 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
getLog().warn("Messaging Service was set to redis, but redis is not enabled!");
|
||||
}
|
||||
} else if (messagingType.equals("bungee")) {
|
||||
getLog().info("Loading bungee messaging service...");
|
||||
BungeeMessagingService bungeeMessaging = new BungeeMessagingService(this);
|
||||
bungeeMessaging.init();
|
||||
messagingService = bungeeMessaging;
|
||||
} else if (messagingType.equals("lilypad")) {
|
||||
getLog().info("Loading LilyPad messaging service...");
|
||||
if (getServer().getPluginManager().getPlugin("LilyPad-Connect") == null) {
|
||||
getLog().warn("LilyPad-Connect plugin not present.");
|
||||
} else {
|
||||
@@ -260,7 +266,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
localeManager = new SimpleLocaleManager();
|
||||
File locale = new File(getDataFolder(), "lang.yml");
|
||||
if (locale.exists()) {
|
||||
getLog().info("Found locale file. Attempting to load from it.");
|
||||
getLog().info("Found lang.yml - loading messages...");
|
||||
try {
|
||||
localeManager.loadFromFile(locale);
|
||||
} catch (Exception e) {
|
||||
@@ -269,7 +275,6 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
}
|
||||
|
||||
// register commands
|
||||
getLog().info("Registering commands...");
|
||||
commandManager = new BukkitCommand(this);
|
||||
PluginCommand main = getServer().getPluginCommand("luckperms");
|
||||
main.setExecutor(commandManager);
|
||||
@@ -284,21 +289,33 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
groupManager = new GenericGroupManager(this);
|
||||
trackManager = new GenericTrackManager(this);
|
||||
calculatorFactory = new BukkitCalculatorFactory(this);
|
||||
cachedStateManager = new CachedStateManager(this);
|
||||
cachedStateManager = new CachedStateManager();
|
||||
|
||||
contextManager = new ContextManager<Player>() {
|
||||
@Override
|
||||
public Contexts formContexts(Player player, ImmutableContextSet contextSet) {
|
||||
return new Contexts(
|
||||
contextSet,
|
||||
getConfiguration().get(ConfigKeys.INCLUDING_GLOBAL_PERMS),
|
||||
getConfiguration().get(ConfigKeys.INCLUDING_GLOBAL_WORLD_PERMS),
|
||||
true,
|
||||
getConfiguration().get(ConfigKeys.APPLYING_GLOBAL_GROUPS),
|
||||
getConfiguration().get(ConfigKeys.APPLYING_GLOBAL_WORLD_GROUPS),
|
||||
player.isOp()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
contextManager = new ContextManager<>();
|
||||
worldCalculator = new WorldCalculator(this);
|
||||
contextManager.registerCalculator(worldCalculator);
|
||||
|
||||
StaticCalculator<Player> staticCalculator = new StaticCalculator<>(getConfiguration());
|
||||
contextManager.registerCalculator(staticCalculator);
|
||||
contextManager.registerStaticCalculator(staticCalculator);
|
||||
LuckPermsCalculator<Player> staticCalculator = new LuckPermsCalculator<>(getConfiguration());
|
||||
contextManager.registerCalculator(staticCalculator, true);
|
||||
|
||||
// Provide vault support
|
||||
tryVaultHook(false);
|
||||
|
||||
// register with the LP API
|
||||
getLog().info("Registering API...");
|
||||
apiProvider = new ApiProvider(this);
|
||||
ApiHandler.registerProvider(apiProvider);
|
||||
getServer().getServicesManager().register(LuckPermsApi.class, apiProvider, this, ServicePriority.Normal);
|
||||
@@ -313,6 +330,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
scheduler.asyncLater(() -> updateTaskBuffer.request(), 40L);
|
||||
|
||||
// run an update instantly.
|
||||
getLog().info("Performing initial data load...");
|
||||
updateTaskBuffer.requestDirectly();
|
||||
|
||||
// register tasks
|
||||
@@ -351,7 +369,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
});
|
||||
}
|
||||
|
||||
getLog().info("Successfully loaded.");
|
||||
getLog().info("Successfully enabled. (took " + (System.currentTimeMillis() - startTime) + "ms)");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -366,7 +384,12 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
verboseHandler.setShutdown(true);
|
||||
|
||||
for (Player player : getServer().getOnlinePlayers()) {
|
||||
Injector.unInject(player, false, false);
|
||||
try {
|
||||
Injector.unInject(player, false, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (getConfiguration().get(ConfigKeys.AUTO_OP)) {
|
||||
player.setOp(false);
|
||||
}
|
||||
@@ -378,7 +401,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
getLog().info("Closing datastore...");
|
||||
getLog().info("Closing storage...");
|
||||
storage.shutdown();
|
||||
|
||||
if (fileWatcher != null) {
|
||||
@@ -390,14 +413,14 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
messagingService.close();
|
||||
}
|
||||
|
||||
getLog().info("Unregistering API...");
|
||||
ApiHandler.unregisterProvider();
|
||||
getServer().getServicesManager().unregisterAll(this);
|
||||
|
||||
if (vaultHook != null) {
|
||||
vaultHook.unhook(this);
|
||||
if (vaultHookManager != null) {
|
||||
vaultHookManager.unhook(this);
|
||||
}
|
||||
|
||||
getLog().info("Shutting down internal scheduler...");
|
||||
scheduler.shutdown();
|
||||
|
||||
// Bukkit will do this again when #onDisable completes, but we do it early to prevent NPEs elsewhere.
|
||||
@@ -406,7 +429,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
|
||||
// Null everything
|
||||
ignoringLogs = null;
|
||||
vaultHook = null;
|
||||
vaultHookManager = null;
|
||||
configuration = null;
|
||||
userManager = null;
|
||||
groupManager = null;
|
||||
@@ -432,21 +455,18 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
}
|
||||
|
||||
public void tryVaultHook(boolean force) {
|
||||
if (vaultHook != null) {
|
||||
if (vaultHookManager != null) {
|
||||
return; // already hooked
|
||||
}
|
||||
|
||||
if (force) {
|
||||
getLog().info("Attempting to hook with Vault...");
|
||||
}
|
||||
try {
|
||||
if (force || getServer().getPluginManager().isPluginEnabled("Vault")) {
|
||||
vaultHook = new VaultHook();
|
||||
vaultHook.hook(this);
|
||||
vaultHookManager = new VaultHookManager();
|
||||
vaultHookManager.hook(this);
|
||||
getLog().info("Registered Vault permission & chat hook.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
vaultHook = null;
|
||||
vaultHookManager = null;
|
||||
getLog().severe("Error occurred whilst hooking into Vault.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -515,21 +535,24 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
return getServer().getPlayer(uuidCache.getExternalUUID(user.getUuid()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UUID> lookupUuid(String username) {
|
||||
try {
|
||||
//noinspection deprecation
|
||||
return Optional.ofNullable(getServer().getOfflinePlayer(username)).flatMap(p -> Optional.ofNullable(p.getUniqueId()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Contexts getContextForUser(User user) {
|
||||
Player player = getPlayer(user);
|
||||
if (player == null) {
|
||||
return null;
|
||||
}
|
||||
return new Contexts(
|
||||
getContextManager().getApplicableContext(player),
|
||||
getConfiguration().get(ConfigKeys.INCLUDING_GLOBAL_PERMS),
|
||||
getConfiguration().get(ConfigKeys.INCLUDING_GLOBAL_WORLD_PERMS),
|
||||
true,
|
||||
getConfiguration().get(ConfigKeys.APPLYING_GLOBAL_GROUPS),
|
||||
getConfiguration().get(ConfigKeys.APPLYING_GLOBAL_WORLD_GROUPS),
|
||||
player.isOp()
|
||||
);
|
||||
return contextManager.getApplicableContexts(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -635,27 +658,17 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
@Override
|
||||
public LinkedHashMap<String, Object> getExtraInfo() {
|
||||
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("Vault Enabled", vaultHook != null);
|
||||
map.put("Vault Server", configuration.get(ConfigKeys.VAULT_SERVER));
|
||||
map.put("Vault Enabled", vaultHookManager != null);
|
||||
map.put("Bukkit Defaults count", defaultsProvider.size());
|
||||
map.put("Bukkit Child Permissions count", childPermissionProvider.getPermissions().size());
|
||||
map.put("Vault Including Global", configuration.get(ConfigKeys.VAULT_INCLUDING_GLOBAL));
|
||||
map.put("Vault Ignoring World", configuration.get(ConfigKeys.VAULT_IGNORE_WORLD));
|
||||
map.put("Vault Primary Group Overrides", configuration.get(ConfigKeys.VAULT_PRIMARY_GROUP_OVERRIDES));
|
||||
map.put("Vault Debug", configuration.get(ConfigKeys.VAULT_DEBUG));
|
||||
map.put("OPs Enabled", configuration.get(ConfigKeys.OPS_ENABLED));
|
||||
map.put("Auto OP", configuration.get(ConfigKeys.AUTO_OP));
|
||||
map.put("Commands Allow OPs", configuration.get(ConfigKeys.COMMANDS_ALLOW_OP));
|
||||
return map;
|
||||
}
|
||||
|
||||
private void registerPermissions(PermissionDefault def) {
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
|
||||
for (Permission p : Permission.values()) {
|
||||
for (String node : p.getNodes()) {
|
||||
pm.addPermission(new org.bukkit.permissions.Permission(node, def));
|
||||
}
|
||||
for (CommandPermission p : CommandPermission.values()) {
|
||||
pm.addPermission(new org.bukkit.permissions.Permission(p.getPermission(), def));
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
-9
@@ -23,27 +23,29 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.bukkit;
|
||||
package me.lucko.luckperms.bukkit.calculators;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import me.lucko.luckperms.api.Contexts;
|
||||
import me.lucko.luckperms.bukkit.calculators.AttachmentProcessor;
|
||||
import me.lucko.luckperms.bukkit.calculators.ChildProcessor;
|
||||
import me.lucko.luckperms.bukkit.calculators.DefaultsProcessor;
|
||||
import me.lucko.luckperms.bukkit.LPBukkitPlugin;
|
||||
import me.lucko.luckperms.bukkit.model.Injector;
|
||||
import me.lucko.luckperms.bukkit.model.LPPermissible;
|
||||
import me.lucko.luckperms.bukkit.processors.AttachmentProcessor;
|
||||
import me.lucko.luckperms.bukkit.processors.ChildProcessor;
|
||||
import me.lucko.luckperms.bukkit.processors.DefaultsProcessor;
|
||||
import me.lucko.luckperms.common.calculators.AbstractCalculatorFactory;
|
||||
import me.lucko.luckperms.common.calculators.PermissionCalculator;
|
||||
import me.lucko.luckperms.common.calculators.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.calculators.processors.MapProcessor;
|
||||
import me.lucko.luckperms.common.calculators.processors.RegexProcessor;
|
||||
import me.lucko.luckperms.common.calculators.processors.WildcardProcessor;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.processors.MapProcessor;
|
||||
import me.lucko.luckperms.common.processors.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.processors.RegexProcessor;
|
||||
import me.lucko.luckperms.common.processors.WildcardProcessor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@AllArgsConstructor
|
||||
@@ -82,4 +84,16 @@ public class BukkitCalculatorFactory extends AbstractCalculatorFactory {
|
||||
|
||||
return registerCalculator(new PermissionCalculator(plugin, user.getFriendlyName(), processors.build()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getActiveProcessors() {
|
||||
ImmutableList.Builder<String> ret = ImmutableList.builder();
|
||||
ret.add("Map");
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_CHILD_PERMISSIONS)) ret.add("Child");
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_ATTACHMENT_PERMISSIONS)) ret.add("Attachment");
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLYING_REGEX)) ret.add("Regex");
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLYING_WILDCARDS)) ret.add("Wildcard");
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_DEFAULT_PERMISSIONS)) ret.add("Defaults");
|
||||
return ret.build();
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,17 @@
|
||||
|
||||
package me.lucko.luckperms.bukkit.compat;
|
||||
|
||||
import me.lucko.luckperms.common.constants.Constants;
|
||||
|
||||
import net.kyori.text.Component;
|
||||
import net.kyori.text.serializer.ComponentSerializer;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import io.github.mkremins.fanciful.FancyMessage;
|
||||
|
||||
/**
|
||||
* Sends a json message to a command sender.
|
||||
*/
|
||||
public class MessageHandler {
|
||||
private final BukkitJsonMessageHandler bukkitHandler;
|
||||
private final SpigotJsonMessageHandler spigotHandler;
|
||||
@@ -39,10 +45,10 @@ public class MessageHandler {
|
||||
spigotHandler = isSpigot() ? new SpigotJsonMessageHandler() : null;
|
||||
}
|
||||
|
||||
public void sendJsonMessage(CommandSender sender, FancyMessage message) {
|
||||
public void sendJsonMessage(CommandSender sender, Component message) {
|
||||
if (ReflectionUtil.isChatCompatible() && sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
String json = message.exportToJson();
|
||||
String json = ComponentSerializer.serialize(message);
|
||||
|
||||
// Try Bukkit.
|
||||
if (bukkitHandler.sendJsonMessage(player, json)) {
|
||||
@@ -56,7 +62,7 @@ public class MessageHandler {
|
||||
}
|
||||
|
||||
// Fallback to Bukkit
|
||||
sender.sendMessage(message.toOldMessageFormat());
|
||||
sender.sendMessage(ComponentSerializer.toLegacy(message, Constants.COLOR_CHAR));
|
||||
}
|
||||
|
||||
private static boolean isSpigot() {
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.bukkit;
|
||||
package me.lucko.luckperms.bukkit.contexts;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
+10
-8
@@ -39,12 +39,14 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.impl.migration.MigrationUtils;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.logging.ProgressLogger;
|
||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.node.NodeFactory;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.utils.ProgressLogger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@@ -57,7 +59,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static me.lucko.luckperms.common.constants.Permission.MIGRATION;
|
||||
import static me.lucko.luckperms.common.constants.CommandPermission.MIGRATION;
|
||||
|
||||
public class MigrationBPermissions extends SubCommand<Object> {
|
||||
private static Field uConfigField;
|
||||
@@ -70,8 +72,8 @@ public class MigrationBPermissions extends SubCommand<Object> {
|
||||
}
|
||||
}
|
||||
|
||||
public MigrationBPermissions() {
|
||||
super("bpermissions", "Migration from bPermissions", MIGRATION, Predicates.alwaysFalse(), null);
|
||||
public MigrationBPermissions(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION_COMMAND.spec(locale), "bpermissions", MIGRATION, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,7 +139,7 @@ public class MigrationBPermissions extends SubCommand<Object> {
|
||||
|
||||
// Make a LuckPerms group for the one being migrated.
|
||||
plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
||||
me.lucko.luckperms.common.core.model.Group lpGroup = plugin.getGroupManager().getIfLoaded(groupName);
|
||||
me.lucko.luckperms.common.model.Group lpGroup = plugin.getGroupManager().getIfLoaded(groupName);
|
||||
|
||||
MigrationUtils.setGroupWeight(lpGroup, group.getPriority());
|
||||
migrateHolder(world, group, lpGroup);
|
||||
|
||||
+11
-12
@@ -28,17 +28,18 @@ package me.lucko.luckperms.bukkit.migration;
|
||||
import me.lucko.luckperms.api.ChatMetaType;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.impl.migration.MigrationUtils;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.constants.CommandPermission;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.logging.ProgressLogger;
|
||||
import me.lucko.luckperms.common.node.NodeFactory;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.utils.ProgressLogger;
|
||||
|
||||
import org.anjocaido.groupmanager.GlobalGroups;
|
||||
import org.anjocaido.groupmanager.GroupManager;
|
||||
@@ -60,10 +61,8 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MigrationGroupManager extends SubCommand<Object> {
|
||||
public MigrationGroupManager() {
|
||||
super("groupmanager", "Migration from GroupManager", Permission.MIGRATION, Predicates.is(0),
|
||||
Arg.list(Arg.create("migrate as global", true, "if world permissions should be ignored, and just migrated as global"))
|
||||
);
|
||||
public MigrationGroupManager(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION_GROUPMANAGER.spec(locale), "groupmanager", CommandPermission.MIGRATION, Predicates.is(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,7 +97,7 @@ public class MigrationGroupManager extends SubCommand<Object> {
|
||||
String groupName = MigrationUtils.standardizeName(g.getName());
|
||||
|
||||
plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
||||
me.lucko.luckperms.common.core.model.Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
||||
me.lucko.luckperms.common.model.Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
||||
|
||||
for (String node : g.getPermissionList()) {
|
||||
if (node.isEmpty()) {
|
||||
@@ -249,7 +248,7 @@ public class MigrationGroupManager extends SubCommand<Object> {
|
||||
AtomicInteger groupCount = new AtomicInteger(0);
|
||||
for (Map.Entry<String, Set<Node>> e : groups.entrySet()) {
|
||||
plugin.getStorage().createAndLoadGroup(e.getKey(), CreationCause.INTERNAL).join();
|
||||
me.lucko.luckperms.common.core.model.Group group = plugin.getGroupManager().getIfLoaded(e.getKey());
|
||||
me.lucko.luckperms.common.model.Group group = plugin.getGroupManager().getIfLoaded(e.getKey());
|
||||
|
||||
for (Node node : e.getValue()) {
|
||||
group.setPermission(node);
|
||||
@@ -264,14 +263,14 @@ public class MigrationGroupManager extends SubCommand<Object> {
|
||||
AtomicInteger userCount = new AtomicInteger(0);
|
||||
for (Map.Entry<UUID, Set<Node>> e : users.entrySet()) {
|
||||
plugin.getStorage().loadUser(e.getKey(), "null").join();
|
||||
me.lucko.luckperms.common.core.model.User user = plugin.getUserManager().getIfLoaded(e.getKey());
|
||||
me.lucko.luckperms.common.model.User user = plugin.getUserManager().getIfLoaded(e.getKey());
|
||||
|
||||
for (Node node : e.getValue()) {
|
||||
user.setPermission(node);
|
||||
}
|
||||
|
||||
String primaryGroup = primaryGroups.get(e.getKey());
|
||||
if (primaryGroup != null) {
|
||||
if (primaryGroup != null && !primaryGroup.isEmpty()) {
|
||||
user.setPermission(NodeFactory.make("group." + primaryGroup));
|
||||
user.getPrimaryGroup().setStoredValue(primaryGroup);
|
||||
user.unsetPermission(NodeFactory.make("group.default"));
|
||||
|
||||
+92
-120
@@ -31,18 +31,21 @@ import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.impl.migration.MigrationUtils;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.constants.CommandPermission;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.logging.ProgressLogger;
|
||||
import me.lucko.luckperms.common.model.Group;
|
||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.node.NodeFactory;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.utils.ProgressLogger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import ru.tehkode.permissions.NativeInterface;
|
||||
import ru.tehkode.permissions.PermissionEntity;
|
||||
import ru.tehkode.permissions.PermissionGroup;
|
||||
import ru.tehkode.permissions.PermissionManager;
|
||||
import ru.tehkode.permissions.PermissionUser;
|
||||
@@ -50,13 +53,13 @@ import ru.tehkode.permissions.bukkit.PermissionsEx;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
public MigrationPermissionsEx() {
|
||||
super("permissionsex", "Migration from PermissionsEx", Permission.MIGRATION, Predicates.alwaysFalse(), null);
|
||||
public MigrationPermissionsEx(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION_COMMAND.spec(locale), "permissionsex", CommandPermission.MIGRATION, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@@ -73,8 +76,6 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
List<String> worlds = Bukkit.getWorlds().stream().map(World::getName).map(String::toLowerCase).collect(Collectors.toList());
|
||||
|
||||
PermissionsEx pex = (PermissionsEx) Bukkit.getPluginManager().getPlugin("PermissionsEx");
|
||||
PermissionManager manager = pex.getPermissionsManager();
|
||||
|
||||
@@ -107,56 +108,8 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
|
||||
MigrationUtils.setGroupWeight(lpGroup, groupWeight);
|
||||
|
||||
try {
|
||||
for (String node : group.getOwnPermissions(null)) {
|
||||
if (node.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lpGroup.setPermission(MigrationUtils.parseNode(node, true).build());
|
||||
}
|
||||
} catch (NullPointerException ignored) {
|
||||
// No docs on if #getOwnPermissions(null) is ok. Should be fine though.
|
||||
}
|
||||
|
||||
for (String world : worlds) {
|
||||
if (world.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (String node : group.getOwnPermissions(world)) {
|
||||
if (node.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lpGroup.setPermission(MigrationUtils.parseNode(node, true).setWorld(world.toLowerCase()).build());
|
||||
}
|
||||
}
|
||||
|
||||
for (PermissionGroup g : group.getParents()) {
|
||||
lpGroup.setPermission(NodeFactory.make("group." + MigrationUtils.standardizeName(g.getName())));
|
||||
}
|
||||
|
||||
for (String world : worlds) {
|
||||
if (world.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (PermissionGroup g : group.getParents(world)) {
|
||||
lpGroup.setPermission(NodeFactory.make("group." + MigrationUtils.standardizeName(g.getName()), true, "global", world.toLowerCase()));
|
||||
}
|
||||
}
|
||||
|
||||
String prefix = group.getOwnPrefix();
|
||||
String suffix = group.getOwnSuffix();
|
||||
|
||||
if (prefix != null && !prefix.equals("")) {
|
||||
lpGroup.setPermission(NodeFactory.makePrefixNode(groupWeight, prefix).build());
|
||||
}
|
||||
|
||||
if (suffix != null && !suffix.equals("")) {
|
||||
lpGroup.setPermission(NodeFactory.makeSuffixNode(groupWeight, suffix).build());
|
||||
}
|
||||
// migrate data
|
||||
migrateEntity(group, lpGroup, groupWeight);
|
||||
|
||||
plugin.getStorage().saveGroup(lpGroup);
|
||||
log.logAllProgress("Migrated {} groups so far.", groupCount.incrementAndGet());
|
||||
@@ -193,64 +146,8 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
plugin.getStorage().loadUser(u, user.getName()).join();
|
||||
User lpUser = plugin.getUserManager().getIfLoaded(u);
|
||||
|
||||
try {
|
||||
for (String node : user.getOwnPermissions(null)) {
|
||||
if (node.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lpUser.setPermission(MigrationUtils.parseNode(node, true).build());
|
||||
}
|
||||
} catch (NullPointerException ignored) {
|
||||
// No docs on if #getOwnPermissions(null) is ok. Should be fine though.
|
||||
}
|
||||
|
||||
for (String world : worlds) {
|
||||
if (world.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (String node : user.getOwnPermissions(world)) {
|
||||
if (node.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lpUser.setPermission(MigrationUtils.parseNode(node, true).setWorld(world.toLowerCase()).build());
|
||||
}
|
||||
}
|
||||
|
||||
for (String g : user.getGroupNames()) {
|
||||
if (g.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lpUser.setPermission(NodeFactory.make("group." + MigrationUtils.standardizeName(g)));
|
||||
}
|
||||
|
||||
for (String world : worlds) {
|
||||
if (world.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (String g : user.getGroupNames(world)) {
|
||||
if (g.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lpUser.setPermission(NodeFactory.make("group." + MigrationUtils.standardizeName(g), true, "global", world.toLowerCase()));
|
||||
}
|
||||
}
|
||||
|
||||
String prefix = user.getOwnPrefix();
|
||||
String suffix = user.getOwnSuffix();
|
||||
|
||||
if (prefix != null && !prefix.equals("")) {
|
||||
lpUser.setPermission(NodeFactory.makePrefixNode(maxWeight, prefix).build());
|
||||
}
|
||||
|
||||
if (suffix != null && !suffix.equals("")) {
|
||||
lpUser.setPermission(NodeFactory.makeSuffixNode(maxWeight, suffix).build());
|
||||
}
|
||||
// migrate data
|
||||
migrateEntity(user, lpUser, maxWeight);
|
||||
|
||||
// Lowest rank is the highest group #logic
|
||||
String primary = null;
|
||||
@@ -262,7 +159,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
}
|
||||
}
|
||||
|
||||
if (primary != null && !primary.equalsIgnoreCase("default")) {
|
||||
if (primary != null && !primary.isEmpty() && !primary.equalsIgnoreCase("default")) {
|
||||
lpUser.setPermission(NodeFactory.make("group." + primary.toLowerCase()));
|
||||
lpUser.getPrimaryGroup().setStoredValue(primary);
|
||||
lpUser.unsetPermission(NodeFactory.make("group.default"));
|
||||
@@ -277,4 +174,79 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
log.log("Success! Migration complete.");
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
private static void migrateEntity(PermissionEntity entity, PermissionHolder holder, int weight) {
|
||||
// migrate permissions
|
||||
Map<String, List<String>> permissions = entity.getAllPermissions();
|
||||
for (Map.Entry<String, List<String>> worldData : permissions.entrySet()) {
|
||||
String world = worldData.getKey();
|
||||
if (world != null && (world.equals("") || world.equals("*"))) {
|
||||
world = null;
|
||||
}
|
||||
if (world != null) {
|
||||
world = world.toLowerCase();
|
||||
}
|
||||
|
||||
for (String node : worldData.getValue()) {
|
||||
if (node.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
holder.setPermission(MigrationUtils.parseNode(node, true).setWorld(world).build());
|
||||
}
|
||||
}
|
||||
|
||||
// migrate parents
|
||||
Map<String, List<PermissionGroup>> parents = entity.getAllParents();
|
||||
for (Map.Entry<String, List<PermissionGroup>> worldData : parents.entrySet()) {
|
||||
String world = worldData.getKey();
|
||||
if (world != null && (world.equals("") || world.equals("*"))) {
|
||||
world = null;
|
||||
}
|
||||
if (world != null) {
|
||||
world = world.toLowerCase();
|
||||
}
|
||||
|
||||
for (PermissionGroup parent : worldData.getValue()) {
|
||||
holder.setPermission(NodeFactory.newBuilder("group." + MigrationUtils.standardizeName(parent.getName())).setWorld(world).build());
|
||||
}
|
||||
}
|
||||
|
||||
// migrate prefix / suffix
|
||||
String prefix = entity.getOwnPrefix();
|
||||
String suffix = entity.getOwnSuffix();
|
||||
|
||||
if (prefix != null && !prefix.isEmpty()) {
|
||||
holder.setPermission(NodeFactory.makePrefixNode(weight, prefix).build());
|
||||
}
|
||||
|
||||
if (suffix != null && !suffix.isEmpty()) {
|
||||
holder.setPermission(NodeFactory.makeSuffixNode(weight, suffix).build());
|
||||
}
|
||||
|
||||
// migrate options
|
||||
Map<String, Map<String, String>> options = entity.getAllOptions();
|
||||
for (Map.Entry<String, Map<String, String>> worldData : options.entrySet()) {
|
||||
String world = worldData.getKey();
|
||||
if (world != null && (world.isEmpty() || world.equals("*"))) {
|
||||
world = null;
|
||||
}
|
||||
if (world != null) {
|
||||
world = world.toLowerCase();
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> opt : worldData.getValue().entrySet()) {
|
||||
if (opt.getKey() == null || opt.getKey().isEmpty() || opt.getValue() == null || opt.getValue().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String key = opt.getKey().toLowerCase();
|
||||
if (key.equals("prefix") || key.equals("suffix") || key.equals("weight") || key.equals("rank") || key.equals("name") || key.equals("username")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
holder.setPermission(NodeFactory.makeMetaNode(opt.getKey(), opt.getValue()).setWorld(world).build());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
-31
@@ -35,22 +35,23 @@ import com.github.cheesesoftware.PowerfulPermsAPI.PowerfulPermsPlugin;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
import me.lucko.luckperms.common.commands.Arg;
|
||||
import me.lucko.luckperms.common.commands.CommandException;
|
||||
import me.lucko.luckperms.common.commands.CommandResult;
|
||||
import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.impl.migration.MigrationUtils;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.dependencies.DependencyManager;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.logging.ProgressLogger;
|
||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.node.NodeFactory;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.storage.StorageType;
|
||||
import me.lucko.luckperms.common.utils.HikariSupplier;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.utils.ProgressLogger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@@ -67,20 +68,12 @@ import java.util.UUID;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static me.lucko.luckperms.common.constants.Permission.MIGRATION;
|
||||
import static me.lucko.luckperms.common.constants.CommandPermission.MIGRATION;
|
||||
|
||||
// Only supports the latest versions of the PP API. (it seems to change randomly almost every release)
|
||||
public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
public MigrationPowerfulPerms() {
|
||||
super("powerfulperms", "Migration from PowerfulPerms", MIGRATION, Predicates.not(5),
|
||||
Arg.list(
|
||||
Arg.create("address", true, "the address of the PP database"),
|
||||
Arg.create("database", true, "the name of the PP database"),
|
||||
Arg.create("username", true, "the username to log into the DB"),
|
||||
Arg.create("password", true, "the password to log into the DB"),
|
||||
Arg.create("db table", true, "the name of the PP table where player data is stored")
|
||||
)
|
||||
);
|
||||
public MigrationPowerfulPerms(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION_POWERFULPERMS.spec(locale), "powerfulperms", MIGRATION, Predicates.not(5));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,7 +167,7 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
|
||||
final String groupName = MigrationUtils.standardizeName(g.getName());
|
||||
plugin.getStorage().createAndLoadGroup(groupName, CreationCause.INTERNAL).join();
|
||||
final me.lucko.luckperms.common.core.model.Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
||||
final me.lucko.luckperms.common.model.Group group = plugin.getGroupManager().getIfLoaded(groupName);
|
||||
|
||||
MigrationUtils.setGroupWeight(group, g.getRank());
|
||||
|
||||
@@ -188,6 +181,10 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
|
||||
// server --> prefix afaik
|
||||
for (Map.Entry<String, String> prefix : g.getPrefixes().entrySet()) {
|
||||
if (prefix.getValue().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String server = prefix.getKey().toLowerCase();
|
||||
if (prefix.getKey().equals("*") || prefix.getKey().equals("all")) {
|
||||
server = null;
|
||||
@@ -201,6 +198,10 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> suffix : g.getSuffixes().entrySet()) {
|
||||
if (suffix.getValue().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String server = suffix.getKey().toLowerCase();
|
||||
if (suffix.getKey().equals("*") || suffix.getKey().equals("all")) {
|
||||
server = null;
|
||||
@@ -254,11 +255,11 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
String prefix = joinFuture(pm.getPlayerOwnPrefix(uuid));
|
||||
String suffix = joinFuture(pm.getPlayerOwnSuffix(uuid));
|
||||
|
||||
if (prefix != null && !prefix.equals("")) {
|
||||
if (prefix != null && !prefix.isEmpty()) {
|
||||
user.setPermission(NodeFactory.makePrefixNode(maxWeight, prefix).build());
|
||||
}
|
||||
|
||||
if (suffix != null && !suffix.equals("")) {
|
||||
if (suffix != null && !suffix.isEmpty()) {
|
||||
user.setPermission(NodeFactory.makeSuffixNode(maxWeight, suffix).build());
|
||||
}
|
||||
|
||||
@@ -286,6 +287,10 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
value = false;
|
||||
}
|
||||
|
||||
if (node.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String server = p.getServer();
|
||||
if (server != null && (server.equalsIgnoreCase("all") || server.equalsIgnoreCase("*"))) {
|
||||
server = null;
|
||||
@@ -306,18 +311,9 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
}
|
||||
|
||||
Node.Builder nb = NodeFactory.newBuilder(node).setValue(value);
|
||||
|
||||
if (expireAt != 0) {
|
||||
nb.setExpiry(expireAt);
|
||||
}
|
||||
|
||||
if (server != null) {
|
||||
nb.setServer(server);
|
||||
}
|
||||
|
||||
if (world != null) {
|
||||
nb.setWorld(world);
|
||||
}
|
||||
if (expireAt != 0) nb.setExpiry(expireAt);
|
||||
if (server != null) nb.setServer(server);
|
||||
if (world != null) nb.setWorld(world);
|
||||
|
||||
holder.setPermission(nb.build());
|
||||
}
|
||||
|
||||
+19
-9
@@ -34,15 +34,17 @@ import me.lucko.luckperms.common.commands.abstraction.SubCommand;
|
||||
import me.lucko.luckperms.common.commands.impl.migration.MigrationUtils;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.commands.utils.Util;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.Track;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.constants.CommandPermission;
|
||||
import me.lucko.luckperms.common.locale.CommandSpec;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.logging.ProgressLogger;
|
||||
import me.lucko.luckperms.common.model.Group;
|
||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.model.Track;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.node.NodeFactory;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.utils.ProgressLogger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.tyrannyofheaven.bukkit.zPermissions.ZPermissionsService;
|
||||
@@ -62,8 +64,8 @@ import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class MigrationZPermissions extends SubCommand<Object> {
|
||||
public MigrationZPermissions() {
|
||||
super("zpermissions", "Migration from zPermissions", Permission.MIGRATION, Predicates.alwaysFalse(), null);
|
||||
public MigrationZPermissions(LocaleManager locale) {
|
||||
super(CommandSpec.MIGRATION_COMMAND.spec(locale), "zpermissions", CommandPermission.MIGRATION, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,6 +196,10 @@ public class MigrationZPermissions extends SubCommand<Object> {
|
||||
|
||||
private void migrateEntity(PermissionHolder holder, PermissionEntity entity, int weight) {
|
||||
for (Entry e : entity.getPermissions()) {
|
||||
if (e.getPermission().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (e.getWorld() != null && !e.getWorld().getName().equals("")) {
|
||||
holder.setPermission(NodeFactory.newBuilder(e.getPermission()).setValue(e.isValue()).setWorld(e.getWorld().getName()).build());
|
||||
} else {
|
||||
@@ -213,6 +219,10 @@ public class MigrationZPermissions extends SubCommand<Object> {
|
||||
for (EntityMetadata metadata : entity.getMetadata()) {
|
||||
String key = metadata.getName().toLowerCase();
|
||||
|
||||
if (key.isEmpty() || metadata.getStringValue().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key.equals("prefix") || key.equals("suffix")) {
|
||||
ChatMetaType type = ChatMetaType.valueOf(key.toUpperCase());
|
||||
holder.setPermission(NodeFactory.makeChatMetaNode(type, weight, metadata.getStringValue()).build());
|
||||
|
||||
@@ -40,31 +40,49 @@ import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Injects a {@link LPPermissible} into a {@link Player}
|
||||
* Injects a {@link LPPermissible} into a {@link Player}.
|
||||
*
|
||||
* This allows LuckPerms to directly intercept permission checks and take over all handling of
|
||||
* checks made by plugins.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@UtilityClass
|
||||
public class Injector {
|
||||
private static final Map<UUID, LPPermissible> INJECTED_PERMISSIBLES = new ConcurrentHashMap<>();
|
||||
|
||||
private static Field humanEntityField;
|
||||
private static Field permissibleAttachmentsField;
|
||||
private static Throwable cachedThrowable = null;
|
||||
/**
|
||||
* All permission checks made on standard Bukkit objects are effectively proxied to a
|
||||
* {@link PermissibleBase} object, held as a parameter on the object.
|
||||
*
|
||||
* This field is where the permissible is stored on a HumanEntity.
|
||||
*/
|
||||
private static Field humanEntityPermissibleField;
|
||||
|
||||
/**
|
||||
* The field where attachments are stored on a permissible base.
|
||||
*/
|
||||
private static Field permissibleBaseAttachmentsField;
|
||||
|
||||
private static Throwable cachedThrowable = null;
|
||||
static {
|
||||
try {
|
||||
// Catch all. If this setup doesn't fully complete without
|
||||
// exceptions, then the Injector will not work.
|
||||
|
||||
// Try to load the permissible field.
|
||||
try {
|
||||
// craftbukkit
|
||||
humanEntityField = ReflectionUtil.obcClass("entity.CraftHumanEntity").getDeclaredField("perm");
|
||||
humanEntityField.setAccessible(true);
|
||||
humanEntityPermissibleField = ReflectionUtil.obcClass("entity.CraftHumanEntity").getDeclaredField("perm");
|
||||
humanEntityPermissibleField.setAccessible(true);
|
||||
|
||||
} catch (Exception e) {
|
||||
// glowstone
|
||||
humanEntityField = Class.forName("net.glowstone.entity.GlowHumanEntity").getDeclaredField("permissions");
|
||||
humanEntityField.setAccessible(true);
|
||||
humanEntityPermissibleField = Class.forName("net.glowstone.entity.GlowHumanEntity").getDeclaredField("permissions");
|
||||
humanEntityPermissibleField.setAccessible(true);
|
||||
}
|
||||
|
||||
permissibleAttachmentsField = PermissibleBase.class.getDeclaredField("attachments");
|
||||
permissibleAttachmentsField.setAccessible(true);
|
||||
// Try to load the attachments field.
|
||||
permissibleBaseAttachmentsField = PermissibleBase.class.getDeclaredField("attachments");
|
||||
permissibleBaseAttachmentsField.setAccessible(true);
|
||||
|
||||
} catch (Throwable t) {
|
||||
cachedThrowable = t;
|
||||
@@ -72,82 +90,107 @@ public class Injector {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean inject(Player player, LPPermissible lpPermissible) {
|
||||
/**
|
||||
* Injects a {@link LPPermissible} into a {@link Player}.
|
||||
*
|
||||
* @param player the player to inject into
|
||||
* @param newPermissible the permissible to inject
|
||||
* @throws Exception propagates any exceptions which were thrown during injection
|
||||
*/
|
||||
public static void inject(Player player, LPPermissible newPermissible) throws Exception {
|
||||
|
||||
// make sure the class inited without errors, otherwise, print a trace
|
||||
if (cachedThrowable != null) {
|
||||
cachedThrowable.printStackTrace();
|
||||
return false;
|
||||
throw new RuntimeException("Injector did not init successfully.", cachedThrowable);
|
||||
}
|
||||
|
||||
try {
|
||||
PermissibleBase existing = (PermissibleBase) humanEntityField.get(player);
|
||||
if (existing instanceof LPPermissible) {
|
||||
// uh oh
|
||||
throw new IllegalStateException("LPPermissible already injected into player " + player.toString());
|
||||
}
|
||||
// get the existing PermissibleBase held by the player
|
||||
PermissibleBase oldPermissible = (PermissibleBase) humanEntityPermissibleField.get(player);
|
||||
|
||||
// Move attachments over from the old permissible.
|
||||
List<PermissionAttachment> attachments = (List<PermissionAttachment>) permissibleAttachmentsField.get(existing);
|
||||
lpPermissible.addAttachments(attachments);
|
||||
attachments.clear();
|
||||
existing.clearPermissions();
|
||||
|
||||
lpPermissible.getActive().set(true);
|
||||
lpPermissible.recalculatePermissions(false);
|
||||
lpPermissible.setOldPermissible(existing);
|
||||
|
||||
lpPermissible.updateSubscriptionsAsync();
|
||||
|
||||
humanEntityField.set(player, lpPermissible);
|
||||
INJECTED_PERMISSIBLES.put(player.getUniqueId(), lpPermissible);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
// seems we have already injected into this player.
|
||||
if (oldPermissible instanceof LPPermissible) {
|
||||
throw new IllegalStateException("LPPermissible already injected into player " + player.toString());
|
||||
}
|
||||
|
||||
// Move attachments over from the old permissible
|
||||
|
||||
//noinspection unchecked
|
||||
List<PermissionAttachment> attachments = (List<PermissionAttachment>) permissibleBaseAttachmentsField.get(oldPermissible);
|
||||
|
||||
newPermissible.addAttachments(attachments);
|
||||
attachments.clear();
|
||||
oldPermissible.clearPermissions();
|
||||
|
||||
// Setup the new permissible
|
||||
newPermissible.getActive().set(true);
|
||||
newPermissible.recalculatePermissions(false);
|
||||
newPermissible.setOldPermissible(oldPermissible);
|
||||
newPermissible.updateSubscriptionsAsync();
|
||||
|
||||
// inject the new instance
|
||||
humanEntityPermissibleField.set(player, newPermissible);
|
||||
|
||||
// register the injection with the map
|
||||
INJECTED_PERMISSIBLES.put(player.getUniqueId(), newPermissible);
|
||||
}
|
||||
|
||||
public static boolean unInject(Player player, boolean dummy, boolean unsubscribe) {
|
||||
/**
|
||||
* Uninjects a {@link LPPermissible} from a {@link Player}.
|
||||
*
|
||||
* @param player the player to uninject from
|
||||
* @param dummy if the replacement permissible should be a dummy.
|
||||
* @param unsubscribe if the extracted permissible should unsubscribe itself. see {@link SubscriptionManager}.
|
||||
* @throws Exception propagates any exceptions which were thrown during uninjection
|
||||
*/
|
||||
public static void unInject(Player player, boolean dummy, boolean unsubscribe) throws Exception {
|
||||
// make sure the class inited without errors, otherwise, print a trace
|
||||
if (cachedThrowable != null) {
|
||||
cachedThrowable.printStackTrace();
|
||||
return false;
|
||||
throw new RuntimeException("Injector did not init successfully.", cachedThrowable);
|
||||
}
|
||||
|
||||
try {
|
||||
PermissibleBase permissible = (PermissibleBase) humanEntityField.get(player);
|
||||
if (permissible instanceof LPPermissible) {
|
||||
// gets the players current permissible.
|
||||
PermissibleBase permissible = (PermissibleBase) humanEntityPermissibleField.get(player);
|
||||
|
||||
permissible.clearPermissions();
|
||||
// only uninject if the permissible was a luckperms one.
|
||||
if (permissible instanceof LPPermissible) {
|
||||
LPPermissible lpPermissible = ((LPPermissible) permissible);
|
||||
|
||||
if (unsubscribe) {
|
||||
((LPPermissible) permissible).unsubscribeFromAllAsync();
|
||||
}
|
||||
// clear all permissions
|
||||
lpPermissible.clearPermissions();
|
||||
|
||||
((LPPermissible) permissible).getActive().set(false);
|
||||
|
||||
if (dummy) {
|
||||
humanEntityField.set(player, new DummyPermissibleBase());
|
||||
} else {
|
||||
LPPermissible lpp = ((LPPermissible) permissible);
|
||||
List<PermissionAttachment> attachments = lpp.getAttachments();
|
||||
|
||||
PermissibleBase newPb = lpp.getOldPermissible();
|
||||
if (newPb == null) {
|
||||
newPb = new PermissibleBase(player);
|
||||
}
|
||||
|
||||
List<PermissionAttachment> newAttachments = (List<PermissionAttachment>) permissibleAttachmentsField.get(newPb);
|
||||
newAttachments.addAll(attachments);
|
||||
attachments.clear();
|
||||
|
||||
humanEntityField.set(player, newPb);
|
||||
}
|
||||
// try to unsubscribe
|
||||
if (unsubscribe) {
|
||||
lpPermissible.unsubscribeFromAllAsync();
|
||||
}
|
||||
|
||||
// set to inactive
|
||||
lpPermissible.getActive().set(false);
|
||||
|
||||
// handle the replacement permissible.
|
||||
if (dummy) {
|
||||
// just inject a dummy class. this is used when we know the player is about to quit the server.
|
||||
humanEntityPermissibleField.set(player, new DummyPermissibleBase());
|
||||
|
||||
} else {
|
||||
// otherwise, inject the permissible they had when we first injected.
|
||||
|
||||
List<PermissionAttachment> lpAttachments = lpPermissible.getAttachments();
|
||||
|
||||
PermissibleBase newPb = lpPermissible.getOldPermissible();
|
||||
if (newPb == null) {
|
||||
newPb = new PermissibleBase(player);
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
List<PermissionAttachment> newPbAttachments = (List<PermissionAttachment>) permissibleBaseAttachmentsField.get(newPb);
|
||||
newPbAttachments.addAll(lpAttachments);
|
||||
lpAttachments.clear();
|
||||
|
||||
humanEntityPermissibleField.set(player, newPb);
|
||||
}
|
||||
INJECTED_PERMISSIBLES.remove(player.getUniqueId());
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
INJECTED_PERMISSIBLES.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
public static LPPermissible getPermissible(UUID uuid) {
|
||||
|
||||
@@ -34,7 +34,7 @@ import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.bukkit.LPBukkitPlugin;
|
||||
import me.lucko.luckperms.common.caching.UserCache;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -45,9 +45,10 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.permissions.PermissionRemovedExecutor;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -57,24 +58,47 @@ import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Modified PermissibleBase for LuckPerms
|
||||
* PermissibleBase for LuckPerms.
|
||||
*
|
||||
* This class overrides all methods defined in PermissibleBase, and provides custom handling
|
||||
* from LuckPerms.
|
||||
*
|
||||
* This means that all permission checks made for a player are handled directly by the plugin.
|
||||
* Method behaviour is retained, but alternate implementation is used.
|
||||
*
|
||||
* "Hot" method calls, (namely #hasPermission) are significantly faster than the base implementation.
|
||||
*
|
||||
* This class is **thread safe**. This means that when LuckPerms is installed on the server,
|
||||
* is is safe to call Player#hasPermission asynchronously.
|
||||
*/
|
||||
@Getter
|
||||
public class LPPermissible extends PermissibleBase {
|
||||
|
||||
// the LuckPerms user this permissible references.
|
||||
private final User user;
|
||||
|
||||
// the player this permissible is injected into.
|
||||
private final Player parent;
|
||||
|
||||
// the luckperms plugin instance
|
||||
private final LPBukkitPlugin plugin;
|
||||
|
||||
// the subscription manager, handling the players permission subscriptions.
|
||||
private final SubscriptionManager subscriptions;
|
||||
|
||||
// the players previous permissible. (the one they had before this one was injected)
|
||||
@Setter
|
||||
private PermissibleBase oldPermissible = null;
|
||||
|
||||
// if the permissible is currently active.
|
||||
private final AtomicBoolean active = new AtomicBoolean(false);
|
||||
|
||||
// Attachment stuff.
|
||||
// the permissions registered by PermissionAttachments.
|
||||
// stored in this format, as that's what is used by #getEffectivePermissions
|
||||
private final Map<String, PermissionAttachmentInfo> attachmentPermissions = new ConcurrentHashMap<>();
|
||||
private final List<PermissionAttachment> attachments = Collections.synchronizedList(new LinkedList<>());
|
||||
|
||||
// the attachments hooked onto the permissible.
|
||||
private final List<PermissionAttachment> attachments = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
public LPPermissible(@NonNull Player parent, @NonNull User user, @NonNull LPBukkitPlugin plugin) {
|
||||
super(parent);
|
||||
@@ -82,10 +106,51 @@ public class LPPermissible extends PermissibleBase {
|
||||
this.parent = parent;
|
||||
this.plugin = plugin;
|
||||
this.subscriptions = new SubscriptionManager(this);
|
||||
|
||||
// recalculatePermissions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(@NonNull String permission) {
|
||||
Tristate ts = user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(permission);
|
||||
return ts != Tristate.UNDEFINED || Permission.DEFAULT_PERMISSION.getValue(isOp());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(@NonNull Permission permission) {
|
||||
Tristate ts = user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(permission.getName());
|
||||
if (ts != Tristate.UNDEFINED) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_DEFAULT_PERMISSIONS)) {
|
||||
return Permission.DEFAULT_PERMISSION.getValue(isOp());
|
||||
} else {
|
||||
return permission.getDefault().getValue(isOp());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NonNull String permission) {
|
||||
Tristate ts = user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(permission);
|
||||
return ts != Tristate.UNDEFINED ? ts.asBoolean() : Permission.DEFAULT_PERMISSION.getValue(isOp());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NonNull Permission permission) {
|
||||
Tristate ts = user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(permission.getName());
|
||||
if (ts != Tristate.UNDEFINED) {
|
||||
return ts.asBoolean();
|
||||
}
|
||||
|
||||
if (!plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_DEFAULT_PERMISSIONS)) {
|
||||
return Permission.DEFAULT_PERMISSION.getValue(isOp());
|
||||
} else {
|
||||
return permission.getDefault().getValue(isOp());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the players subscriptions asynchronously
|
||||
*/
|
||||
public void updateSubscriptionsAsync() {
|
||||
if (!active.get()) {
|
||||
return;
|
||||
@@ -94,49 +159,62 @@ public class LPPermissible extends PermissibleBase {
|
||||
plugin.doAsync(this::updateSubscriptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the players subscriptions
|
||||
*/
|
||||
public void updateSubscriptions() {
|
||||
if (!active.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
UserCache cache = user.getUserData();
|
||||
if (cache == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// calculate their "active" permissions
|
||||
Set<String> ent = new HashSet<>(cache.getPermissionData(calculateContexts()).getImmutableBacking().keySet());
|
||||
|
||||
if (parent.isOp()) {
|
||||
ent.addAll(plugin.getDefaultsProvider().getOpDefaults().keySet());
|
||||
} else {
|
||||
ent.addAll(plugin.getDefaultsProvider().getNonOpDefaults().keySet());
|
||||
// include defaults, if enabled.
|
||||
if (plugin.getConfiguration().get(ConfigKeys.APPLY_BUKKIT_DEFAULT_PERMISSIONS)) {
|
||||
if (parent.isOp()) {
|
||||
ent.addAll(plugin.getDefaultsProvider().getOpDefaults().keySet());
|
||||
} else {
|
||||
ent.addAll(plugin.getDefaultsProvider().getNonOpDefaults().keySet());
|
||||
}
|
||||
}
|
||||
|
||||
subscriptions.subscribe(ent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribes from all permissions asynchronously
|
||||
*/
|
||||
public void unsubscribeFromAllAsync() {
|
||||
plugin.doAsync(this::unsubscribeFromAll);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribes from all permissions
|
||||
*/
|
||||
public void unsubscribeFromAll() {
|
||||
subscriptions.subscribe(Collections.emptySet());
|
||||
}
|
||||
|
||||
public void addAttachments(List<PermissionAttachment> attachments) {
|
||||
/**
|
||||
* Adds attachments to this permissible.
|
||||
*
|
||||
* @param attachments the attachments to add
|
||||
*/
|
||||
public void addAttachments(Collection<PermissionAttachment> attachments) {
|
||||
this.attachments.addAll(attachments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains a {@link Contexts} instance for the player.
|
||||
* Values are determined using the plugins ContextManager.
|
||||
*
|
||||
* @return the calculated contexts for the player.
|
||||
*/
|
||||
public Contexts calculateContexts() {
|
||||
return new Contexts(
|
||||
plugin.getContextManager().getApplicableContext(parent),
|
||||
plugin.getConfiguration().get(ConfigKeys.INCLUDING_GLOBAL_PERMS),
|
||||
plugin.getConfiguration().get(ConfigKeys.INCLUDING_GLOBAL_WORLD_PERMS),
|
||||
true,
|
||||
plugin.getConfiguration().get(ConfigKeys.APPLYING_GLOBAL_GROUPS),
|
||||
plugin.getConfiguration().get(ConfigKeys.APPLYING_GLOBAL_WORLD_GROUPS),
|
||||
parent.isOp()
|
||||
);
|
||||
return plugin.getContextManager().getApplicableContexts(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,36 +222,6 @@ public class LPPermissible extends PermissibleBase {
|
||||
parent.setOp(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(@NonNull String name) {
|
||||
return user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(name) != Tristate.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(@NonNull Permission perm) {
|
||||
return isPermissionSet(perm.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NonNull String name) {
|
||||
Tristate ts = user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(name);
|
||||
if (ts != Tristate.UNDEFINED) {
|
||||
return ts.asBoolean();
|
||||
}
|
||||
|
||||
return Permission.DEFAULT_PERMISSION.getValue(isOp());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NonNull Permission perm) {
|
||||
Tristate ts = user.getUserData().getPermissionData(calculateContexts()).getPermissionValue(perm.getName());
|
||||
if (ts != Tristate.UNDEFINED) {
|
||||
return ts.asBoolean();
|
||||
}
|
||||
|
||||
return perm.getDefault().getValue(isOp());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||
Set<PermissionAttachmentInfo> perms = new HashSet<>();
|
||||
@@ -291,9 +339,6 @@ public class LPPermissible extends PermissibleBase {
|
||||
Bukkit.getServer().getPluginManager().unsubscribeFromPermission(name, parent);
|
||||
}
|
||||
|
||||
// Bukkit.getServer().getPluginManager().unsubscribeFromDefaultPerms(false, parent);
|
||||
// Bukkit.getServer().getPluginManager().unsubscribeFromDefaultPerms(true, parent);
|
||||
|
||||
attachmentPermissions.clear();
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -23,19 +23,22 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.bukkit.calculators;
|
||||
package me.lucko.luckperms.bukkit.processors;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.common.calculators.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.processors.PermissionProcessor;
|
||||
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Permission Processor for permissions set to a player via permission attachments.
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class AttachmentProcessor implements PermissionProcessor {
|
||||
|
||||
+39
-20
@@ -23,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.bukkit.model;
|
||||
package me.lucko.luckperms.bukkit.processors;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -32,52 +32,71 @@ import com.google.common.collect.Maps;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Holds child permissions registered on the platform.
|
||||
*
|
||||
* The data stored in this class is pulled from the data in {@link PluginManager#getPermissions()}.
|
||||
*
|
||||
* The former method is not thread safe, so we populate this class when the server starts to get all of the data
|
||||
* in a form which is easily queryable & thread safe.
|
||||
*
|
||||
* The data is resolved early, so the represented child permissions are a "deep" lookup of permissions.
|
||||
*/
|
||||
public class ChildPermissionProvider {
|
||||
|
||||
// in the format: permission+value ===> children (a map of child permissions)
|
||||
@Getter
|
||||
private ImmutableMap<Map.Entry<String, Boolean>, ImmutableMap<String, Boolean>> permissions = ImmutableMap.of();
|
||||
|
||||
public void setup() {
|
||||
ImmutableMap.Builder<Map.Entry<String, Boolean>, ImmutableMap<String, Boolean>> permissions = ImmutableMap.builder();
|
||||
|
||||
// iterate all permissions registered on the platform & resolve.
|
||||
for (Permission permission : Bukkit.getServer().getPluginManager().getPermissions()) {
|
||||
// handle true
|
||||
Map<String, Boolean> trueChildren = new HashMap<>();
|
||||
resolveChildren(trueChildren, Collections.singletonMap(permission.getName(), true), false);
|
||||
trueChildren.remove(permission.getName(), true);
|
||||
if (!trueChildren.isEmpty()) {
|
||||
permissions.put(Maps.immutableEntry(permission.getName().toLowerCase(), true), ImmutableMap.copyOf(trueChildren));
|
||||
}
|
||||
|
||||
// handle false
|
||||
Map<String, Boolean> falseChildren = new HashMap<>();
|
||||
resolveChildren(falseChildren, Collections.singletonMap(permission.getName(), false), false);
|
||||
falseChildren.remove(permission.getName(), false);
|
||||
if (!falseChildren.isEmpty()) {
|
||||
permissions.put(Maps.immutableEntry(permission.getName().toLowerCase(), false), ImmutableMap.copyOf(falseChildren));
|
||||
}
|
||||
resolve(permissions, permission, true);
|
||||
resolve(permissions, permission, false);
|
||||
}
|
||||
|
||||
this.permissions = permissions.build();
|
||||
}
|
||||
|
||||
private static void resolve(ImmutableMap.Builder<Map.Entry<String, Boolean>, ImmutableMap<String, Boolean>> accumulator, Permission permission, boolean value) {
|
||||
|
||||
// accumulator for the child permissions being looked up
|
||||
Map<String, Boolean> children = new HashMap<>();
|
||||
|
||||
// resolve children for the permission, so pass a map containing just the permission being looked up.
|
||||
resolveChildren(children, Collections.singletonMap(permission.getName(), value), false);
|
||||
|
||||
// remove self
|
||||
children.remove(permission.getName(), value);
|
||||
|
||||
// only register the children if there are any.
|
||||
if (!children.isEmpty()) {
|
||||
accumulator.put(Maps.immutableEntry(permission.getName().toLowerCase(), value), ImmutableMap.copyOf(children));
|
||||
}
|
||||
}
|
||||
|
||||
private static void resolveChildren(Map<String, Boolean> accumulator, Map<String, Boolean> children, boolean invert) {
|
||||
// iterate through the current known children.
|
||||
// the first time this method is called for a given permission, the children map will contain only the permission itself.
|
||||
for (Map.Entry<String, Boolean> e : children.entrySet()) {
|
||||
if (accumulator.containsKey(e.getKey())) {
|
||||
continue; // Prevent infinite loops
|
||||
}
|
||||
|
||||
Permission perm = Bukkit.getServer().getPluginManager().getPermission(e.getKey());
|
||||
// xor the value using the parent (bukkit logic, not mine)
|
||||
boolean value = e.getValue() ^ invert;
|
||||
String lName = e.getKey().toLowerCase();
|
||||
|
||||
accumulator.put(lName, value);
|
||||
accumulator.put(e.getKey().toLowerCase(), value);
|
||||
|
||||
// lookup any deeper children & resolve if present
|
||||
Permission perm = Bukkit.getServer().getPluginManager().getPermission(e.getKey());
|
||||
if (perm != null) {
|
||||
resolveChildren(accumulator, perm.getChildren(), !value);
|
||||
}
|
||||
+5
-3
@@ -23,19 +23,21 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.bukkit.calculators;
|
||||
package me.lucko.luckperms.bukkit.processors;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.bukkit.model.ChildPermissionProvider;
|
||||
import me.lucko.luckperms.common.calculators.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.processors.PermissionProcessor;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Permission Processor for Bukkits "child" permission system.
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class ChildProcessor implements PermissionProcessor {
|
||||
private final ChildPermissionProvider provider;
|
||||
+5
-3
@@ -23,19 +23,21 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.bukkit.calculators;
|
||||
package me.lucko.luckperms.bukkit.processors;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.bukkit.model.DefaultsProvider;
|
||||
import me.lucko.luckperms.common.calculators.PermissionProcessor;
|
||||
import me.lucko.luckperms.common.processors.PermissionProcessor;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.permissions.Permission;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Permission Processor for Bukkits "default" permission system.
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class DefaultsProcessor implements PermissionProcessor {
|
||||
private final boolean isOp;
|
||||
+87
-35
@@ -23,59 +23,61 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.bukkit.model;
|
||||
package me.lucko.luckperms.bukkit.processors;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import me.lucko.luckperms.api.Tristate;
|
||||
import me.lucko.luckperms.bukkit.model.DummyPermissible;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Holds default permissions registered on the platform.
|
||||
*
|
||||
* The data stored in this class is pulled from the data in {@link PluginManager#getDefaultPermissions(boolean)}.
|
||||
*
|
||||
* The former method is not thread safe, so we populate this class when the server starts to get all of the data
|
||||
* in a form which is easily queryable & thread safe.
|
||||
*
|
||||
* The {@link DummyPermissible}s are registered with Bukkit, so we can listen for any
|
||||
* changes to default permissions.
|
||||
*/
|
||||
public class DefaultsProvider {
|
||||
|
||||
// defaults for opped players
|
||||
@Getter
|
||||
private Map<String, Boolean> opDefaults = ImmutableMap.of();
|
||||
private final DummyPermissible opDummy = new DummyPermissible(this::refreshOp);
|
||||
|
||||
|
||||
// defaults for non-opped players
|
||||
@Getter
|
||||
private Map<String, Boolean> nonOpDefaults = ImmutableMap.of();
|
||||
private final DummyPermissible nonOpDummy = new DummyPermissible(this::refreshNonOp);
|
||||
|
||||
/**
|
||||
* Refreshes the data in this provider.
|
||||
*/
|
||||
public void refresh() {
|
||||
refreshOp();
|
||||
refreshNonOp();
|
||||
}
|
||||
|
||||
private void refreshOp() {
|
||||
unregisterDefaults(opDefaults, opDummy);
|
||||
|
||||
Map<String, Boolean> builder = new HashMap<>();
|
||||
calculateDefaults(builder, opDummy, true);
|
||||
|
||||
opDefaults = ImmutableMap.copyOf(builder);
|
||||
}
|
||||
|
||||
private void refreshNonOp() {
|
||||
unregisterDefaults(nonOpDefaults, nonOpDummy);
|
||||
|
||||
Map<String, Boolean> builder = new HashMap<>();
|
||||
calculateDefaults(builder, nonOpDummy, false);
|
||||
|
||||
nonOpDefaults = ImmutableMap.copyOf(builder);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
unregisterDefaults(opDefaults, opDummy);
|
||||
unregisterDefaults(nonOpDefaults, nonOpDummy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries whether a given permission should be granted by default.
|
||||
*
|
||||
* @param permission the permission to query
|
||||
* @param isOp if the player is op
|
||||
* @return a tristate result
|
||||
*/
|
||||
public Tristate hasDefault(String permission, boolean isOp) {
|
||||
Map<String, Boolean> map = isOp ? opDefaults : nonOpDefaults;
|
||||
|
||||
@@ -83,44 +85,94 @@ public class DefaultsProvider {
|
||||
return b == null ? Tristate.UNDEFINED : Tristate.fromBoolean(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of default permissions held by the provider.
|
||||
*
|
||||
* @return the number of permissions held
|
||||
*/
|
||||
public int size() {
|
||||
return opDefaults.size() + nonOpDefaults.size();
|
||||
}
|
||||
|
||||
private static void unregisterDefaults(Map<String, Boolean> map, DummyPermissible p) {
|
||||
/**
|
||||
* Refreshes the op data in this provider.
|
||||
*/
|
||||
private void refreshOp() {
|
||||
unregisterDefaults(opDefaults, opDummy, true);
|
||||
|
||||
Map<String, Boolean> builder = new HashMap<>();
|
||||
calculateDefaults(builder, opDummy, true);
|
||||
|
||||
opDefaults = ImmutableMap.copyOf(builder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes the non op data in this provider.
|
||||
*/
|
||||
private void refreshNonOp() {
|
||||
unregisterDefaults(nonOpDefaults, nonOpDummy, false);
|
||||
|
||||
Map<String, Boolean> builder = new HashMap<>();
|
||||
calculateDefaults(builder, nonOpDummy, false);
|
||||
|
||||
nonOpDefaults = ImmutableMap.copyOf(builder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters the dummy permissibles with Bukkit.
|
||||
*/
|
||||
public void close() {
|
||||
unregisterDefaults(opDefaults, opDummy, true);
|
||||
unregisterDefaults(nonOpDefaults, nonOpDummy, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters defaults for a given permissible.
|
||||
*
|
||||
* @param map the map of current defaults
|
||||
* @param p the permissible
|
||||
*/
|
||||
private static void unregisterDefaults(Map<String, Boolean> map, DummyPermissible p, boolean op) {
|
||||
Set<String> perms = map.keySet();
|
||||
|
||||
for (String name : perms) {
|
||||
Bukkit.getServer().getPluginManager().unsubscribeFromPermission(name, p);
|
||||
}
|
||||
|
||||
Bukkit.getServer().getPluginManager().unsubscribeFromDefaultPerms(false, p);
|
||||
Bukkit.getServer().getPluginManager().unsubscribeFromDefaultPerms(true, p);
|
||||
Bukkit.getServer().getPluginManager().unsubscribeFromDefaultPerms(op, p);
|
||||
}
|
||||
|
||||
private static void calculateDefaults(Map<String, Boolean> map, DummyPermissible p, boolean op) {
|
||||
Set<Permission> defaults = Bukkit.getServer().getPluginManager().getDefaultPermissions(op);
|
||||
Bukkit.getServer().getPluginManager().subscribeToDefaultPerms(op, p);
|
||||
|
||||
Set<Permission> defaults = Bukkit.getServer().getPluginManager().getDefaultPermissions(op);
|
||||
for (Permission perm : defaults) {
|
||||
String name = perm.getName().toLowerCase();
|
||||
|
||||
map.put(name, true);
|
||||
Bukkit.getServer().getPluginManager().subscribeToPermission(name, p);
|
||||
|
||||
// register defaults for any children too
|
||||
calculateChildPermissions(map, p, perm.getChildren(), false);
|
||||
}
|
||||
}
|
||||
|
||||
private static void calculateChildPermissions(Map<String, Boolean> map, DummyPermissible p, Map<String, Boolean> children, boolean invert) {
|
||||
private static void calculateChildPermissions(Map<String, Boolean> accumulator, DummyPermissible p, Map<String, Boolean> children, boolean invert) {
|
||||
for (Map.Entry<String, Boolean> e : children.entrySet()) {
|
||||
Permission perm = Bukkit.getServer().getPluginManager().getPermission(e.getKey());
|
||||
boolean value = e.getValue() ^ invert;
|
||||
String lName = e.getKey().toLowerCase();
|
||||
if (accumulator.containsKey(e.getKey())) {
|
||||
continue; // Prevent infinite loops
|
||||
}
|
||||
|
||||
map.put(lName, value);
|
||||
// xor the value using the parent (bukkit logic, not mine)
|
||||
boolean value = e.getValue() ^ invert;
|
||||
|
||||
accumulator.put(e.getKey().toLowerCase(), value);
|
||||
Bukkit.getServer().getPluginManager().subscribeToPermission(e.getKey(), p);
|
||||
|
||||
// lookup any deeper children & resolve if present
|
||||
Permission perm = Bukkit.getServer().getPluginManager().getPermission(e.getKey());
|
||||
if (perm != null) {
|
||||
calculateChildPermissions(map, p, perm.getChildren(), !value);
|
||||
calculateChildPermissions(accumulator, p, perm.getChildren(), !value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,19 +32,35 @@ import me.lucko.luckperms.api.Contexts;
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.caching.MetaData;
|
||||
import me.lucko.luckperms.common.caching.MetaAccumulator;
|
||||
import me.lucko.luckperms.common.core.NodeFactory;
|
||||
import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.core.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.utils.ExtractedContexts;
|
||||
import me.lucko.luckperms.common.contexts.ExtractedContexts;
|
||||
import me.lucko.luckperms.common.model.Group;
|
||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.common.node.NodeFactory;
|
||||
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* LuckPerms Vault Chat implementation
|
||||
* All user lookups are cached.
|
||||
* An implementation of the Vault {@link Chat} API using LuckPerms.
|
||||
*
|
||||
* Methods which change the state of data objects are likely to return immediately.
|
||||
*
|
||||
* LuckPerms is a multithreaded permissions plugin, and some actions require considerable
|
||||
* time to execute. (database queries, re-population of caches, etc) In these cases, the
|
||||
* methods will return immediately and the change will be executed asynchronously.
|
||||
*
|
||||
* Users of the Vault API expect these methods to be "main thread friendly", so unfortunately,
|
||||
* we have to favour so called "performance" for consistency. The Vault API really wasn't designed
|
||||
* with database backed permission plugins in mind. :(
|
||||
*
|
||||
* The methods which query offline players will explicitly FAIL if the corresponding player is not online.
|
||||
* We cannot risk blocking the main thread to load in their data. Again, this is due to crap Vault
|
||||
* design. There is nothing I can do about it.
|
||||
*/
|
||||
public class VaultChatHook extends Chat {
|
||||
private final VaultPermissionHook perms;
|
||||
@@ -61,37 +77,209 @@ public class VaultChatHook extends Chat {
|
||||
public boolean isEnabled() {
|
||||
return perms.isEnabled();
|
||||
}
|
||||
|
||||
private User getUser(String username) {
|
||||
Player player = Bukkit.getPlayerExact(username);
|
||||
return player == null ? null : perms.getPlugin().getUserManager().getIfLoaded(perms.getPlugin().getUuidCache().getUUID(player.getUniqueId()));
|
||||
}
|
||||
|
||||
private void setMeta(PermissionHolder holder, String world, String node, String value) {
|
||||
String finalWorld = perms.isIgnoreWorld() ? null : world;
|
||||
if (holder == null || node.equals("")) return;
|
||||
@Override
|
||||
public String getPlayerPrefix(String world, @NonNull String player) {
|
||||
final User user = getUser(player);
|
||||
return getUserChatMeta(user, ChatMetaType.PREFIX, world);
|
||||
}
|
||||
|
||||
perms.log("Setting meta: '" + node + "' for " + holder.getObjectName() + " on world " + world + ", server " + perms.getServer());
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, @NonNull String player, @NonNull String prefix) {
|
||||
final User user = getUser(player);
|
||||
setChatMeta(user, ChatMetaType.PREFIX, prefix, world);
|
||||
}
|
||||
|
||||
perms.getScheduler().execute(() -> {
|
||||
holder.removeIf(n -> n.isMeta() && n.getMeta().getKey().equals(node));
|
||||
@Override
|
||||
public String getPlayerSuffix(String world, @NonNull String player) {
|
||||
final User user = getUser(player);
|
||||
return getUserChatMeta(user, ChatMetaType.SUFFIX, world);
|
||||
}
|
||||
|
||||
Node.Builder metaNode = NodeFactory.makeMetaNode(node, value).setValue(true);
|
||||
if (!perms.getServer().equalsIgnoreCase("global")) {
|
||||
metaNode.setServer(perms.getServer());
|
||||
}
|
||||
if (finalWorld != null && !finalWorld.equals("") && !finalWorld.equals("global")) {
|
||||
metaNode.setWorld(finalWorld);
|
||||
}
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, @NonNull String player, @NonNull String suffix) {
|
||||
final User user = getUser(player);
|
||||
setChatMeta(user, ChatMetaType.SUFFIX, suffix, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupPrefix(String world, @NonNull String group) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
return getGroupChatMeta(g, ChatMetaType.PREFIX, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupPrefix(String world, @NonNull String group, @NonNull String prefix) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setChatMeta(g, ChatMetaType.PREFIX, prefix, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupSuffix(String world, @NonNull String group) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
return getGroupChatMeta(g, ChatMetaType.SUFFIX, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupSuffix(String world, @NonNull String group, @NonNull String suffix) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setChatMeta(g, ChatMetaType.SUFFIX, suffix, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, @NonNull String player, @NonNull String node, int defaultValue) {
|
||||
final User user = getUser(player);
|
||||
try {
|
||||
return Integer.parseInt(getUserMeta(user, node, world, String.valueOf(defaultValue)));
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, @NonNull String player, @NonNull String node, int value) {
|
||||
final User user = getUser(player);
|
||||
setMeta(user, node, String.valueOf(value), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, @NonNull String group, @NonNull String node, int defaultValue) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
try {
|
||||
return Integer.parseInt(getGroupMeta(g, node, world, String.valueOf(defaultValue)));
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoInteger(String world, @NonNull String group, @NonNull String node, int value) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setMeta(g, node, String.valueOf(value), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, @NonNull String player, @NonNull String node, double defaultValue) {
|
||||
final User user = getUser(player);
|
||||
try {
|
||||
return Double.parseDouble(getUserMeta(user, node, world, String.valueOf(defaultValue)));
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, @NonNull String player, @NonNull String node, double value) {
|
||||
final User user = getUser(player);
|
||||
setMeta(user, node, String.valueOf(value), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, @NonNull String group, @NonNull String node, double defaultValue) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
try {
|
||||
return Double.parseDouble(getGroupMeta(g, node, world, String.valueOf(defaultValue)));
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoDouble(String world, @NonNull String group, @NonNull String node, double value) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setMeta(g, node, String.valueOf(value), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, @NonNull String player, @NonNull String node, boolean defaultValue) {
|
||||
final User user = getUser(player);
|
||||
String s = getUserMeta(user, node, world, String.valueOf(defaultValue));
|
||||
if (!s.equalsIgnoreCase("true") && !s.equalsIgnoreCase("false")) {
|
||||
return defaultValue;
|
||||
}
|
||||
return Boolean.parseBoolean(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, @NonNull String player, @NonNull String node, boolean value) {
|
||||
final User user = getUser(player);
|
||||
setMeta(user, node, String.valueOf(value), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, @NonNull String group, @NonNull String node, boolean defaultValue) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
String s = getGroupMeta(g, node, world, String.valueOf(defaultValue));
|
||||
if (!s.equalsIgnoreCase("true") && !s.equalsIgnoreCase("false")) {
|
||||
return defaultValue;
|
||||
}
|
||||
return Boolean.parseBoolean(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, @NonNull String group, @NonNull String node, boolean value) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setMeta(g, node, String.valueOf(value), world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, @NonNull String player, @NonNull String node, String defaultValue) {
|
||||
final User user = getUser(player);
|
||||
return getUserMeta(user, node, world, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, @NonNull String player, @NonNull String node, String value) {
|
||||
final User user = getUser(player);
|
||||
setMeta(user, node, value, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupInfoString(String world, @NonNull String group, @NonNull String node, String defaultValue) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
return getGroupMeta(g, node, world, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoString(String world, @NonNull String group, @NonNull String node, String value) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setMeta(g, node, value, world);
|
||||
}
|
||||
|
||||
private void setMeta(PermissionHolder holder, String key, String value, String world) {
|
||||
if (holder == null || key.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String finalWorld = perms.correctWorld(world);
|
||||
perms.log("Setting meta: '" + key + "' for " + holder.getObjectName() + " on world " + world + ", server " + perms.getServer());
|
||||
|
||||
perms.getExecutor().execute(() -> {
|
||||
holder.removeIf(n -> n.isMeta() && n.getMeta().getKey().equals(key));
|
||||
|
||||
Node.Builder metaNode = NodeFactory.makeMetaNode(key, value).setValue(true);
|
||||
metaNode.setServer(perms.getServer());
|
||||
metaNode.setWorld(finalWorld);
|
||||
|
||||
holder.setPermission(metaNode.build());
|
||||
perms.save(holder);
|
||||
perms.holderSave(holder);
|
||||
});
|
||||
}
|
||||
|
||||
private void setChatMeta(ChatMetaType type, PermissionHolder holder, String value, String world) {
|
||||
String finalWorld = perms.isIgnoreWorld() ? null : world;
|
||||
if (holder == null) return;
|
||||
if (value.equals("")) return;
|
||||
private void setChatMeta(PermissionHolder holder, ChatMetaType type, String value, String world) {
|
||||
if (holder == null || value.equals("")) {
|
||||
return;
|
||||
}
|
||||
|
||||
String finalWorld = perms.correctWorld(world);
|
||||
perms.log("Setting " + type.name().toLowerCase() + " for " + holder.getObjectName() + " on world " + world + ", server " + perms.getServer());
|
||||
|
||||
perms.getScheduler().execute(() -> {
|
||||
perms.getExecutor().execute(() -> {
|
||||
// remove all prefixes/suffixes directly set on the user/group
|
||||
holder.removeIf(type::matches);
|
||||
|
||||
@@ -101,32 +289,32 @@ public class VaultChatHook extends Chat {
|
||||
.mapToInt(e -> e).max().orElse(0) + 10;
|
||||
|
||||
Node.Builder chatMetaNode = NodeFactory.makeChatMetaNode(type, priority, value);
|
||||
if (!perms.getServer().equalsIgnoreCase("global")) {
|
||||
chatMetaNode.setServer(perms.getServer());
|
||||
}
|
||||
if (finalWorld != null && !finalWorld.equals("") && !finalWorld.equals("global")) {
|
||||
chatMetaNode.setWorld(finalWorld);
|
||||
}
|
||||
chatMetaNode.setServer(perms.getServer());
|
||||
chatMetaNode.setWorld(finalWorld);
|
||||
|
||||
holder.setPermission(chatMetaNode.build());
|
||||
perms.save(holder);
|
||||
perms.holderSave(holder);
|
||||
});
|
||||
}
|
||||
|
||||
private String getUserMeta(User user, String world, String node, String defaultValue) {
|
||||
if (user == null) return defaultValue;
|
||||
world = perms.isIgnoreWorld() ? null : world;
|
||||
private String getUserMeta(User user, String node, String world, String defaultValue) {
|
||||
if (user == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
world = perms.correctWorld(world);
|
||||
perms.log("Getting meta: '" + node + "' for user " + user.getFriendlyName() + " on world " + world + ", server " + perms.getServer());
|
||||
|
||||
String ret = user.getUserData().getMetaData(perms.createContextForWorldLookup(perms.getPlugin().getPlayer(user), world)).getMeta().get(node);
|
||||
return ret != null ? ret : defaultValue;
|
||||
}
|
||||
|
||||
private String getUserChatMeta(ChatMetaType type, User user, String world) {
|
||||
if (user == null) return "";
|
||||
world = perms.isIgnoreWorld() ? null : world;
|
||||
private String getUserChatMeta(User user, ChatMetaType type, String world) {
|
||||
if (user == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
world = perms.correctWorld(world);
|
||||
perms.log("Getting " + type.name().toLowerCase() + " for user " + user.getFriendlyName() + " on world " + world + ", server " + perms.getServer());
|
||||
|
||||
MetaData data = user.getUserData().getMetaData(perms.createContextForWorldLookup(perms.getPlugin().getPlayer(user), world));
|
||||
@@ -134,13 +322,15 @@ public class VaultChatHook extends Chat {
|
||||
return ret != null ? ret : "";
|
||||
}
|
||||
|
||||
private String getGroupMeta(Group group, String world, String node, String defaultValue) {
|
||||
world = perms.isIgnoreWorld() ? null : world;
|
||||
if (group == null || node.equals("")) return defaultValue;
|
||||
private String getGroupMeta(Group group, String node, String world, String defaultValue) {
|
||||
if (group == null || node.equals("")) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
world = perms.correctWorld(world);
|
||||
perms.log("Getting meta: '" + node + "' for group " + group.getName() + " on world " + world + ", server " + perms.getServer());
|
||||
|
||||
for (Node n : group.mergePermissionsToList()) {
|
||||
for (Node n : group.getOwnNodes()) {
|
||||
if (!n.getValue()) continue;
|
||||
if (!n.isMeta()) continue;
|
||||
if (!n.shouldApplyWithContext(perms.createContextForWorldLookup(world).getContexts())) continue;
|
||||
@@ -154,10 +344,12 @@ public class VaultChatHook extends Chat {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
private String getGroupChatMeta(ChatMetaType type, Group group, String world) {
|
||||
world = perms.isIgnoreWorld() ? null : world;
|
||||
if (group == null) return "";
|
||||
private String getGroupChatMeta(Group group, ChatMetaType type, String world) {
|
||||
if (group == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
world = perms.correctWorld(world);
|
||||
perms.log("Getting " + type.name().toLowerCase() + " for group " + group + " on world " + world + ", server " + perms.getServer());
|
||||
|
||||
int priority = Integer.MIN_VALUE;
|
||||
@@ -179,172 +371,4 @@ public class VaultChatHook extends Chat {
|
||||
return meta != null ? meta : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerPrefix(String world, @NonNull String player) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
return getUserChatMeta(ChatMetaType.PREFIX, user, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, @NonNull String player, @NonNull String prefix) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
setChatMeta(ChatMetaType.PREFIX, user, prefix, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerSuffix(String world, @NonNull String player) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
return getUserChatMeta(ChatMetaType.SUFFIX, user, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, @NonNull String player, @NonNull String suffix) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
setChatMeta(ChatMetaType.SUFFIX, user, suffix, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupPrefix(String world, @NonNull String group) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
return getGroupChatMeta(ChatMetaType.PREFIX, g, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupPrefix(String world, @NonNull String group, @NonNull String prefix) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setChatMeta(ChatMetaType.PREFIX, g, prefix, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupSuffix(String world, @NonNull String group) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
return getGroupChatMeta(ChatMetaType.SUFFIX, g, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupSuffix(String world, @NonNull String group, @NonNull String suffix) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setChatMeta(ChatMetaType.SUFFIX, g, suffix, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, @NonNull String player, @NonNull String node, int defaultValue) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
try {
|
||||
return Integer.parseInt(getUserMeta(user, world, node, String.valueOf(defaultValue)));
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, @NonNull String player, @NonNull String node, int value) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
setMeta(user, world, node, String.valueOf(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, @NonNull String group, @NonNull String node, int defaultValue) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
try {
|
||||
return Integer.parseInt(getGroupMeta(g, world, node, String.valueOf(defaultValue)));
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoInteger(String world, @NonNull String group, @NonNull String node, int value) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setMeta(g, world, node, String.valueOf(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, @NonNull String player, @NonNull String node, double defaultValue) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
try {
|
||||
return Double.parseDouble(getUserMeta(user, world, node, String.valueOf(defaultValue)));
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, @NonNull String player, @NonNull String node, double value) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
setMeta(user, world, node, String.valueOf(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, @NonNull String group, @NonNull String node, double defaultValue) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
try {
|
||||
return Double.parseDouble(getGroupMeta(g, world, node, String.valueOf(defaultValue)));
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoDouble(String world, @NonNull String group, @NonNull String node, double value) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setMeta(g, world, node, String.valueOf(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, @NonNull String player, @NonNull String node, boolean defaultValue) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
String s = getUserMeta(user, world, node, String.valueOf(defaultValue));
|
||||
if (!s.equalsIgnoreCase("true") && !s.equalsIgnoreCase("false")) {
|
||||
return defaultValue;
|
||||
}
|
||||
return Boolean.parseBoolean(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, @NonNull String player, @NonNull String node, boolean value) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
setMeta(user, world, node, String.valueOf(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, @NonNull String group, @NonNull String node, boolean defaultValue) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
String s = getGroupMeta(g, world, node, String.valueOf(defaultValue));
|
||||
if (!s.equalsIgnoreCase("true") && !s.equalsIgnoreCase("false")) {
|
||||
return defaultValue;
|
||||
}
|
||||
return Boolean.parseBoolean(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, @NonNull String group, @NonNull String node, boolean value) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setMeta(g, world, node, String.valueOf(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, @NonNull String player, @NonNull String node, String defaultValue) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
return getUserMeta(user, world, node, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, @NonNull String player, @NonNull String node, String value) {
|
||||
final User user = perms.getPlugin().getUserManager().getByUsername(player);
|
||||
setMeta(user, world, node, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupInfoString(String world, @NonNull String group, @NonNull String node, String defaultValue) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
return getGroupMeta(g, world, node, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoString(String world, @NonNull String group, @NonNull String node, String value) {
|
||||
final Group g = perms.getPlugin().getGroupManager().getIfLoaded(group);
|
||||
setMeta(g, world, node, value);
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 415 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user