Compare commits

...
1583 Commits
Author SHA1 Message Date
Luck 3bf2fab2e9 Release API 5.1 2020-05-10 14:02:57 +01:00
Luck 73d76d860e Move PlayerAdapter to platform package 2020-05-10 13:51:30 +01:00
Luck bcfcb64931 Add modifyUser and modifyGroup convenience API methods 2020-05-10 12:40:20 +01:00
Luck a19cb71394 Add PermissionHolder#getQueryOptions API method 2020-05-10 12:22:40 +01:00
Luck 52731fe68e Add getInheritedGroups and getNodes filtered by type methods to the API (#1926) 2020-05-10 01:19:43 +01:00
Luck 7845d89f10 Add some convenience API methods (#1926) 2020-05-09 23:41:28 +01:00
Luck 3d358e57ff Fix group listmembers command behaviour with the default group (#2088) 2020-05-09 19:16:17 +01:00
Luck bd9ae9dbd5 Cleanup command manager aliases handling 2020-05-09 19:04:50 +01:00
Luck f281927578 Re-add group/g --> parent alias (#2054) 2020-05-09 18:40:15 +01:00
Luck 665c53093a Tweak HikariCP config to hopefully improve recovery from database downtime (#2223, #2084) 2020-05-09 18:19:49 +01:00
Luck 10fbc24f43 Add option for Sponge style wildcards on other platforms (#1625) 2020-05-09 17:48:29 +01:00
Luck 6631e9144e Put Nullable annotations in the right place 2020-05-09 17:32:52 +01:00
Luck 7ae532f082 Add UserManager/GroupManager searchAll method 2020-05-09 17:27:17 +01:00
Luck 1af55e3720 Rename InheritanceHandler --> InheritanceGraphFactory 2020-05-07 03:48:09 +01:00
Luck fe32aa2d33 Download dependencies in parallel 2020-05-06 02:50:19 +01:00
Luck f6460c2802 Fix Year 2038 problem for future installs (#2126) 2020-05-06 00:13:19 +01:00
Luck 045c10048d RedisMessenger support for SSL (#2263) 2020-05-05 17:38:24 +01:00
Luck 308356de80 Refactor group name parsing in commands 2020-05-05 17:24:44 +01:00
Luck 8771d4c5e5 Detect incompatible BungeeCord versions 2020-05-03 00:23:58 +01:00
Luck cd25681cd3 Remove special message for error 403
it was a firewall config error at my end after all lol woops
2020-04-28 21:40:52 +01:00
Luck ad6a11819d Ignore null entries in Permission#children map on Bukkit/Nukkit (#2235) 2020-04-28 13:54:23 +01:00
Luck b17da055af Increase UserHousekeeper cleanup interval & print debug message when unloading 2020-04-28 13:47:13 +01:00
Luck 2fd896508b Attempt to fix issue with user instances being unloaded for online players on Bungee (#2238, #2225, #2107 & more) 2020-04-28 13:46:17 +01:00
Luck 99348fce53 Reply with more descriptive message when http requests fail 2020-04-28 13:29:09 +01:00
Luck eb0d758efc Fix Bukkit command map access (#2229) 2020-04-28 12:57:40 +01:00
Luck c03aca35d6 Add checkTime property to verbose data (#2226) 2020-04-26 10:50:10 +01:00
Tobi f484e87828 Add other options to meta formatting config comment (#2222, #2090) 2020-04-24 19:57:50 +01:00
Luck 07b2df7c7e Cleanup configuration files slightly 2020-04-23 13:05:39 +01:00
Luck cab15d39c3 Make the injected LP permSubs replacement value maps thread safe 2020-04-21 20:06:52 +01:00
Luck 36335c10a4 Cleanup imports 2020-04-17 17:49:32 +01:00
Luck 642d14d003 Allow leading '/' in LP commands executed from the console
https://github.com/Turbotailz/LuckPermsWeb/issues/34
2020-04-17 17:46:48 +01:00
Luck 175808e251 Attempt to fix some PowerfulPerms migration issues (#2168) 2020-04-16 15:13:41 +01:00
Luck 14d952a212 Code style 2020-04-16 15:09:01 +01:00
Luck 37e09caac5 Slightly optimize SimpleMetaValueSelector by only invoking the selection strategy if there is a selection to be made 2020-04-16 14:50:44 +01:00
Luck 4d7a6cb658 Add meta-value-selection config setting (#2167) 2020-04-16 14:44:38 +01:00
Luck cc80fe5105 Cleanup ConfigKeys class a bit 2020-04-09 12:00:32 +01:00
Luck b79f6b0fdd Build against SpongeAPI 7.2 2020-04-09 11:47:10 +01:00
Luck 83e9ac04b2 Optimize VerboseHandler by delaying construction of stack trace array until later 2020-04-07 17:56:56 +01:00
Luck 8cecfe5b7c Avoid calls to the Bukkit singleton 2020-04-07 17:50:08 +01:00
Luck 54aed80db8 Fix applying track reordering from the webeditor (#2144) 2020-04-06 11:55:49 +01:00
Luck 0d89fc9d28 Revert "Trial using the default Java hostname verifier instead of okhttp's (#2134)"
This reverts commit cee34d0c31.
2020-04-05 17:49:20 +01:00
Luck cee34d0c31 Trial using the default Java hostname verifier instead of okhttp's (#2134) 2020-04-05 17:41:32 +01:00
Luck d2e60eb5ac Attempt to fix issue converting MongoDB document _id to UUID (#2110) 2020-04-05 16:42:09 +01:00
Luck c71742a996 Use slightly less spammy logging when user data isn't loaded in Bungee permission check handling 2020-04-05 16:25:33 +01:00
Luck fe139f8420 Replace 'none' option with 'auto' in messaging service config description 2020-04-05 16:04:38 +01:00
caramat bb015d0c88 Fix the link to Storage types wiki page in config files (#2135) 2020-04-05 16:03:19 +01:00
Luck 94809c2a66 Defer legacy component handling on 1.7 servers to Kyori lib 2020-04-05 15:48:07 +01:00
Luck 141d3e26ea Update dependencies 2020-04-04 22:47:43 +01:00
Luck efb958ba44 Move Bungee connection event registerIntent call to after possible method return 2020-04-04 12:04:22 +01:00
Luck 9f0fe9e0cb Use a dynamically generated class instead of a reflection Proxy in NonClosableConnection 2020-03-31 14:29:09 +01:00
Luck 2028d65579 Rename some classes 2020-03-31 13:38:28 +01:00
Luck c98c60b120 Fix IllegalStateException when constructing a MetaCache for CalculatedSubjects (#2123) 2020-03-30 22:57:08 +01:00
Luck 6805574553 Use a MethodHandle to call event class constructors 2020-03-30 19:46:30 +01:00
Luck c3128dec0d Generate actual classes for LP events at runtime instead of using proxies + InvocationHandlers 2020-03-30 19:19:27 +01:00
Luck b65639cd76 Ignore empty string world names in Bukkit WorldCalculator (#2119) 2020-03-30 14:32:27 +01:00
Luck 42e9f43443 Store result of primary group calculation in CachedMetaData 2020-03-30 14:13:17 +01:00
Luck c40ad63291 Slightly refactor AbstractConfigurateStorage#appendNode 2020-03-28 10:22:04 +00:00
Luck 0964762217 Avoid call to PermissionUser.initialize in PEX migration (#2102) 2020-03-26 23:09:09 +00:00
Luck 3553a0f9fe Don't attempt to migrate empty users in PEX migration (#2102) 2020-03-26 22:32:53 +00:00
Luck 24304a61a7 Work around issue accessing PEX async in migration (#2102) 2020-03-26 17:18:00 +00:00
Luck 497846e5a6 Run some auto code inspections 2020-03-26 17:01:55 +00:00
Luck 0729be0f0a Print IOException when uploading web editor data fails (#2087) 2020-03-24 10:44:31 +00:00
Luck 2adea2d3dc Improve reliability of java version check in ReflectionClassLoader (#2093) 2020-03-24 10:35:13 +00:00
Luck 30d7768299 Fix parsing contexts from commands with server/world = global (#2093) 2020-03-24 10:03:34 +00:00
Luck 3a7fadb843 Perform uninject tasks synchronously on Bukkit player quit (#2080) 2020-03-24 09:43:32 +00:00
Luck 779bbb9f88 Fix typo
https://github.com/lucko/LuckPerms/commit/3973aa1000f40aca181225961aea9a65852169a9#r37923265
2020-03-19 16:24:14 +00:00
Luck a721cc0b7c Remove unused DefaultQueryOptions class 2020-03-19 12:57:52 +00:00
Luck 3973aa1000 Add notice to inform users to ignore 'illegal reflective access' warning messages (#952) 2020-03-19 12:14:17 +00:00
Luck ac9fe74785 Catch subclasses of Throwable when trying to create a FileWatcher (#2066) 2020-03-19 11:30:19 +00:00
Luck 46c9e3b713 Clarify method name in QuotedStringTokenizer 2020-03-19 11:06:41 +00:00
Luck 05b82cdbab Slightly optimize Permissible#getEffectivePermissions 2020-03-19 11:04:52 +00:00
Luck 3086724e92 Don't print InterruptedExceptions in AbstractFileWatcher (#2044) 2020-03-14 21:26:13 +00:00
Luck fbac03e372 Remove MinimalApiProvider & refactor usages away from static access 2020-03-13 18:13:12 +00:00
Luck 2518a7c8e5 Fix NPE in QueryOptionsImpl (#2051, #2052) 2020-03-11 11:38:38 +00:00
Luck bbec0932fd Fix typo 2020-03-10 23:55:47 +00:00
Luck bca766c20d Ensure immutability of QueryOptions options map 2020-03-04 12:45:13 +00:00
Luck bb3afa21a4 Always store node metadata keys in a HashMap, not IdentityHashMap, and ensure immutability when built 2020-03-04 12:44:47 +00:00
Luck 85451a9a20 Remove legacy import functionality
Users wishing to import data from the old export formats will need to downgrade LuckPerms to a version before this commit, import their data, and then upgrade again.
2020-03-03 11:20:32 +00:00
Luck d475ace76c Export users & tracks in a consistent order 2020-03-03 11:03:30 +00:00
Luck 9f3395f256 Fix StringIndexOutOfBoundsException with empty string in QuotedStringTokenizer (#2041) 2020-03-02 22:52:08 +00:00
Luck c6bda0875c Change argument tokenizer to support unicode double quote characters (#1999) 2020-03-02 15:28:32 +00:00
Luck 4f63a00bad Update FUNDING.yml 2020-03-01 10:23:40 +00:00
Luck 0a3141841c Rename variable for silent flag 2020-02-27 13:20:14 +00:00
Luck 6fea194ef5 Don't attempt to refresh auto op if server is stopping (#1989) 2020-02-27 13:19:53 +00:00
Luck e66ab1be0d Properly close file watcher on disable
https://github.com/lucko/LuckPerms/commit/5ce8217cd53a6540e0e9bd74a996538b55555059#r37466536
2020-02-24 23:45:30 +00:00
Luck 5ce8217cd5 Refactor file watcher 2020-02-24 18:26:52 +00:00
povsisterandLuck 2ed45c92a6 Enhance default config (#2005, #2006)
Co-authored-by: Luck <git@lucko.me>
2020-02-21 20:08:58 +00:00
Luck 9f7d431d34 Accept empty contexts.json file as valid 2020-02-11 15:35:16 +00:00
Luck d937c9ce06 Update commodore to 1.7 2020-02-10 00:45:47 +00:00
Luck 6a96d40da4 Tiny cleanup to #expiry method in NodeBuilder 2020-02-10 00:27:29 +00:00
Luck 2eabe845d7 Update commodore to 1.6 (#1939) 2020-02-09 15:44:52 +00:00
Luck 4cfee76202 Change layout of library storage 2020-02-09 15:24:04 +00:00
Luck 446fa48d9a Optimize LuckPermsPermissionMap putAll implementation 2020-02-05 20:59:10 +00:00
Luck 9546987970 Fix AbstractUserManager to only load users once in #loadAllUsers 2020-02-03 00:44:08 +00:00
Luck 7a624fb449 Add additional call to invalidate cached data during a sync task 2020-02-03 00:30:18 +00:00
Luck 26de6cf86f Refactor CraftBukkitImplementation utility 2020-01-25 16:43:53 +00:00
Luck 5fe7302965 Simplify vault hasPerm check for users 2020-01-25 16:43:31 +00:00
Luck a779b31ca5 Refactor SQL storage implementation 2020-01-25 16:02:37 +00:00
Luck 8fa629a243 Fix/catch IllegalArgumentException when estimating potential world contexts (#1951) 2020-01-25 12:59:41 +00:00
Luck 0864cf756c Cancel delayed/repeating tasks at the start of the disable process (#1935) 2020-01-25 12:38:24 +00:00
Luck e9d72df890 Check for an empty buffer in async tab complete handler (#1949) 2020-01-25 12:25:00 +00:00
Luck c39a44c3ac Add reminder to remove other plugin jar after migration (#1923) 2020-01-25 12:17:23 +00:00
Luck 7e8402b542 Fix compile errors 2020-01-17 10:05:19 +00:00
Luck a050a2604f Fix error extracting command label in AsyncTabComplete handler 2020-01-16 17:55:03 +00:00
Luck abad672bef Implement support for Vanilla command target selectors (e.g. @p, @r) for Bukkit & Sponge 2020-01-16 17:49:28 +00:00
Luck fe3d715f09 Implement Paper's AsyncTabCompleteEvent 2020-01-16 17:20:54 +00:00
Luck e151fbe298 Build against 1.15 APIs 2020-01-16 16:05:19 +00:00
Luck 2ccb475aa0 Cleanup command abstraction classes 2020-01-15 23:54:43 +00:00
Luck 4c83d439af Refactor Vault provider world rewriting 2020-01-14 15:18:45 +00:00
Luck 352f3bd263 Ensure response body is closed when a http request is not successful (#1912) 2020-01-10 12:50:40 +00:00
Luck b73b73e221 Add rewrite rule in legacy importer for for switchprimarygroup command (#1922) 2020-01-09 23:18:05 +00:00
Luck c454d17826 Refactor Vault Chat #setMeta impl 2020-01-07 15:07:21 +00:00
Luck 098f8d8231 Fix NPE when trying to set (chat)meta with a null would through Vault (#1920) 2020-01-07 14:24:04 +00:00
Luck c1e3660551 Update commodore to 1.5 2020-01-04 23:26:53 +00:00
Luck 3ceb53aa4f Improve n/bukkit SenderFactory getPermissionValue impls 2020-01-04 22:00:53 +00:00
Luck a33f326cfc Fix duration parser handling of weeks, months & years (#1905) 2019-12-31 18:04:03 +00:00
Luck 83883aa7e6 Replace internal brigadier command structure with Commodore's file format 2019-12-29 22:01:38 +00:00
Luck 3fae4e5e9e Refactor CacheMetadata 2019-12-29 18:34:55 +00:00
Luck 4e9b11f30a Only apply DefaultsProcessor for users 2019-12-29 18:01:13 +00:00
Luck 46dc4e5104 Cleanup verbose logging for groups 2019-12-29 17:54:11 +00:00
Luck 9c8bdb1166 Fix support for setting vault npc op status 2019-12-29 17:53:39 +00:00
Luck 242993763c Remove vault-debug option
This is now covered pretty much entirely by verbose data.
2019-12-29 17:37:08 +00:00
Luck b84518e1f1 Lots of misc cleanup 2019-12-29 16:26:05 +00:00
Luck b2593d409e Invalidate all user/group caches after node changes are made to groups via the API 2019-12-29 01:17:30 +00:00
Luck d3b3a8af38 Some small cleanup changes 2019-12-29 00:55:41 +00:00
Luck ec2cb5007c Move op handling into a permission processor 2019-12-28 23:41:02 +00:00
Luck ca33cee79d Fix DateTimeFormatter usage in VerboseListener 2019-12-27 23:30:33 +00:00
Luck 2d456bd346 Iterators class refactoring 2019-12-27 23:17:18 +00:00
Luck 10680668db Fix NPEs caused by RepeatingTask initialisation race condition 2019-12-26 20:25:14 +00:00
Luck 0e64b61be4 Improve DurationParser regex 2019-12-25 00:04:39 +00:00
Luck 96c53091d0 Make use of Instant / Duration classes where possible for time handling 2019-12-24 23:10:26 +00:00
Luck 6e64f80c81 Cleanup temporary handing in PermissionHolder#setNode 2019-12-24 18:11:58 +00:00
Luck 8906e4c4fc Fix PermissionHolder#setNode with accumulate temporary modifier (#1839) 2019-12-24 17:54:35 +00:00
Luck cc5d7ea873 Don't randomly add 1 second to parsed dates 2019-12-24 17:49:27 +00:00
Luck 6237d58ad6 Fix license header checks violation 2019-12-24 17:16:40 +00:00
Luck fae5ebe226 Prefer "storage provider" to "dao" in logging messages for consistency with rest of code base 2019-12-24 14:08:23 +00:00
Luck 9a92920120 Downgrade h2 version to 1.4.199
Fixes https://gist.github.com/lucko/2ba1a9eb52fd76da19e54888c2595381

See: h2database/h2database#2078
2019-12-24 14:00:48 +00:00
Luck dc5c6b0138 Set character set to utf8 for messenger table (#1887) 2019-12-24 13:46:19 +00:00
Luck 88c432496b Reimplement "legacy" shorthand syntax
i.e. using ( ) for groups, and | for list separation
2019-12-24 13:24:20 +00:00
Luck 63b890d522 Rename EventFactory --> EventDispatcher 2019-12-24 13:05:48 +00:00
Luck cd5c8d7cdf NodeEqualityPredicate refactoring 2019-12-21 19:58:37 -05:00
Luck d80017ba7b Refactor /lp import command, better handling when no file extension is provided 2019-12-21 17:46:37 -05:00
Luck 5eb8a262be Set giveDefault to true when running the 'clear' command 2019-12-14 17:22:48 +00:00
Luck 7474842b45 Cleanup the way contexts for transient permissions are determined 2019-12-14 17:06:26 +00:00
Luck 9093385de3 Fix NPE in Permissible#recalculatePermissions 2019-12-13 14:30:37 +00:00
Luck bd349ac4a3 Use standard (not Identity) HashMaps for OptionKeys and NodeMetadataKeys 2019-12-13 14:02:31 +00:00
Luck 37367fe91f Invalidate QueryOptions cache when op status changes 2019-12-13 13:56:34 +00:00
Luck dce792083b Fix some issues with null world contexts in migration scripts 2019-12-13 11:51:42 +00:00
Luck 06f7900318 Use thee default set of flags by default in QueryOptions.Builder, etc 2019-12-13 11:28:46 +00:00
electron d8ac199858 Additional SQL query escaping fixes (#1847, #1854) 2019-12-05 21:46:00 +00:00
Luck 9cf21e2927 Include loaded extensions in the info command (#1849) 2019-12-05 21:44:45 +00:00
electron 86a15b9a66 Escape table name with backticks (`) in sql messenger (#1847, #1848) 2019-12-04 20:50:56 +00:00
electron 31b57df567 Fix json action serialization (#1843, #1844) 2019-12-04 11:18:37 +00:00
Luck a07f876c85 Re-implement parsing first/second context values as server/world respectively (#1837) 2019-12-02 21:23:58 +00:00
Luck 2eb0c1e67e Use getPlainDisplayName to get name for hover messages (#1663) 2019-12-02 21:03:45 +00:00
Luck 6325e25630 Limit the number of scheduler work threads 2019-12-02 15:10:18 +00:00
Luck 6fdd349654 Fix (un)setting nodes through Vault with null worlds (#1826) 2019-11-29 12:16:24 +00:00
Luck 01e17adf82 Cleanup imports 2019-11-25 22:52:37 +00:00
Luck acdd5f3faa Don't attempt to load permissions data for login events cancelled at the lowest priority
Makes LuckPerms more compatible with "anti-bot" plugins.
2019-11-25 22:51:11 +00:00
Luck 4d3c692402 Fix concurrency bug in CachedDataManager MRU cache
This resolves a longstanding issue with TownyPerms (#1330)
2019-11-25 20:31:14 +00:00
Luck 787f691f44 Improve shorthand parser 2019-11-25 00:34:23 +00:00
OmegaWeapon_ 500385cd3e Add temporary modifier to the argument list for permission/parent settemp (#1817) 2019-11-24 16:27:36 +00:00
Luck 6df64a29dc Don't set username to null when a user is requested by uuid alone 2019-11-24 00:40:38 +00:00
Luck 233324f6c9 NodeMap optimizations 2019-11-24 00:40:38 +00:00
Andre_601 da253c47da Update badges for new API coordinates (#1816) 2019-11-24 00:38:22 +00:00
Luck 8725ace739 LuckPerms v5 2019-11-23 18:21:32 +00:00
Andre_601 0d9106185c Add note about checking console to storage errors (#1678) 2019-11-23 18:19:19 +00:00
Luck 7449f6f9af Update patreon link 2019-11-23 18:18:25 +00:00
Luck 2316b6806e Cleanup in StackTracePrinter 2019-11-23 17:43:56 +00:00
Luck 94418d3648 Log thread in verbose events 2019-11-23 17:26:48 +00:00
Luck 479b2d026c Remove sql schema migrations 2019-11-23 14:15:30 +00:00
Luck 8e9683b33f Fix compile 2019-11-23 14:10:17 +00:00
Luck 6481bac045 Fix license violations 2019-11-23 13:21:11 +00:00
Luck 86aadf2cf8 A few more small API changes 2019-11-23 12:59:40 +00:00
Luck 95d2832884 A few more small API changes 2019-11-23 12:52:26 +00:00
Luck 213b2fcb44 Downgrade okhttp & okio 2019-11-19 18:09:14 +00:00
Luck c4bd657826 Changes to messaging service setup 2019-11-19 15:18:47 +00:00
Luck a5e15b8a29 More work 2019-11-18 21:19:59 +00:00
Luck 7a37fcd792 Implement a simple compiler (lexer + parser) for verbose filters
Removes the dependency on the Nashorn runtime.
2019-11-14 22:58:29 +00:00
Luck 81cbe02a9c Move some things around a bit 2019-11-14 19:43:57 +00:00
Luck 79c10c986e Web editor changes 2019-11-12 12:12:53 +00:00
Luck c836cce59b Moreeee stuff 2019-11-09 22:50:10 +00:00
Luck 287c0f7f7a All the cleanup 2019-11-09 22:34:12 +00:00
Luck dc52807a46 Fix issues with *-combined file storage methods (#1793) 2019-11-04 19:26:53 +00:00
Luck 916e3dbb0b Revert bad text refactoring, bump version to 3.0.2 2019-10-15 13:58:20 +01:00
Luck 4b0574710e Implement new compressed json import/export format
The old "command list" style is now only supported for import.
2019-10-14 17:25:37 +01:00
Luck 7764a04d46 More work 2019-10-13 15:04:03 +01:00
Luck 9438df787a Changes to option keys 2019-10-12 00:27:53 +01:00
Luck fd954d8293 More work 2019-10-06 21:34:24 +01:00
Luck 72dec16f54 Context parsing changes 2019-09-21 08:30:14 +01:00
Luck 40218563e1 Cut down on the number of command aliases 2019-09-04 22:34:25 +01:00
Luck 0251f2add9 Cleanup some stuff 2019-09-04 22:29:36 +01:00
Luck f0e42c6db6 Allow context calculators to define "potential contexts", and use these for tab completions 2019-09-04 22:08:24 +01:00
Luck 4b793d1f14 More work 2019-09-04 20:58:46 +01:00
Luck 61e5da928a Fix various runtime errors 2019-08-29 22:07:12 +01:00
Luck 419707aa5f Cleanup web clients 2019-08-26 20:37:33 +01:00
Luck 8b970c21fc Remove default assignments
For real this time
2019-08-26 19:33:43 +01:00
Luck 7a31edea09 Extensions 2019-08-26 19:31:55 +01:00
Luck b286faa1c5 Change API package to net.luckperms 2019-08-26 18:06:45 +01:00
Luck 5e2f45ebd0 Web editor changes, towards #1703 2019-08-26 15:03:30 +01:00
Luck eff93c788b Log action serialization changes 2019-08-26 14:04:49 +01:00
Luck 4667ffc681 Allow data query order to be specified via the API 2019-08-26 14:04:49 +01:00
Luck bafada4f17 Context & action log changes 2019-08-26 14:04:50 +01:00
Luck 5b97d01363 Permission holder refactoring 2019-08-26 14:02:39 +01:00
Luck 3474c66c1c Big API refactor
- removed a bunch of ugly / badly designed methods and APIs
- refactored 'Contexts' --> 'QueryOptions'
- Removed the FullySatisfiedContexts hack and replaced it with a sane API
- Made PermissionHolder (in the API) less ugly and horrible
- removed lots of deprecated / duplicated API functionality
and much more...
2019-08-26 14:02:44 +01:00
Luck 8f8c916be3 API: remove storage interface 2019-08-04 11:27:31 +01:00
Luck a823290d66 API: remove uuid cache 2019-08-04 11:27:27 +01:00
Luck 5577e3f590 Jedis requires SLF4J (#1579) 2019-07-14 09:11:54 +01:00
Luck ffe6c24b53 Properly remove "minecraft:" prefixed brigadier aliases 2019-06-03 20:15:29 +01:00
Luck 4e4982a98d Create FUNDING.yml 2019-05-27 10:40:12 +01:00
Luck 7f4f9bb917 Fix build 2019-05-20 23:09:02 +01:00
Luck 8d8024ba5e Fix group changes via the API not properly invalidating caches (#1534) 2019-05-20 10:42:48 +01:00
Luck 2e16b15b0e Change Sender#getNameWithLocation behaviour 2019-05-14 20:32:35 +01:00
Luck 1ebed37297 Remove use-server-properties-name option
This was removed from Minecraft 1.14, and isn't something I feel was ever really necessary to support.
2019-05-11 23:17:59 +01:00
Luck ff37ad176b Update text adapters to latest version (#1525) 2019-05-11 23:12:55 +01:00
Luck d0c5d89e91 Update to expect Velocity shading text 3
This reverts the reflection workaround implemented in f49446011a
2019-05-07 13:59:44 +01:00
Luck f49446011a Update to text 3 2019-05-07 00:23:40 +01:00
Luck d762a0aaa6 Reduce new instance creation further in TristateResult.Factory 2019-04-28 15:35:46 +01:00
Luck 2dc211a91e Don't account for wildcard/default permissions when running require-sender-group-membership-to-modify checks (#1512) 2019-04-24 18:40:27 +01:00
Luck 2c62de9658 Refactor storage type config read 2019-04-23 21:57:43 +01:00
Luck 494ab6787f Update okhttp 2019-04-23 20:45:02 +01:00
Luck b81e8a40a4 Refactor VaultHookManager 2019-04-22 10:27:29 +01:00
Luck 2fd2f4fedb Ignore exception if Brigadier is not supported by the server (#1506)
This error occurs when another plugin/the server shades the brigadier library without relocation on pre 1.13 MC versions.
2019-04-22 09:24:05 +01:00
Luck 493e5d08be Finish refactoring 2019-04-22 09:15:46 +01:00
Chinese Marc 62a834e145 Fix build (#1509) 2019-04-21 21:49:13 +01:00
Luck 241f13c8f1 Package renames 2019-04-20 18:10:31 +01:00
Luck 98ea255667 Refactor blank message sending 2019-04-19 09:46:45 +01:00
Luck 420ec2bf1a Don't attempt to read a boolean 'value' from parent/chatmeta/meta entries in file based storage files (#1505) 2019-04-18 23:14:23 +01:00
Luck 364a494ac6 Fix making changes to group subjects via the Sponge API (#1495) 2019-04-18 22:57:53 +01:00
Luck 821d1cb8dd Fallback to utf8 encoding if utf8mb4 isn't supported (#1497) 2019-04-17 18:44:34 +01:00
Luck 544ffbad19 Add missing javadocs to ConfigKeys 2019-04-06 18:22:19 +01:00
Luck 4fa6cd2577 Add configuration option to perform a post-traversal sort according to the inheritance (weight) rules 2019-04-06 18:20:30 +01:00
Luck 37d1f5efab Improve behaviour of userInGroup and userHasPermission Vault calls 2019-04-03 10:12:24 +01:00
Luck 7cd8e8bf5b Fix NPE in Vault contextForLookup method
Fixes CodeCrafter47/BungeeTabListPlus#415
2019-04-03 10:01:18 +01:00
Luck 8eed4558f4 Release API v4.4 2019-04-02 16:36:22 +01:00
Luck 62ca2d9c79 Implement special handling in the LP Vault implementation for NPC players (#1470) 2019-04-01 15:09:58 +01:00
Luck c7a0d7026c Update API build script 2019-04-01 14:00:46 +01:00
Luck ce74813ce5 Fallback to node/context ordering in InheritanceComparator, refactor graph traverser classes 2019-03-14 15:23:26 +00:00
Luck d1511e43f2 Fix build 2019-03-10 19:19:46 +00:00
Luck 6ef749c76a Update some dependencies 2019-03-08 23:11:32 +00:00
Luck 8846932cb6 Refactor the HolderType enum 2019-03-08 20:19:08 +00:00
Luck 12b861db3f Update PermissionHolderSubjectData#save code 2019-03-08 19:56:07 +00:00
Luck 0a50df6557 Code style: move private constructors for singleton classes to the top of the file 2019-03-05 12:36:09 +00:00
Luck 3726f6de41 Use a separate fork join pool for cache loading operations 2019-03-05 12:35:29 +00:00
Luck d1ca7684d6 Refactor AbstractJavaScheduler to make use of a cached thread pool 2019-03-05 12:32:16 +00:00
Luck 512b621a7a Refactor Dependency class a bit 2019-03-03 16:46:20 +00:00
Luck 2cf919a17a Bump hikari version 2019-03-03 12:01:15 +00:00
Luck 46072eb465 Attempt to detect and warn about CraftBukkit + offline mode problems (#1439) 2019-02-21 14:14:00 +00:00
Luck ae63a42c2e Slightly optimize regex and wildcard processors 2019-02-21 12:37:23 +00:00
Luck 8773ec07ab Include processor & cause in verbose hover message 2019-02-19 23:30:11 +00:00
Luck 287cc308d6 Fix parsing log entry types (#1438) 2019-02-19 14:17:33 +00:00
Luck beeb4fa169 Fix DuplicateRemovalFunction javadocs 2019-02-19 14:09:26 +00:00
Luck 4ef3d50965 Properly implement ContextManager#unregisterCalculator (#1422) 2019-02-09 11:50:00 +00:00
Luck dae64fc8c4 Cleanup some of the Sponge permission holder implementation code 2019-02-07 15:35:09 +00:00
Luck 215031a1f3 Close messaging service before storage
Fixes https://www.spigotmc.org/threads/174259/page-129#post-3302827
2019-02-07 12:38:24 +00:00
Luck 85d2f0b51f Add method to unregister context calculators (#1422) 2019-02-07 12:24:23 +00:00
Luck d91355e4d6 Remove some unused code 2019-02-04 20:35:39 +00:00
Luck 1a690dabd7 Implement NodeMap without using Guava's Multimap util (#1416) 2019-02-04 20:35:20 +00:00
Luck 526448ce40 Don't try to set unicode connection properties for PostgreSQL (#1134) 2019-02-04 19:36:53 +00:00
Luck 43d04a97f5 Correctly implement Bukkit/Nukkit isPermissionSet method, inline with the behaviour in PermissibleBase (#1403) 2019-01-31 01:14:38 +00:00
Luck 307614e704 Cleanup import statements 2019-01-31 00:53:42 +00:00
Luck f6c0794691 Return more detailed information about exactly how a permission check result was determined 2019-01-31 00:45:56 +00:00
Luck 83db00aef8 Better null checking in HikariConnectionFactory (#1408) 2019-01-30 16:24:30 +00:00
untuned 22252fa46d Update MIT license text to allow GitHub detection (#1400) 2019-01-28 10:46:05 +00:00
Luck 7b8426977a Switch text dependency back to 1.11 (#1404) 2019-01-28 10:39:08 +00:00
Luck d9912cb93f Update some dependencies 2019-01-27 22:51:05 +00:00
Luck 5db999f995 Only form data buf once in Bukkit PluginMessage messenger 2019-01-23 12:12:33 +00:00
Luck b744e35ad8 Fix typo in Vault exception message 2019-01-18 23:21:23 +00:00
Andre_601 b6769811a2 Fix some small typos (#1389) 2019-01-18 09:47:03 +00:00
Luck 1d9fc568e4 Fix calling default methods on Event interfaces (#1386) 2019-01-16 14:43:55 +00:00
Luck 3c0d1ba7a1 Ensure caches are invalidated when Bukkit/Nukkit's Permission#getChildren map is modified (#1378) 2019-01-13 16:58:31 +00:00
Luck 78a74510cf Fix Sponge and Velocity build scripts 2019-01-12 13:39:07 +00:00
Luck d3ae3324fa Allow the bytebin url to be configured 2019-01-12 12:02:16 +00:00
Luck 4b97c9419e Finish updating commodore
woops
2019-01-07 21:29:28 +00:00
Luck db830a0bef Buildscript changes 2019-01-07 21:25:11 +00:00
Luck 797c195424 unInject -> uninject 2019-01-07 20:45:47 +00:00
Luck 4788290615 Rename Vault implementation classes 2019-01-07 20:44:52 +00:00
Luck d0c016f6b7 Cleanup with way permissibles are monitored on Bukkit/Nukkit
- The removal of the call to recalculatePermissions should fix CMEs on startup, in particular with Vault.
- Monitored permissibles are now uninjected when the plugin disables.
2019-01-07 20:21:36 +00:00
Luck 9b1c73ed23 Implement use of a Maven Central mirror for dependency downloads
People keep telling me that LP's use of Maven Central for downloading dependencies is not allowed / inappropriate / abusive. I disagree but I'm bored of hearing it. Using a mirror will mean that all of the load is taken off of Central, and is instead absorbed by my servers + (mostly) Cloudflare.

- The mirror is (currently) hosted at https://nexus.lucko.me/repository/maven-central/
- The prospect of the mirror becoming compromised is not a concern. LuckPerms compares the downloaded content against a checksum before saving it.
- The prospect of the mirror going offline is also not a concern. We will fallback to Maven Central if a connection cannot be made to the mirror.
2019-01-07 16:56:16 +00:00
Luck 048768007d Change the way static contexts are displayed in /lp info 2019-01-07 15:44:54 +00:00
Luck ec7a5321a6 Some misc refactoring / code cleanup 2019-01-07 15:08:13 +00:00
Luck c396323308 Log exceptions thrown by BufferedRequest tasks 2019-01-05 23:06:57 +00:00
Luck 6fc2321fad Refactor PlayerLoginProcessEvent
This is technically a breaking change, but I'm fairly sure I'm the only person using this event. It's quite obscure ;p
2019-01-02 13:54:55 +00:00
Luck a0d04790a5 Update text-adapter-bungeecord to 1.0.2 (#1362) 2019-01-01 15:33:18 +00:00
Luck c4154c09da Remove SQL indexes on the permission field 2018-12-23 21:56:51 +00:00
Luck 8eed3131f2 Fix sending component messages on older CB/S releases (#1344) 2018-12-23 16:52:00 +00:00
Luck e5c4b710f6 Fix CME in Bukkit refreshAutoOp
cc @Exloki
2018-12-22 17:04:32 +00:00
Luck 2ccffc6e6d Fix error message when event handlers throw an exception 2018-12-22 17:03:51 +00:00
Luck fc69002c86 Fix wrong checksum for text-adapter-bukkit 2018-12-19 14:36:20 +00:00
Luck e3a6db5f97 Refactor ProgressLogger slightly 2018-12-19 10:39:48 +00:00
Luck 6d8077ffd0 Use text-adapter-bukkit for sending Components to Bukkit objects 2018-12-19 10:29:22 +00:00
Luck 784161d66d Update okhttp and okio versions 2018-12-19 10:06:36 +00:00
Jonathan Frederick 115f793733 Make gradlew script executable by default (#1338) 2018-12-19 09:24:44 +00:00
Luck 2cb5e437fd Switch default MySQL/MariaDB charset from utf8 to utf8mb4
https://medium.com/@adamhooper/in-mysql-never-use-utf8-use-utf8mb4-11761243e434
Relates to #1337
2018-12-18 16:02:25 +00:00
Luck 8c57c2b46d Remove static imports 2018-12-18 12:51:26 +00:00
Luck 879a88a398 Account for 'allow-invalid-usernames' setting in API calls 2018-12-18 12:50:52 +00:00
Luck 7e50c3c777 Update Gradle to 5.0 2018-12-15 22:24:17 +00:00
Luck 4b1cf51530 replace LoadingCache with more simple LoadingMap alternative when no auto expiry is needed 2018-12-14 18:37:56 +00:00
Luck de24817d9c Some node equality changes 2018-12-14 17:27:34 +00:00
Luck 085e7af681 Small cleanup in Contexts class 2018-12-10 15:33:57 +00:00
Luck 1aabd7610e Tweak PlayerSaveResult javadoc 2018-12-10 15:33:38 +00:00
Luck ef31db1431 Improve /op and /deop command matching 2018-12-10 15:33:04 +00:00
Luck 757e9d6be6 Add API method to get known permissions & improve the way PermissionDescriptions are migrated from existing Sponge services when LP enables 2018-12-07 14:07:54 +00:00
Luck b3a028e3ca Refactor AbstractConnectionListener for the addition of Velocity support 2018-12-07 13:36:38 +00:00
Luck e222e4e98c Missing nullability annotations 2018-12-07 13:33:05 +00:00
Luck 1213e58240 Depend on a specific Velocity snapshot version
Fixes #1319
Fixes VelocityPowered/Velocity#159
2018-12-06 14:04:31 +00:00
Luck b7ff0824b9 Optimize context set manipulation 2018-12-06 14:02:41 +00:00
Luck 7b5917660c Implement LoadingMap using Guava's ForwardingMap utility 2018-11-28 12:35:38 +00:00
Luck 1544487e92 Convert permissions to lowercase inside the cache
Slight optimization, toLowerCase is a relatively expensive call in the scheme of permission checks.
2018-11-24 13:09:26 +00:00
Luck c19ef84116 Optimize ImmutableContextSet#equals by comparing the hashcodes (constant time lookup) 2018-11-24 01:25:02 +00:00
Luck e8c4a55dc3 Cache the most recent lookup for permission/meta data in AbstractCachedData.
This avoids a (somewhat) costly lookup operation involving Contexts comparison. It aims to be effective on the basis that lookup calls within the same period of time are likely to target the same context (and therefore have the same result).
2018-11-24 01:17:42 +00:00
Luck 97d6aaed5c Experiment with different cache implementation in PermissionCalculator
Caffeine seems to just fallback to a ConcurrentHashMap based implementation in this case anyway.
2018-11-24 00:15:56 +00:00
Luck fe77834cef Optimize LookupSetting storage/manipulation within Contexts
Fixes some performance issues resulting from bad use / implementation of ImmutableEnumSets
2018-11-23 23:58:49 +00:00
Luck 2da6298c53 Update references to the project website 2018-11-22 15:25:39 +00:00
Luck e111270aed Add api-version option to Bukkit plugin.yml file
This doesn't make any functional change, LP doesn't use any of the remapped Material APIs. It only saves on the amount of remapping CB tries to perform when loading the plugin.
2018-11-22 15:19:12 +00:00
Luck e07f8c0fbe Don't send 1.13 tab completions to players without access to any LP commands (#1310) 2018-11-22 15:07:55 +00:00
Luck 90246afd03 Some misc refactoring 2018-11-22 14:51:20 +00:00
Luck 9809e591ad Reorganise some packages 2018-11-10 23:16:28 +00:00
Luck 26973461e7 Don't show negated group membership permissions in the output to 'user info' and 'group listmembers' 2018-11-10 22:42:54 +00:00
Luck 759ec5d499 Attempt to parse uuid from username string in Vault hook 2018-11-10 20:23:40 +00:00
Luck 58ab3c325c misc tidying up 2018-11-10 20:21:08 +00:00
Luck 44c8c67803 Update README.md 2018-11-06 16:36:34 +00:00
Luck acb56d683a Add missing since tag to MetaStackFactory 2018-11-06 15:42:59 +00:00
Luck 5dda522a62 Add option to deduplicate prefix/suffix stacks (#1285) 2018-11-06 14:29:15 +00:00
Luck 79091c726b Update readme badges 2018-11-06 13:28:05 +00:00
Luck e5be06e07b Use the newly added API method to retrieve Velocity implementation name / version 2018-11-06 13:18:58 +00:00
Luck f63992e209 Return a more informative error for invalid verbose filters 2018-11-06 13:16:07 +00:00
Luck 9988011308 Improve the way meta lookups are caught & reported to the verbose handler 2018-11-06 13:15:30 +00:00
Luck 8584a9b72c Sponge Subject lookup methods without a contexts param should default to current contexts, not global (#1279) 2018-11-02 22:39:02 +00:00
Luck 42c8cb1354 Use the fragment identifier instead of query parameters to convey the editor/verbose/treeview data id
This fixes the issue Multicraft panels have with displaying ? characters in console. (absolute quality)
2018-10-28 22:32:02 +00:00
Luck aaeaf5cfa0 Nicer format for verbose meta logging 2018-10-28 21:56:42 +00:00
Luck 45b4e1463f Match the type in verbose filters 2018-10-28 15:18:02 +00:00
Luck be92a67544 Increase verbose stacktrace truncation length for web outputs 2018-10-28 12:40:56 +00:00
Luck 5e0b8ebdf6 Include meta lookup events in verbose output 2018-10-28 12:31:47 +00:00
Luck 9d4ccd33e1 Update commodore for tab complete fix (#1257) 2018-10-26 20:21:00 +01:00
Luck f5c42c70e5 Catch Throwable instead of Exception when calling context calculators
Related to:  lucko/ExtraContexts#4
2018-10-15 22:32:52 +01:00
Luck dcc4656e5e Update buildscripts for Sponge Ore deployment 2018-10-15 22:30:36 +01:00
MrMicky ee2de3cff1 Some minor code cleanup (#1262) 2018-10-09 18:00:53 +01:00
Luck f96518b8e4 misc tidying 2018-10-07 19:48:20 +01:00
Luck dac59966aa Setup gradle license format check 2018-09-24 13:52:59 +01:00
Luck 8115fbaa98 Refactor storage system 2018-09-23 21:49:49 +01:00
Luck 8b97439ffc Use the correct permission check method when forming tree views 2018-09-23 19:53:37 +01:00
Luck fa83986250 Refactor Constraint/Comparison impls for bulkupdate 2018-09-23 19:53:16 +01:00
Luck e1b16465f8 Fix race condition in BufferedRequest 2018-09-23 19:52:42 +01:00
Luck 57619dacb1 Update commodore to 1.1 2018-09-23 15:40:33 +01:00
Luck 64e54d89eb Refactor buildscript determinePatchVersion function 2018-09-23 15:20:22 +01:00
Luck aa4139f0b7 Release v4.3.0 2018-09-23 15:04:15 +01:00
Luck e2f1c1e16b Remove specific dependency on Sponge API 8 in the mod info file (#1221) 2018-09-23 15:02:02 +01:00
Luck 1e7ef15e54 Fix class cast exception in NodeTypeKey#getTypeName (#1230) 2018-09-23 14:38:27 +01:00
Luck 1cc156d6f6 Fix buildscript deployment config for Sonatype 2018-09-23 14:30:09 +01:00
Imortalshard 1445a3faec Fix typo in the description of /lp export (#1229) 2018-09-23 11:28:48 +01:00
Luck 1cf90692cf fix typo 2018-09-21 21:53:06 +01:00
Luck 5656bea3f9 Update for latest Velocity changes 2018-09-21 21:36:44 +01:00
Luck 8e344cea76 Cleanup imports 2018-09-20 21:17:28 +01:00
Luck 5b1229c882 Fix slf4j loading (#1224) 2018-09-20 21:17:00 +01:00
Luck 834649b390 Improve Uuids#parse
thanks @kashike
2018-09-20 15:30:22 +01:00
Luck d28170cc3f Operations to add new nodes with differing values should just override existing entries, instead of failing with the ALREADY_HAS result (#1198) 2018-09-20 11:25:31 +01:00
Luck 04e511026d Detach from permissible objects with a 1 tick delay after player quit to allow plugins listening on monitor to still access data (#1220) 2018-09-20 11:07:20 +01:00
Luck 11a3ecbba0 Fix NPE when loading subject data on Sponge (#1222) 2018-09-20 10:51:00 +01:00
Luck 51b7bb93e2 Don't trigger Vault primary thread checks whilst the server is starting up 2018-09-20 10:44:04 +01:00
Luck 9fd2028d9f Update for velocity API changes 2018-09-19 21:47:22 +01:00
Luck 75f0f40d70 NonNull annotations should be on the same line in interfaces 2018-09-19 21:12:54 +01:00
Luck 3941c77826 Move from findbugs jsr305 to checker-qual 2018-09-19 20:40:25 +01:00
Luck 4987ca3ba2 Update gradle wrapper and buildscript plugins 2018-09-19 19:41:47 +01:00
Jesse Boyd 5fa481337a Fix Nukkit permissible null handling - fixes #1191 (#1213) 2018-09-12 08:58:55 +01:00
Luck dd78e0e271 Separate formatted vs plain display name methods in User/Group
Continues from 3c773e6823 & #1210
2018-09-10 16:54:16 +01:00
Max Lee 3c773e6823 Use neutral color to display potentially colored names - fixes #1170 (#1210) 2018-09-10 16:41:14 +01:00
Luck 54a9ff9256 Fix compile 2018-09-09 11:31:17 +01:00
Luck eca6b09b18 Refactor config keys 2018-09-05 20:49:37 +01:00
Luck b7f8ca6658 Add 'require-sender-group-membership-to-modify' config option (#1140) 2018-09-05 15:49:29 +01:00
Luck ffdeadac8a Add flag to prevent users from being added/removed to/from the first group on a track (#1151) 2018-09-05 15:15:15 +01:00
Luck 9e769904bf Expose TemporaryMergeBehaviour in the API (#1189) 2018-09-05 11:11:45 +01:00
Luck 8d79ec6b07 Rename "update task" --> "sync task" 2018-09-04 21:11:03 +01:00
Luck 3a123f9fa1 Avoid running full "update tasks" unless they're absolutely needed. Process Vault API "set" requests immediately instead of in the background 2018-09-04 21:02:40 +01:00
Luck f0c0328919 Refactor MetaAccumulator to be a little more sane 2018-09-04 20:33:22 +01:00
Luck 274286032a Update banner in readme 2018-09-03 13:56:49 +01:00
Luck 76517374a2 Only allow import and export commands to interact with files in the data directory (#1193) 2018-09-02 22:20:29 +01:00
Luck 2da027f3b5 Revert MySQL driver update 2018-09-02 20:04:26 +01:00
Luck fd712f131f Update some dependency versions 2018-09-02 16:36:28 +01:00
Luck 38613e5f03 Update gitignore 2018-08-31 20:27:13 +01:00
Luck ec9060ba80 Update messenger log prefixes 2018-08-31 20:22:31 +01:00
Luck 502d57e744 Optimize event generation & other misc improvements 2018-08-27 22:11:03 +01:00
Luck c59f2ab37a Don't call NodeAddEvent when adding the default group (#1177) 2018-08-27 22:06:49 +01:00
Luck 066189b486 Send a more informative message when the bulkupdate command is used from in-game 2018-08-27 18:25:57 +01:00
Luck 37d4f92c33 Update README 2018-08-27 09:37:41 +01:00
Luck 55220e9d10 Add support for Velocity 2018-08-26 22:24:46 +01:00
Luck bd41286076 Fix build 2018-08-26 18:45:33 +01:00
Luck d84484c81c Optimize event generation and posting 2018-08-26 10:28:04 +01:00
Luck fec87d4c6a Update event to 3.0.0 2018-08-16 20:01:26 +01:00
Luck 68ec6e2a37 Include license file in the jar 2018-08-14 10:56:07 +01:00
Luck a784ad435f Fix applying group web editor changes (#1148) 2018-08-13 22:44:10 +01:00
Luck cc9bb34873 Update kyori/event dependency 2018-08-13 20:03:57 +01:00
Luck 2ddae5a96c Avoid UnsupportedEncodingException in LilyPad messenger 2018-08-12 10:40:26 +01:00
Luck 40ad489c56 Update build instructions in the README file 2018-08-12 10:27:21 +01:00
Luck 56c55d71fe Improve the way Vault lookups for offline players are handled (#1150)
1) The behaviour of online player lookups is unchanged - this only affects offline player data lookups.
2) If a 'offline player' request is made from an async task, it is executed normally. (the data is loaded)
3) If a 'offline player' request that cannot be immediately fulfilled is made from the main server thread, an exception is thrown.

The exception thrown as a result of 3) can be disabled in the config. In this case, the query is performed anyway. The main server thread will block until the request is complete.
2018-08-11 19:02:57 +01:00
Luck 56df15caf8 Add bukkit-legacy build back to the main project 2018-08-11 18:11:30 +01:00
Luck 03720665b3 Move to gradle 2018-08-10 20:39:29 +01:00
Luck 445429b510 Update text & asm dependencies (fixes #1142)
Updates for:
https://github.com/KyoriPowered/text/commit/6a7fda4e80c48884ba957ffaadd9219cead7962d
2018-08-10 00:09:34 +01:00
Luck c698587d53 Update text dependency 2018-08-09 22:43:41 +01:00
Luck b8466beee5 Completely rework event system
* Event instances are now generated dynamically at runtime. The performance hit of creating proxies at runtime is negligible in this case.

* A better EventBus implementation is now being used internally, API contracts are unaffected.
2018-08-09 22:39:33 +01:00
Luck efa666445f Initial support for Brigadier (1.13 commands) on Bukkit servers 2018-08-08 23:42:25 +01:00
Luck 59c7d77525 Load a up-to-date copy of group data before applying web editor changes 2018-08-08 09:00:35 +01:00
Luck 553da9baf6 Give some form of feedback when trying to applyedits no changes instead of no feedback at all (#1136) 2018-08-08 08:58:58 +01:00
Luck 486ddb3d42 Don't include any database properties by default (#1134) 2018-08-05 21:59:48 +01:00
Luck 381922fc02 Don't schedule a delayed load task on startup (#1130) 2018-08-05 21:51:53 +01:00
Luck 4c891f0819 Fix uppercase inconsistencies when saving users to SQL storage types (#1119)
This was causing issues when user data was saved, without UUID data being saved beforehand.

This commit fixes the way the inconsistency was introduced, and ensures that inconsistent data is made consistent in the future. (when players next login)
2018-07-30 11:22:50 -07:00
Luck 4b3d11ccab More SQL escaping (#1091 & #1126)
Follows from c16630c32b
2018-07-29 17:14:48 -07:00
Luck b1ab465991 Misc cleanup 2018-07-29 17:12:05 -07:00
Luck 952e41ad3d A few API javadoc improvements 2018-07-27 23:45:16 -07:00
Luck ae3adf23c8 Fail silently when plugins use reflection to add to dummy permissibles (#1117) 2018-07-24 21:21:05 -07:00
Luck c3cdf387c2 Fix NPE in GroupManager migration (#1118) 2018-07-24 21:03:14 -07:00
Luck 054f0c2c19 Don't add spaces when formatting 'concise' durations 2018-07-24 20:59:49 -07:00
Luck 2f7fce2109 Change name of Sql messenger table for compat with changes in the previous commit 2018-07-15 22:49:09 -07:00
Luck 07469599bc Rewrite MessagingService message encoding, conform to new plugin message channel requirements
* This change isn't backwards compatible with previous builds, this version (& onwards) won't be able to "communicate" with old versions, and vice versa.

* MC 1.13 requires plugin message channel names to be namespaced, so 'lpuc' has been changed to 'luckperms:update'

* The channel names for Redis/Lily types have also changed, I've been wanting to change the encoded format to something a bit saner for a while, and this seemed like a good time. Changing the channel names a) keeps things consistent and b) means I don't have to worry about old versions interpreting the new format.
2018-07-15 22:42:37 -07:00
Luck 08869da96e misc cleanup 2018-07-13 17:51:30 -07:00
Luck 7540a6eb70 Send more appropriate message when no users/groups match the editor type (#1096) 2018-07-13 17:51:21 -07:00
Luck fa2d9357b8 Allow FileWatcher locations to be registered after initial start 2018-07-12 17:10:07 -07:00
Luck 247a40b65f Fix /lp search for groups when using separated file storage (#1094) 2018-07-12 16:35:32 -07:00
Luck 01ffe6ad5a Use synchronized wrapper for NodeMap backings 2018-07-12 09:50:10 -07:00
Luck da3c2a073a cleanup build scripts a bit 2018-07-11 13:09:54 -07:00
Luck c16630c32b Escape groups keyword in SQL queries to (hopefully) fix compat with newer versions of MySQL (#1091) 2018-07-11 13:09:20 -07:00
Luck bf64f465a8 Re-implement Bukkit 1.7.10 support 2018-07-01 15:31:28 +01:00
Luck c1e0b874d8 Add helpful message for users on first startup 2018-07-01 15:07:25 +01:00
Luck c780266139 Add setprefix, setsuffix, settempprefix, settempsuffix commands (#840) 2018-06-27 17:31:30 +01:00
Luck 08454d58d0 Refactor the way contexts are cached on all platforms (#1071)
Should fix memory leak issues on BungeeCord
2018-06-27 00:17:53 +01:00
Luck ee13540d78 Specify explicit global context in generated LP commands when default contexts have been set (#1062) 2018-06-26 14:39:18 +01:00
Luck b4ff54ffc8 Apply Sponge implicit wildcards after Bukkit style .* wildcards 2018-06-24 21:44:12 +01:00
Luck 6f96d9c7d1 Fix NPE on Nukkit load (#1059) 2018-06-19 23:40:13 +01:00
Luck 5b66436519 Ensure the backing of LPSubscriptionValueMaps is a WeakHashMap (#1058) 2018-06-19 23:35:19 +01:00
Luck 379eb00b69 Cleanup various message localisations, limit the size of the PermissionRegistry 2018-06-19 22:27:47 +01:00
Luck 2036127612 Cleanup action log formatting and pagination
This is technically a breaking change to the API, but I'm fairly certain hardly anyone is using these methods (the pagination functionality in the API is pretty useless)

Can always add them back if it becomes an issue
2018-06-18 16:08:18 +01:00
Luck 957a918bd6 Fix loading on BungeeCord (#1054) 2018-06-17 09:49:38 +01:00
Luck 6b305972ac Fix sponge build script 2018-06-16 18:41:53 +01:00
Luck b8c06904ab Make logging messages a bit less obnoxious
* Removed the ascii text from the startup output
* Log messages (but not command output) is now sent through the standard server logger, and isn't colored
2018-06-16 16:59:59 +01:00
Luck 6baa472567 Fix context cache invalidation 2018-06-15 19:07:24 +01:00
Luck 9c449def57 Update some dependency versions 2018-06-13 20:29:00 +01:00
Luck e4acc133a9 remove some unnecessary interfaces 2018-06-12 18:18:38 +01:00
Luck 8b181b877b Nukkit stores attachments in a set, not a list (#1046) 2018-06-11 17:07:56 +01:00
Luck 194790110d Fix node comparison for identical nodes except the value 2018-06-07 19:58:55 +01:00
Luck c0cd197bd0 Don't allow players to be added to SubscriptionValueMaps 2018-06-07 17:01:25 +01:00
Luck 30ce269873 Disable hikari leak detection (#1033) 2018-06-05 20:33:23 +01:00
Luck 4d7be13c16 Don't reload Sponge persisted subjects when a save is pending 2018-06-03 20:46:50 +01:00
Luck 8cf0f7da5f Improve buffering code 2018-06-03 19:36:55 +01:00
Luck bcb4e5ca64 cleanup various comparators 2018-05-31 23:41:37 +01:00
Luck 07b003c77a Make the dummy attachment a bit more compatible
still MassiveCore lol
2018-05-31 01:01:29 +01:00
Luck f4e4f727dd More workarounds to support MassiveCore's modification of attachment permissions via reflection 2018-05-31 00:51:33 +01:00
Luck 644c53a074 Add workaround for plugins adding/removing/modifying permission attachments via reflection (#1024)
who knows why they're doing it, it's not even beneficial for performance...
2018-05-30 13:17:41 +01:00
Luck c66622bd09 Fix regex permissions not really working properly (#1021) 2018-05-29 14:45:21 +01:00
Luck adf0589184 Print a more informative error when the port is missing from the address arg (#1022) 2018-05-29 12:40:39 +01:00
Luck b7de0e6901 Provide an even more detailed warning message when other uuids are present for a username
We can use the data we have about the UUID and the platform LP is running on to infer more information about what the problem (potentially) is.
2018-05-25 17:05:26 +01:00
Luck a90e59ec97 Fix cache invalidation when group data changes (#1010) 2018-05-21 18:48:47 +01:00
Luck f4882c1c14 Cache the creation of Sponge proxy subject classes (#1005) 2018-05-17 18:19:45 +01:00
Luck ed3b5a3cf1 Lazily load contexts cache for Sponge subjects (#1005) 2018-05-17 18:12:20 +01:00
Luck 45e2b7b12f Fix saving node attributes on non-YAML file storage types (#999) 2018-05-16 19:30:05 +01:00
Luck 1e73986c60 Allow world rewrite options to apply in (some) Vault lookups (#990) 2018-05-16 19:04:09 +01:00
Luck 20f992110d Refactor meta stack element creation, add 'from_group' & 'not_from_group' elements 2018-05-16 18:46:25 +01:00
Luck 18f09f9862 Various performance optimizations 2018-05-15 00:08:23 +01:00
Luck a0be1c7c48 Fix issue with Bukkit attachment permissions never being removed (#991) 2018-05-13 14:06:23 +01:00
DoNotSpamPls 5d34661a15 Readme fixes (#993) 2018-05-12 16:40:54 +01:00
Luck 1639879106 Reduce the number of config lookups required when calculating contexts 2018-05-12 01:51:38 +01:00
Luck a927ca659f Reduce the throughput on the contexts cache in ContextManager (#929) 2018-05-12 01:34:34 +01:00
Luck 804c884d8b Update configurate to fix issues with legacy guava compat 2018-05-06 19:57:50 +01:00
Luck 51f215b8ac Add PlayerDataSaveEvent 2018-05-06 18:21:14 +01:00
Luck 64838708ab Release version 4.2.0
blaze it
2018-05-06 17:16:36 +01:00
Luck 91b7af52ac Use the servers uuid cache in the output to /lp search if LP doesn't have data (#974) 2018-05-06 16:20:08 +01:00
Luck d3dded8791 Fix jedis shading (#930) 2018-05-06 15:58:40 +01:00
Luck 022b385c0a Fix /lp search query (#972) 2018-05-05 18:39:13 +01:00
Luck 7ee9b93365 Convert bulkupdate & search functionality to use PreparedStatements (#972) 2018-05-05 18:17:48 +01:00
Luck c4c98aaabf Improve the behaviour of the APIs (now somewhat redundant) holder refresh method 2018-05-04 23:17:06 +01:00
Luck 10c0efaa5d Fix bad caching logic resulting in super high CPU usage 2018-05-04 23:12:46 +01:00
Luck d8a7d8de4a Throw a more detailed error when database connection info is missing 2018-05-04 21:27:57 +01:00
Luck ab8b675bae Add flag to exclude users from an export (#961) 2018-05-04 18:19:52 +01:00
Luck 194b602fd6 Implement different comparison methods for /lp search (#917) 2018-05-04 18:11:11 +01:00
Luck 7da0c58b76 Improve consistency of contextual primary group caching 2018-05-04 17:24:40 +01:00
Luck 2dbbea4993 Remove the locks in NodeMap to ease thread contention when lots of processes are resolving inheritance & refactor the way LocalizedNodes are created (#734) 2018-05-04 16:16:12 +01:00
Luck 55d59bb1c4 Make auto-op changes take effect (almost) immediately (#943)
"almost immediately" is better than "after a relog" ;)
2018-05-03 20:21:52 +01:00
Luck a6facf7492 Refactor the way holder caches are invalidated in order to improve consistency (#734) 2018-05-03 19:36:10 +01:00
Luck b8a1871cf1 Fix guava being accidentally shaded 2018-05-03 13:46:17 +01:00
Luck f556c75d94 Allow display names to be set in specific contexts (#963) 2018-05-02 21:27:21 +01:00
Luck 58bd7de66a Implement equals, hashcode and toString for NodeTypes 2018-05-02 20:35:20 +01:00
Luck 4547b52748 Refactor extended node types, general cleanup 2018-05-02 20:18:57 +01:00
Luck b9acb84119 Optimize WildcardProcessor 2018-05-01 00:20:39 +01:00
Luck e3a783c546 Maybe fix problems with symlinks (#956) 2018-04-30 14:44:09 +01:00
Luck 2e136666be Remove storage buffers 2018-04-29 11:33:51 +01:00
Luck 7d089cb5f0 Refactor configurate deo serialization of permission data, add support for the TOML format 2018-04-28 21:26:59 +01:00
Luck 3784d904fb Some small fixes and changes for ContextSet implementations 2018-04-27 18:50:36 +01:00
Luck fef6ebf793 Context set values should be lowercase'd too 2018-04-26 19:51:05 +01:00
Luck 316e177c1d Exclude temporary file changes from FileWatcher (#945) 2018-04-26 18:44:53 +01:00
Luck 4cdff14c7c Apply improvements to the caches in AbstractContextManager (#929) 2018-04-25 21:14:16 +01:00
Luck 97121bc719 Add some missing null check annotations 2018-04-25 21:02:17 +01:00
Luck 1312aac349 Add promote and demote methods to the API (#938) 2018-04-25 19:58:56 +01:00
Bogdan 8a5c9ddef2 Added explicit column names in INSERT queries. (#939) 2018-04-25 18:27:28 +01:00
Luck 55382519a1 Fix sponge split-storage config section being in the wrong section of the config (#928) 2018-04-25 17:30:56 +01:00
Luck cbb562b603 Fix sponge subject storage 2018-04-25 17:30:02 +01:00
Luck ba51f803ba add more logging to the importer 2018-04-25 17:15:30 +01:00
Luck d73543408e Fix misplaced sponge config options 2018-04-23 21:31:04 +01:00
Luck 7d90dba08b Update some dependency versions 2018-04-21 23:26:34 +01:00
Luck f11ebe6166 Replace file logger with json based system 2018-04-21 18:16:35 +01:00
Luck 1b917f0901 Fix init error in SeparatedConfigurateDao (#924 & #925) 2018-04-21 17:03:59 +01:00
Luck 328353d053 Implement the option to combine yaml/json/hocon storage files into one 2018-04-20 21:59:32 +01:00
Luck 4e87489dc1 Output meta in inheritance order in the 'meta info' command (#908) 2018-04-20 15:04:29 +01:00
Luck 8e5bcdd5ea Move schema files to a namespaced package (#899) 2018-04-20 14:59:06 +01:00
Luck 882a29029e Account for Sponge permission defaults in SpongeSenderFactory#getPermissionValue (fixes #920) 2018-04-20 14:17:29 +01:00
Luck 4704c5c975 Add full diff to the log when webeditor data is applied (#922) 2018-04-20 14:06:35 +01:00
Luck 957365ab91 refactor inheritance graphs slightly 2018-04-20 14:00:50 +01:00
Luck f8d34d7f46 Fix compile 2018-04-09 20:58:52 +01:00
Luck cb185e4827 Minor misc changes 2018-04-08 22:58:15 +01:00
Luck f5c6b9e3d4 Add 'permission clear' command (#893) 2018-04-04 18:46:01 +01:00
Luck 96f0f46b3e Update readme 2018-04-04 17:10:33 +01:00
Luck 6a5b7ce3a1 derp 2018-04-04 15:29:45 +01:00
Luck f33c540efb Register Sponge PermDescriptions to the LP permission registry 2018-04-03 21:56:15 +01:00
Luck 7684ac5d3a Add extra parameter to EventBus#subscribe which allows a handler to be bound to a plugin 2018-04-02 17:26:02 +01:00
Luck c13b01da01 misc cleanup 2018-04-02 16:02:55 +01:00
Luck 3453f05aca Copy usernames in the GroupManager migration (#883) 2018-04-02 13:34:30 +01:00
Luck c8bb85a06b Don't intern strings in permission checking process 2018-03-31 22:13:10 +01:00
Luck 2aabc9902f Rename verbose paste to verbose upload 2018-03-31 22:09:58 +01:00
Luck 6dba778e60 Catch exceptions thrown in repeating tasks to avoid subsequent executions from being cancelled 2018-03-31 11:13:27 +01:00
Luck cbeaaca7af Fix shutdown hang (#881) 2018-03-31 11:11:42 +01:00
Luck 0e69c8902d Revert f63d6cf 2018-03-31 10:26:22 +01:00
Luck f63d6cfced Properly escape sql query for loadTrack (#877) 2018-03-30 21:50:03 +01:00
Luck 72f9de6cc7 Fix resolving data directory on Sponge servers with a custom config dir location (#875) 2018-03-30 21:37:33 +01:00
Luck 509e89b9cf Clarify the showtracks output (#862) 2018-03-30 11:58:32 +01:00
Luck 90cce19baf Make the world-rewrite map case insensitive (#863) 2018-03-30 11:54:17 +01:00
Luck e4e93b1af1 Improve the way player uuid data is saved/stored. Add a warning message to catch ip forwarding issues 2018-03-29 21:46:55 +01:00
funniray 8f30176edd Fixed command arguments for Nukkit (#871) 2018-03-27 16:43:49 +01:00
Luck 4923d10b86 Encode editor payload using UTF-8 (#841) 2018-03-18 20:58:33 +00:00
Luck bd3a4e1ad7 Fix Sql messenger table name & bug which meant entries were only received after a 1 min delay 2018-03-18 18:58:53 +00:00
Luck 0f99a6c5ca Fix recursive proxying in PhasedStorage
ugh
2018-03-18 18:31:30 +00:00
Luck 0150da94a8 Apply table prefix to the SQL messenger 2018-03-18 17:38:52 +00:00
Luck b8da286f64 Replace huge forwarding classes with java Proxy instances 2018-03-18 17:36:07 +00:00
Luck da797f154d Implement Messaging Service using SQL (#534) 2018-03-18 16:02:04 +00:00
Luck 926195efc4 Fix Sponge persisted subject parent serialisation 2018-03-18 11:41:13 +00:00
Luck 8c1c5c820c Fix Sponge subject inheritance 2018-03-18 10:41:27 +00:00
Luck f63f652edb Fix parentadd and parentremove sponge commands 2018-03-18 10:09:21 +00:00
Luck 174ef187e8 Rename role parameter in PermissionDescription.Builder#assign 2018-03-18 10:02:16 +00:00
Luck d1e76f401a Reorganise the default configuration 2018-03-17 21:03:50 +00:00
Luck d52983c5af Fix tristate check event on BungeeCord for console senders 2018-03-17 15:03:40 +00:00
Luck 4773934481 Fix race condition in the import process (#833) 2018-03-14 22:01:52 +00:00
Luck dbfc524180 Fix NPE in Message#asString (fixes #822, #823, #824) 2018-03-13 15:30:35 +00:00
Luck 60aa7c6104 Fix compile 2018-03-12 21:27:23 +00:00
Luck 907d716929 Reorganise commands 2018-03-12 21:25:39 +00:00
Luck 1689a8abe2 Fix adding null json values (#818) 2018-03-12 19:01:38 +00:00
Luck 5db3820df4 A few minor API javadoc changes 2018-03-12 18:58:11 +00:00
Luck f969e2e52b Strip color when sending messages to the fallback logger 2018-03-09 16:43:29 +00:00
Luck cde2306079 Compress editor/verbose/treeview data using gzip before uploading 2018-03-09 16:21:45 +00:00
Luck f6c440c172 Further improvements to the Sponge service design 2018-03-08 21:51:25 +00:00
Luck 1b98667365 Fix IsolatedClassLoader on Java 9 (#815) 2018-03-08 18:36:41 +00:00
Luck bf69d5314e Implement Sponge subject lookup queries using CachedData from LP common 2018-03-07 23:50:23 +00:00
Luck 6d2ea659a4 Fix errors relating to sponge plugin parameter being an illegal argument (#810) 2018-03-03 20:43:41 +00:00
Luck 0d89840179 Reduce the number of entries sent to the verbose viewer, cleanup old hikari try..catches 2018-03-03 20:41:46 +00:00
Luck f93e8fdccd Always fire SubjectDataUpdateEvent async 2018-03-03 16:27:43 +00:00
Luck 68e4d36f40 Extract common plugin behaviour into an abstract class 2018-03-03 16:26:37 +00:00
Luck cd5447de38 Submit users/groups to the editor in weight order 2018-03-01 18:26:32 +00:00
Luck 6c0bb61cb1 Remove sponge migration commands 2018-03-01 11:03:22 +00:00
Luck d9a45b1090 Implement SubjectDataUpdateEvent (#753) 2018-03-01 10:58:08 +00:00
Luck 7549b3eb9e Return a dummy value instead of throwing an exception when an offline player is queried via Vault (#806) 2018-03-01 10:08:09 +00:00
Luck 8f82ef7eb4 Add copyFrom method to Node.Builder 2018-03-01 09:19:26 +00:00
Luck fbe84322b5 Cleanup parts of the sponge service implementation 2018-03-01 08:48:39 +00:00
Luck 98fb9946e4 Refactor Contexts class 2018-02-28 19:13:21 +00:00
Luck 984bc5860f Set allow-invalid-usernames to true by default for Nukkit (#798) 2018-02-26 17:35:34 +00:00
Luck a42d27f056 Don't intern strings in ContextSets (#797) 2018-02-26 17:27:28 +00:00
Luck aa4833ed74 Fix NPEs caused in LPPermissionMap (#794) 2018-02-24 22:59:18 +00:00
Luck 6704ac4b46 Fully relocate the jedis driver 2018-02-24 18:20:56 +00:00
Luck 4e4ec8e608 Bump caffeine & hikari version 2018-02-24 14:15:51 +00:00
Luck 4f4a387f04 Run the permissible monitoring injector twice 2018-02-24 14:08:36 +00:00
Luck d0143f9e54 Fix issue with loading on old CraftBukkit versions 2018-02-24 14:04:22 +00:00
Luck b2175e885f Fix compat with older Gson versions (#791) 2018-02-24 13:50:38 +00:00
Luck 68dd96e563 Properly bump version 2018-02-23 22:16:52 +00:00
Luck 168e712324 Update API to 4.1 2018-02-23 22:13:41 +00:00
Luck 2889c28815 Separate prefix/suffix/meta nodes into their own section within yaml/json/hocon storage files 2018-02-23 15:59:12 +00:00
Luck 966bf8bf51 Replace deprecated method usage in NodeTools 2018-02-23 14:20:30 +00:00
Luck 63ff3c34b3 Fix default assignment expressions checking temporary permissions (#783) 2018-02-22 23:38:26 +00:00
Luck 736105cc12 Add node equality predicates, and provide way to determine hasPermission behaviour using them (#782) 2018-02-22 23:34:35 +00:00
Luck b1fa4263ed Fix illegal argument exception when a proxied Sponge calculator adds an empty context (#780) 2018-02-22 22:24:21 +00:00
Luck 31d435dc2b Update web related functionality to point to new locations and APIs (#770) (#784) 2018-02-22 22:09:37 +00:00
Luck da9977a30f Fix compile and some minor formatting errors 2018-02-20 20:15:48 +00:00
Andrew 9c92522564 MongoDB Replica Set connections cannot resolve (#776 & #777) 2018-02-20 19:59:29 +00:00
Luck 31e436868d Nukkit support (#764) 2018-02-18 15:10:35 +00:00
Luck 794455d728 Refactor bulkupdate comparisons 2018-02-16 22:25:19 +00:00
Luck 0adf85746d Abstract out the process of traversing the inheritance tree, add configurable option to choose which algorithm to use (#719) 2018-02-16 17:46:17 +00:00
Luck f1047df98e Log checks made against non Player command senders in LP bungee 2018-02-16 13:41:21 +00:00
Luck 765f9d2545 Remove old schema migration code, cleanup a bit 2018-02-16 13:19:43 +00:00
Luck 0b5588a7dd Cleanup temporary permission auditing process 2018-02-16 12:35:25 +00:00
Luck 4fda89d5c8 Wrap unimportant sql migrations in try..catch (#755) 2018-02-16 12:13:15 +00:00
Luck b8c5c60ece try to fix null proxySelector issue with okhttp 2018-02-15 22:20:11 +00:00
Luck a3730aceeb i'm a dummy 2018-02-15 22:08:42 +00:00
Luck df5240a67c Lazily initialise Http client 2018-02-15 22:03:53 +00:00
Luck 620b0c898c Add ability to edit multiple users/groups in the same editor session 2018-02-12 22:04:39 +00:00
Luck 02ac4bc48b Allow temporary-add-behaviour to be defined as an argument to the add/set commands (#747) 2018-02-10 22:04:53 +00:00
Luck d14310768c Allow bulkupdates without constraints (#746) 2018-02-10 21:51:57 +00:00
Luck 63f8e8849f extract WeightCache out of PermissionHolder 2018-02-10 21:27:02 +00:00
Luck 7e7268bb5a Filter expired entries from user/group bulk permission search results (#736) 2018-02-07 18:03:25 +00:00
Luck 173286d404 Rebuild default and child permission lookup maps live instead of only once when the plugin first enables 2018-02-04 20:50:35 +00:00
Luck fd937e3209 Refactor permission processors, misc cleanup 2018-02-04 18:39:34 +00:00
Luck 31df29194b Add source to UserPromote & UserDemote events (#722) 2018-02-01 21:33:32 +00:00
Luck a1a2e189b6 Refactor PEX primary group detection to exclude temporary parents 2018-02-01 20:31:54 +00:00
Luck 5799a26cb7 Migrate temporary permissions / parents in PEX migration 2018-02-01 20:03:20 +00:00
Luck fe200ca1ec Add API methods to load users/groups/tracks and return a future encapsulating the resultant object instead of a success flag 2018-01-30 15:55:36 +00:00
Luck 7f7116e1c7 Use OkHttp for web requests 2018-01-30 00:08:00 +00:00
Luck 0cc1c4e5a7 fix build, refactor Bukkit model classes 2018-01-28 14:18:53 +00:00
Luck 2bc56de1c3 Don't store API delegate instances for all users 2018-01-28 00:26:58 +00:00
Luck e28d15456c Update some dependencies 2018-01-25 23:31:31 +00:00
Luck 54dbede130 Add /lp debug command 2018-01-24 19:13:29 +00:00
Luck 982254ff5e Reduce the amount of unnecessary data in info command outputs a bit 2018-01-23 19:55:21 +00:00
Luck e1c60fa70f Only query online players when upgrading usernames --> uuids in Vault hooks 2018-01-23 17:07:26 +00:00
Luck 6923c4e247 Log the name of the calculator when an exception is thrown 2018-01-23 16:52:50 +00:00
Luck 0eba5f1cbc Add a means to provide a custom Storage dao implementation (#590) 2018-01-22 23:21:47 +00:00
Luck 4858e59b70 Don't relocate H2 or SQLite depends in favour of loading into isolated classloaders (fixes #704) 2018-01-22 21:32:31 +00:00
Luck 1f70ad978f Cleanup usages of loadUser/loadGroup/loadTrack - eliminate possibility for unloading race condition (#706) 2018-01-22 17:34:15 +00:00
Luck 40294b10f5 ensure that we always use the shaded JDBC driver 2018-01-21 22:20:00 +00:00
Luck 8d045be0b0 misc cleanup 2018-01-21 21:35:25 +00:00
Luck e24a482deb Don't call events for changes to transient nodes 2018-01-21 20:31:48 +00:00
Luck f18d230ff6 Force a clear of transient nodes when a User quits, don't just rely on their instance being unloaded 2018-01-21 20:25:00 +00:00
Luck 72d4e5cf7a Remove the 'use-server-uuids' option and internal UuidCache system
The feature has stuck around since the early days - and solves a problem which really should never occur.
2018-01-21 20:18:13 +00:00
Luck 4c3e28ba85 Only show enduring nodes in command output, encapsulate the Node multimaps in PermissionHolder into separate class 2018-01-21 19:53:20 +00:00
Luck 821dc4ef56 Expose a means to implement the plugin's MessagingService via the API 2018-01-19 23:35:41 +00:00
Luck 612712f015 fix accidentally marking guava as compile in the previous commit 2018-01-19 19:29:34 +00:00
Luck 03a93b1186 Apply dependency remapping using an isolated classloader
* Fixes the issue which prevented LP from loading on Java 9
* Should also fix #697
2018-01-19 19:27:08 +00:00
Luck 04ffd00c0e fix typo in /lp <u/g> editor message 2018-01-19 16:31:15 +00:00
Luck a74475d4cd serialise -> serialize 2018-01-18 19:21:02 +00:00
Luck 05ac7e6041 refactor the way verbose filters are parsed - tokenize on first init as opposed to on each check 2018-01-17 19:30:05 +00:00
Luck 5ae90f2a4b Log verbose checks for the console, commandblocks & entities when running on Bukkit 2018-01-16 19:20:06 +00:00
Luck b800db03fc Nest the 'switchprimarygroup' command under the 'parent' subcommand 2018-01-15 21:09:42 +00:00
Spanner_Man 662b958a7f Update Jenkins URL for the LuckPermsLegacy build (#686) 2018-01-15 20:48:09 +00:00
Luck 7cd5eea6d3 Display tracks relating to the group itself when the showtracks command is performed on a group 2018-01-15 20:39:18 +00:00
Luck ed223f0e4e Don't allow empty context keys/values (#688) 2018-01-15 20:06:20 +00:00
Luck 8a374aed04 add javadocs to Command class 2018-01-15 19:55:21 +00:00
Luck 9ceacdb739 Refactor some Sponge service details 2018-01-15 18:07:27 +00:00
Luck 39daed23c4 fix ~~minor~~ typo 2018-01-13 23:53:44 +00:00
Luck 19e6d4e4c8 Relocate dependency packages to prevent conflicts with other plugins 2018-01-13 23:27:55 +00:00
Luck 22006617d0 misc refactor for PermissionHolder & DummySender 2018-01-12 23:51:59 +00:00
Luck 3201d10bdd Rewrite the way user instances are cleaned up and unloaded - towards #674 2018-01-10 21:28:33 +00:00
Luck ea94bd8696 move bukkit-legacy module to a separate project, cleanup poms 2018-01-08 20:01:02 +00:00
Luck f646c04d09 Remove lombok from the project 2018-01-07 18:40:23 +00:00
Luck 17ff9ac328 Allow shorthand nodes with single element lists (#665) 2018-01-03 19:25:47 +00:00
Luck 283516614b Create CONTRIBUTING.md 2018-01-02 15:02:25 +00:00
Luck 6c8f04f829 Implement PermissionsBukkit migration 2018-01-01 21:11:50 +00:00
Luck 505a10a8b1 misc refactoring 2018-01-01 19:48:20 +00:00
Luck 4fd89e6a34 fix compile 2017-12-30 19:38:58 +00:00
Luck 7bf666b062 fix abuse of static in SubjectReferenceFactory 2017-12-30 16:11:41 +00:00
Luck 764665cf15 Populate Subject cache when obtaining SubjectReferences for instances which already exist 2017-12-30 15:23:31 +00:00
Luck b9dfd7db54 Execute commands sequentially on a single thread executor 2017-12-30 12:16:34 +00:00
Luck e09c5622f7 Recompile against new powerfulperms namespace (#651) 2017-12-29 22:44:42 +00:00
Luck 717347273d Revert Spigot PluginClassLoader workaround 2017-12-29 20:40:43 +00:00
Luck 9bb1ba12b2 Fix issue with slf4j loading 2017-12-29 16:52:11 +00:00
Luck bff9715e7f Implement nasty workaround for Spigot's changes to the PluginClassLoader (#648) 2017-12-29 15:25:49 +00:00
Luck cfcd896c59 Fix broadcasting log entries 2017-12-29 00:41:45 +00:00
Luck aaa50cacda Allow spaces in world names 2017-12-29 00:39:54 +00:00
Luck 3413adf16f Send a different type of update ping for user changes, and only apply the change if the user is loaded 2017-12-28 13:37:55 +00:00
Luck 3d6aa69ca1 Improve various javadocs, add LogNotifyEvent 2017-12-27 17:00:54 +00:00
Luck ab115c4a6b Fix NodeFactory#nodeAsCommand (closes #639) 2017-12-27 10:30:13 +00:00
Luck e1e7bc8e0d Return empty string instead of null in VaultChatHook 2017-12-24 11:42:40 +00:00
Luck 6602b23f09 misc cleanup 2017-12-23 23:51:42 +00:00
Luck 862fe6e2e3 fix compile 2017-12-23 20:45:28 +00:00
Luck 5a34fa182a rewrite Vault implementation to upgrade requests to uuids instead of downgrade to usernames 2017-12-23 18:25:23 +00:00
Luck 0b72507e2d Correctly close flatfile database connections on disable, catch all exceptions when performing initial data load 2017-12-22 22:35:13 +00:00
Luck cc3ddd51fd fix copyright headers 2017-12-21 11:09:42 +00:00
Luck f793fd5010 pass and account for the holder type when building PermissionCalculators 2017-12-19 22:48:53 +00:00
Luck fb92fd9357 Extract out common constants & magic values into factory classes 2017-12-18 22:19:25 +00:00
Luck a415a2705f Return the loaded objects from storage methods as opposed to success flags 2017-12-18 17:03:59 +00:00
Luck 765f140121 Various fixes for log commands 2017-12-17 21:20:22 +00:00
Luck cb47f9f94b Change log output format, refactor log pagination 2017-12-17 17:47:10 +00:00
Luck d0fb9f6aee Update text version 2017-12-17 17:14:43 +00:00
Luck 9d424f5122 Fix more broken message coloring 2017-12-17 13:41:37 +00:00
Luck f71237ea95 Send more helpful message when /lp is executed without any arguments 2017-12-17 13:31:45 +00:00
Luck fb5925e1e8 Add user clone command (#530) 2017-12-17 12:59:36 +00:00
Luck f86bdb7619 Misc cleanup 2017-12-17 12:17:46 +00:00
Luck ad5299d0cd Send a message when an editor upload begins 2017-12-16 23:29:50 +00:00
Luck 904bb90385 Refactor paginated command output, add flags for ordering 'permission info' entries, fix crashes caused by long messages (#591) 2017-12-16 21:05:43 +00:00
Luck 2e7a08c006 Fix promote / demote command inconsistencies (#609) 2017-12-14 21:43:44 +00:00
Luck 38e75da92f Fix user demote command success message (#609) 2017-12-14 18:31:52 +00:00
Luck 97708c2c80 Update locale files (#604, #601, #602)
#601 by @DarkFort
#602 by @EuropeJing
2017-12-13 16:42:30 +00:00
Luck e5ce64266f Add option to pull server setting from the server.properties file 2017-12-11 19:42:24 +00:00
Luck a765be0a6f Fix compat with older hikari versions (#600) 2017-12-11 19:26:17 +00:00
Luck 0bec93ab1c refactor context sets 2017-12-11 19:02:02 +00:00
Luck dfb1b8f841 Work around message bug when parsing two consecutive color codes 2017-12-11 17:39:35 +00:00
Luck 322b522a52 propagate i/o errors to the futures returned by the dao 2017-12-10 01:47:00 +00:00
Luck 9dd4f71526 Remove the isAcceptingLogins storage state in favour of just throwing exceptions on usage 2017-12-09 19:02:23 +00:00
Luck 94b4e3d366 Validate checksums of downloaded dependencies 2017-12-09 18:36:08 +00:00
Luck bbb2897d20 Fix compatibility with older Gson versions 2017-12-09 11:26:12 +00:00
Luck a5e41e479a Use static empty context set where appropriate, cache reversed comparator instances 2017-12-07 19:49:04 +00:00
Luck 2baea0ce13 Fix MongoDao issue causing unnecessary writes each time a user is loaded (#589) 2017-12-07 16:52:21 +00:00
Foorack 90cbff885f Migrate PermissionsEx ladders (#588) 2017-12-04 23:24:06 +00:00
Luck 0d9034504e Run a sync task after completing a bulk update (#579) 2017-12-01 17:44:57 +00:00
Luck 800749c5ed Update README.md 2017-12-01 00:02:35 +00:00
Luck 30f27f29b4 Update readme 2017-12-01 00:01:50 +00:00
Luck 2985cf7237 Don't run schema migrations for Postgre (#568) 2017-11-30 20:33:15 +00:00
Luck 003ddc51de Rewrite the MongoDB storage impl to use the modern node serialisation format 2017-11-30 20:25:48 +00:00
Luck c369ac6b90 Fix mongodb bulkupdate (#572) 2017-11-29 23:10:32 +00:00
Luck e2b9e37867 Change poms to conform to Sonatype's OSSRH requirements 2017-11-28 22:22:52 +00:00
Luck 1e105b4135 Cleanup sponge service impl 2017-11-25 15:56:02 +00:00
Luck c5c253af4e Fix bug when loading maps from the BungeeConfigAdapter (#563) 2017-11-25 12:45:57 +00:00
Luck 717835e5c1 Add config option for defining extra SQL connection properties (#563) 2017-11-25 11:37:30 +00:00
Mat't e9ba62dbd9 Update pl_PL locale (#556) 2017-11-24 21:12:16 +00:00
montlikadani ad5c22ecdb Update hu_HU locale (#558) 2017-11-24 21:11:50 +00:00
Luck 2e92b97f01 Update ru_RU locale (#560 - thanks @DarkFort) 2017-11-24 21:10:44 +00:00
Luck ae8fe0fe1e Refactor configurate dao 2017-11-23 22:51:05 +00:00
Luck d992d7f77c Fix race condition when saving null config nodes to non-existent files 2017-11-23 20:15:29 +00:00
Luck a7cb7ec1af Remove character constraints on group names, cleanup legacy node (de)serialization system 2017-11-23 20:05:38 +00:00
Luck 3afeb30795 Implement system for shorter editor urls & display diff when changes are applied 2017-11-22 20:54:58 +00:00
Luck 26feeb125e Don't allow user names to be set if the length exceeds 16 characters 2017-11-22 17:17:49 +00:00
Luck 211fb219a7 Catch and ignore exceptions thrown when migrating a specific entity 2017-11-22 16:59:19 +00:00
Luck e71ef834c0 fix issue with the LP Vault impl and servers with more than one server context 2017-11-21 16:44:20 +00:00
Luck 29eba93ee3 Fix zero length prefixes from locale files 2017-11-21 15:44:22 +00:00
Luck 52ebfe9309 Bump SQLite version 2017-11-20 15:16:00 +00:00
Luck b3e78c6dc1 Fix issue with loading tracks with configurate 2017-11-20 15:14:44 +00:00
Luck cd0184970a Don't try to run schema migrations for SQLite 2017-11-19 22:24:39 +00:00
Luck 6401480874 Fix compiling null AssignmentExpressions 2017-11-19 19:09:21 +00:00
Luck 6ca9eb13dd General tidy up 2017-11-18 23:20:48 +00:00
Luck 987ea51264 Expose more connection pool settings in the config file 2017-11-14 19:39:46 +00:00
Luck df37491199 maybe fix some bukkit migration issues when plugins use strange identifier formats, cleanup legacy message conversion on Bungee 2017-11-12 15:05:06 +00:00
Luck 9a420403de Attach extra data to the editor payload object to allow for tab completion 2017-11-11 22:57:25 +00:00
Luck 17da2807cf Bump dependency versions 2017-11-10 20:16:44 +00:00
Luck 22fba0c172 Fix broken usage of LogEntry#getActed 2017-11-09 21:05:06 +00:00
Luck 14005563a3 Move #refreshCachedData up the type hierarchy into PermissionHolder 2017-11-08 22:59:22 +00:00
Luck a115ff8ce2 Final bits of API refactoring, add group data caches, fix issue with LPPermissionAttachment fake map injection 2017-11-08 22:55:05 +00:00
Luck d75b29f51d Move a couple more methods around in the API 2017-11-08 15:48:55 +00:00
Luck 3e8f7911af Fix tab completions not being returned for empty strings (#538) 2017-11-07 22:16:48 +00:00
Luck 175a21c0e4 API 4.0 - this is a breaking change 2017-11-07 22:05:49 +00:00
Luck a2801bff7c Inject a fake map into the super PermissionAttachment instance to fix compat with plugins using reflection to change attachment data (#528) 2017-11-07 17:05:16 +00:00
Luck f1a50f433f Throw exception earlier if an invalid permission is added/removed via Vault (#526) 2017-11-07 15:22:31 +00:00
Luck 76bfde4d77 Don't prevent modification of group.<group name> nodes with permission subcommands 2017-11-04 19:12:46 +00:00
Luck d393a4c9ca Alias /lp player --> /lp user 2017-11-03 16:26:54 +00:00
Luck 9ea6b0b8bb Use "None" instead of "global" when no server name is specified 2017-11-02 19:32:13 +00:00
Luck c20b91d5ea Increase actor_name field length to account for changes to logging 2017-11-02 19:28:49 +00:00
Luck fad8a38bdf Use a string version of the full static context, as opposed to the server name 2017-11-02 19:25:35 +00:00
Luck 2440a38e82 add RedisBungee context calculator for the BungeeCord platform 2017-11-02 19:01:53 +00:00
Luck b7541c43c8 Add Sender#getNameWithLocation 2017-11-02 18:51:59 +00:00
Luck 0f10bb0bc9 Deprecate some unused methods in ImmutableNode, refactor #shouldApplyWithContext 2017-11-02 18:22:42 +00:00
Luck 357717886e Refactor the log creation process 2017-10-30 21:06:45 +00:00
Luck 94a4051d29 Add extra catch for null primary group in powerfulperms migration 2017-10-30 20:03:59 +00:00
Luck 0e581cbcf3 Increase actions actor_name column length (#525) 2017-10-30 20:03:03 +00:00
Luck 230d9725e8 cleanup & fix build 2017-10-29 20:37:29 +00:00
Luck dee41b315f Inject our own subscription map into the plugin manager instead of registering permissions individually for each player 2017-10-29 15:16:48 +00:00
Luck 72e6c75433 Cleanup / tidy up a number of classes 2017-10-29 12:58:49 +00:00
Luck ebe12f838c Fix user exports 2017-10-28 00:15:34 +01:00
Luck 7279fdc25f Fix changes not being saved for flatfile bulkupdate operations 2017-10-27 23:17:57 +01:00
Luck af5c859385 Fix temporary group display format in parent info command (#518) 2017-10-24 13:17:27 +01:00
Luck e8896fbdf7 Fix NPE on startup (#520) 2017-10-24 13:05:06 +01:00
Luck 54695b8046 Form more descriptive console & import usernames 2017-10-23 23:37:55 +01:00
Luck c573c755d2 Add option to cancel failed logins on BungeeCord variant 2017-10-23 16:59:07 +01:00
Luck b299301b69 Cleanup 2017-10-22 21:02:48 +01:00
Luck a3a7198777 More storage refactoring 2017-10-22 20:09:53 +01:00
Luck ca8cc91f37 Add group setdisplayname command (#493) 2017-10-22 16:58:53 +01:00
Luck 26c813c07b Mode storage refactoring - write group nodes into their own section in flatfile types (#502) 2017-10-22 14:22:52 +01:00
Luck f109cb684a Apply PermissionAttachment permissions at a higher priority than normal nodes using the transient system (#515) 2017-10-22 10:24:04 +01:00
Luck 1baefaade4 Try to find the most appropriate primary group before just adding a user to default - closes #506 2017-10-22 09:16:04 +01:00
Luck 5ac0f93214 Fix migrating null / non-existent usernames - reverts parts of 6bfeec6, fixes #514 2017-10-22 09:07:08 +01:00
Luck ecfbed00b1 Add config option to allow invalid usernames (#516) 2017-10-22 09:00:10 +01:00
Luck 6e429d6c78 Throw exception if directories cannot be created 2017-10-22 08:48:00 +01:00
Luck fa4bb0447a Rewrite flatfile storage (YAML & JSON) to use configurate, add HOCON storage method 2017-10-21 23:20:45 +01:00
Luck aa0be40124 Cleanup verbose handler & only send sponge OP command notification if the sender has permission 2017-10-16 18:55:17 +01:00
Luck 04d5310c04 Ensure users are a member of their primary group (#506) 2017-10-16 18:53:02 +01:00
Luck 74069af309 Throw an exception if we're unable to create the lib dir 2017-10-16 15:28:02 +01:00
Luck 6bfeec6d16 Fix updating primary groups for players who've never joined the server with SQL storage types (#500) 2017-10-16 14:43:58 +01:00
Luck 0f4c057395 Add highest_inherited and lowest_inherited meta stack elements 2017-10-15 15:13:23 +01:00
Luck 2fd74f3b7e fix MetaStackElement equality checks 2017-10-15 14:51:42 +01:00
Luck fb171a57c2 Ensure stored primary groups are always lowercase'd 2017-10-15 14:32:57 +01:00
Luck b26fc69e73 Remove usage of the now-redundant ExtractedContexts class, other misc cleanup 2017-10-15 14:23:51 +01:00
Luck 28961b1cfa Primary groups should come first, not last, when ordering groups for inheritance (#500) 2017-10-15 11:22:38 +01:00
Luck 597f2f7b1b Make parents-by-weight the default primary group calculation method 2017-10-14 22:54:54 +01:00
Luck 00cd8bb3f3 Prioritise primary groups when two inherited groups have the same weight (#500) 2017-10-14 22:50:50 +01:00
Luck 5732e60510 Remove cleanupUsers functionality
It was pretty useless (and wasn't implemented on SQL/Mongo storage types.) Data is naturally cleaned up over time as users are loaded/saved.
2017-10-12 20:38:08 +01:00
Luck 7b271e21e3 Update readme 2017-10-12 20:25:51 +01:00
Luck 1a5f9683c2 Fix build (whoops) 2017-10-12 20:21:49 +01:00
Luck 3b74d55442 Remove sponge comparison chart from readme 2017-10-12 20:19:53 +01:00
Luck 8920396360 Remove context pre-processing (mostly)
This approach isn't very effective when contexts are frequently changing, and it is hard to guess in advance which contexts are going to be in-use.

The Sponge version has proven that this whole system isn't really necessary.

Contexts for 'allow all' and 'global' are still pre-processed, however this should be significantly less work for the server. (even if it is being done async)
2017-10-12 20:17:52 +01:00
Luck 9c505e4402 Move Track methods away from checked exceptions, refactor ContextManager & primary group holders 2017-10-12 19:43:42 +01:00
Luck de4c6b384c Export using the /lp alias 2017-10-12 18:47:35 +01:00
Luck 6dec1ba8af Add hu_HU locale - thanks @montlikadani 2017-10-03 19:04:47 +01:00
Luck 9e6788de2f Refactor context manager 2017-10-03 19:02:14 +01:00
Luck 1bd7e5c9c4 Refactor sponge cache invalidation 2017-09-29 23:21:12 +01:00
Luck ec75fdddb5 Make verbose output more readable when a check is made against a lot of contexts 2017-09-27 20:11:17 +01:00
Luck f98aafb97c Fix world content on BungeeCord not being lowercase'd 2017-09-24 23:43:39 +01:00
Luck f4d2a0daf9 Bump dependency versions 2017-09-23 23:36:13 +01:00
Luck de8fb8de90 Only load slf4j if it's not already present on the server 2017-09-23 21:15:45 +01:00
Luck 44d137b8f9 Add project Code of Conduct 2017-09-22 16:09:50 +01:00
Luck 777c972bdc Cache SubjectReference instances, general cleanup 2017-09-21 21:59:27 +01:00
Luck f9efa15781 Re-add 'list' as an alias of 'permission info' - reverts #461, closes #473 2017-09-20 20:31:24 +01:00
Luck 1d1cd679dd Fix tab completion inconsistencies caused by argument rewrites - closes #481 2017-09-20 20:27:46 +01:00
Luck a9ed4686dd Avoid loading slf4j when running on Sponge 2017-09-19 22:13:02 +01:00
Luck 5b742eb5b2 Only schedule a user cleanup when LuckPermsApi#cleanupUser is called 2017-09-18 20:50:50 +01:00
Luck a3d78f4d0e Always load dependencies into the plugin classloader, and not it's parent - fixes #479 2017-09-17 19:30:43 +01:00
Luck 214929e5e5 Fix group expiry time not being exported (#474) 2017-09-14 19:10:18 +01:00
Luck 67602b8d85 Fix startup deadlock 2017-09-13 21:24:35 +01:00
Luck 2412edaa3a Cleanup subscription updates & UserManager#loadAllUsers 2017-09-13 20:18:48 +01:00
EuropeJing b1584aa2c3 Update zh-CN locale (#466) 2017-09-12 08:47:37 +01:00
Luck a14a416193 Make some ingame messages more consistent with the LP theme, general cleanup 2017-09-11 22:21:57 +01:00
Luck f3251e9407 Fix missing depend 2017-09-10 21:45:47 +01:00
Luck 096885d91f Add tracing to /lp verbose, API updates/cleanup, add login process event, and utilise string interning for faster context/node comparisons 2017-09-10 21:25:00 +01:00
Frank Zhang 368700156c Added uranium server support to DependencyManager (#464) 2017-09-08 14:25:49 +01:00
Luck 81cf50520b Fix NodeFactory#nodeAsCommand when unsetting meta nodes, fix meta unset command 2017-09-06 21:56:41 +01:00
Luck 649748c2d3 Bump caffeine and hikari versions (#462) 2017-09-05 23:56:45 +01:00
Luck bf7a708440 Send some extra data to the editor data object 2017-09-05 14:54:22 +01:00
Luck 8faa4d137b Fix some issues with the recent import/export changes 2017-09-04 23:20:21 +01:00
Luck 479bd91b74 Fix build 2017-09-04 22:32:02 +01:00
Luck 6bc7f1fca2 Refactor Importer/Exporter to use multiple threads (#317) 2017-09-04 22:24:07 +01:00
Luck dadd8e2c50 Don't publish/broadcast log entries from the import process - towards #317 2017-09-04 20:47:45 +01:00
Luck 03f342a21c Refactor command execution to use Locks per target instead of (effectively) one for all commands - towards #317 2017-09-04 20:42:21 +01:00
Luck 7fe5397e21 Fix incorrect usage of CompletableFuture#thenCombineAsync 2017-09-04 17:56:01 +01:00
Luck b6e1fd179e Add type argument to 'meta clear' command (#457) 2017-09-04 17:25:59 +01:00
Luck 754c7d8e3b Add config option to prevent primary group removal (#405) 2017-09-04 17:03:17 +01:00
Luck 925d3ccd1b Remove "list" alias for holder info (#461) 2017-09-04 16:55:10 +01:00
Luck d60d0ac9c5 Reduce buffer times, refactor MessagingService init 2017-09-04 16:49:43 +01:00
Luck e1b51dd6af Catch Throwable instead of Exception when setting up BukkitJsonMessageHandler 2017-09-04 13:03:09 +01:00
Luck fbe9d9f128 Run user cleanup task async and not on Storage init 2017-09-03 16:16:21 +01:00
Luck 509826949d Add login debug option 2017-08-27 13:54:26 +01:00
Luck 39aaa8a292 Update for latest Text version 2017-08-22 22:51:49 +01:00
Luck 069c76c53a Fix time test for node expiry times 2017-08-22 16:30:46 +01:00
Luck f45c0caa45 Refactor metastacks & primary group calculation 2017-08-21 15:45:29 +02:00
EuropeJing 41b0e10709 Update zh-CN locale (#450) 2017-08-21 10:38:30 +02:00
EuropeJing 8e8da20c13 Update zh-CN locale (#449) 2017-08-20 19:43:58 +02:00
Luck 269aa39378 Fix comparator and ensure @Nonnull annotated methods never return null in LogEntry 2017-08-20 14:51:46 +02:00
Luck ae8be97db7 Dispatch log entries via the messaging service 2017-08-20 13:32:52 +02:00
Luck f0ad40825b Refactor and cleanup Log classes 2017-08-20 01:35:03 +02:00
Luck 36d292747a Format times in /lp log into a shorter form 2017-08-19 11:38:08 +02:00
Luck b65d2262bf Remove "... data was saved to storage" messages 2017-08-19 11:08:28 +02:00
Luck a7ab0c6b36 Send a more helpful message when the non legacy version of LP is installed on Bukkit 1.7 (#437) 2017-08-18 13:58:41 +02:00
Luck c02fcb6508 Refactor weight lookups 2017-08-18 11:14:03 +02:00
Luck 07c38de44b Allow permission info command to be filtered by context (#442) 2017-08-18 10:44:54 +02:00
Luck 188d62c99b Fix issue with casting UUIDs in MongoDB backing (#443) 2017-08-18 10:35:56 +02:00
Luck 76b203ad10 Fix text dependencies being shaded 2017-08-17 10:12:08 +02:00
Luck 909844aef5 Update KyoriPowered/text dependency 2017-08-16 10:56:35 +02:00
Luck 046202719a Correctly export meta/prefix/suffix nodes to command strings 2017-08-14 18:58:12 +02:00
Luck ed15e2838d Fix checkinherits command not returning the inheritance data 2017-08-14 09:38:08 +02:00
Luck 82466c2e5d Properly implement Contexts#allowAll - bump API to 3.3 2017-08-13 22:21:04 +02:00
Luck c598daf350 Fix negating group permissions to cancel inheritance 2017-08-13 19:40:59 +02:00
Luck a40421fa1f Optimizations to the core PermissionHolder class
- Remove usage of Java 8 streams from frequently called methods
- Use LinkedLists where appropriate to improve Iterator#remove speed
- Cache immutable multimap conversion
- Rename some methods to make the intended use/behaviour clearer
2017-08-13 19:24:00 +02:00
Luck d98b464ce9 Cleanup verbose & treeview packages. Return known permissions from the PermissionVault as Sponge PermissionDescriptions 2017-08-13 12:07:05 +02:00
Luck 1d5e3205ac Refactoring & misc cleanup 2017-08-12 19:34:14 +02:00
Luck 07eb17f5d5 Fix Sponge PermissionDescription lookups (#425) 2017-08-08 10:37:54 +02:00
Luck 3951725852 Fix 'meta settemp' command using duration as the server context (#421) 2017-08-05 23:46:19 +02:00
Luck 77956d69ad Fix NPE with Vault #getPlayerGroups 2017-08-05 17:30:40 +02:00
Luck 5784458d03 Make Sponge's #getFriendlyIdentifier return usernames of Users and display names of Groups (#412) 2017-08-03 18:39:39 +01:00
Luck 3d2115ff3c Remove unnecessary extra cache in ContextManager 2017-08-02 21:48:22 +01:00
Luck 8618a67e2e Fix sponge config loading - closes #407 2017-07-31 22:26:59 +01:00
Luck 234b9cafd7 Give default group if needed after "parent remove" (#405) 2017-07-30 21:08:05 +01:00
Luck 4ecd899bac Fix IndexOutOfBoundsException with 'permission settemp' command (#403) 2017-07-30 15:23:42 +01:00
Luck ce2c943397 Inject bukkit permissible at lowest priority instead of low 2017-07-27 12:58:31 +01:00
Luck 51898abb71 Don't load contexts file twice 2017-07-26 10:31:14 +01:00
Luck e2f800dd63 Throw an NPE if a null delegate sender is passed to SenderFactory#wrap 2017-07-26 10:10:25 +01:00
Luck d9e5bc9345 fix error with null subject in ContextManager removal listener - closes #392 2017-07-24 19:42:35 +01:00
Luck e42cc101cc Cleanup & document a number of Bukkit impl classes 2017-07-24 14:32:10 +01:00
Luck 845367e847 Flush storage buffer more frequently 2017-07-22 20:42:53 +01:00
Luck 90afd3c3ed Cleanup handling of empty permissions when migrating data (closes #387) 2017-07-22 20:04:55 +01:00
Luck b4aeb04d1b Fix possible NPEs when calling API storage events - fixes #384 2017-07-22 00:06:37 +01:00
Luck 65b0d45738 Fix IllegalStateException in meta info command - closes #385 2017-07-22 00:00:58 +01:00
Luck 3c44388883 Update /lp info output 2017-07-19 22:15:12 +01:00
Luck 400f3a9156 Add option to disable colored logging (#382) 2017-07-18 17:58:40 +01:00
creator3 ad6e837aa5 Use single quotes in escapeStringForSql (#379) 2017-07-16 23:53:15 +02:00
Luck cadd7545c5 Use saner class naming 2017-07-16 21:16:08 +01:00
Luck b41dea9ee1 Implement support for futures & other changes in the Sponge Permissions API 2017-07-16 14:12:36 +01:00
Luck 7a6c0ab154 Improve /lp listgroups output - closes #368 2017-07-10 10:09:29 +01:00
Luck 1bb1f5ebb3 Fail silently when the Sponge Server is not available - closes #367 2017-07-10 09:18:58 +01:00
Luck fce5b8430d Use GA MySQL version 2017-07-09 18:05:08 +01:00
Luck 0befa6a491 Fix generating unset commands for temporary nodes 2017-07-07 19:39:31 +01:00
Luck b12ce943f7 Make 'meta info' and 'parent info' clickable (#311) 2017-07-07 19:28:26 +01:00
Luck d23b29aeb1 Update dependency versions 2017-07-07 14:48:42 +01:00
Luck 42d48c8da2 Implement argument based permissions for LP commands - closes #52, #170, #174 2017-07-07 12:43:13 +01:00
Luck 9e83a5e4d9 Add RedisBungee messaging service option for BungeeCord 2017-07-03 16:24:00 +01:00
Luck d2bf940105 Add option to use the servers uuid cache/lookup facility (#354) 2017-07-03 16:07:33 +01:00
Luck 7d4aca68cc Fix jsr being shaded & tweak javadoc generation to link to guava docs correctly 2017-07-02 22:04:37 +01:00
Luck d7094909c0 Change verbose output slightly 2017-07-02 21:29:48 +01:00
Luck 7083d55a9b Fix vault lookups with a specified world 2017-07-02 10:49:07 +01:00
Luck 770db2fee0 Export groups in order of weight, then alphabetically 2017-06-30 19:43:45 +01:00
Luck b8e65c4f26 Fix bukkit defaults still being applied to subscriptions when disabled 2017-06-30 19:32:12 +01:00
Luck 5cd5186092 Don't cancel re-allowed connections unless the cancel was made by LP 2017-06-26 21:39:59 +01:00
Luck fa0b66c2dc Fix lp tree max recursion property 2017-06-26 16:31:30 +01:00
Luck 1b199fd2c7 Fix NPE when loading locale file - closes #338 2017-06-24 17:26:52 +01:00
Luck 2ffbeeef8e Add jsr305 annotations to the API 2017-06-24 17:25:13 +01:00
Chris N 26ce8b8ab7 YAML/JSON batch permission defining (#337) 2017-06-22 10:41:29 +01:00
Luck 8e224c4a27 Don't force cancel Sponge ClientConnection.Join if the cancellation state changes, shuffle event orders slightly - fixes #335 2017-06-20 21:37:38 +01:00
Luck cf5318b92b Make command defintion/usage messages translatable 2017-06-20 20:20:41 +01:00
Luck e50fa17f7c Store all accumulated meta values in MetaCache 2017-06-19 21:48:52 +01:00
Luck 8766e3b408 Add jar signing to build scripts 2017-06-19 20:09:18 +01:00
Luck c4c7f06d83 Fix BungeePerms migration - closes #333 2017-06-19 16:43:00 +01:00
Luck 413e304845 Fix NPE with null context in FileWatcher 2017-06-14 17:32:02 +01:00
Luck 046daf23d0 Deploy source & javadoc jar with the API 2017-06-13 20:17:41 +01:00
Luck c57947949c Don't send messages to command blocks async 2017-06-13 17:30:01 +01:00
Luck 0acefde805 Tidy up configuration file layouts 2017-06-12 21:41:23 +01:00
Luck a9e751b4b8 Replace fanciful with KyoriPowered/text 2017-06-11 14:46:56 +01:00
Luck 3df1ae8ded Fix argument validation for parent settrack command - closes #321 2017-06-11 10:27:26 +01:00
Luck b4a2da0ea8 Add some missing tab completions, remove /lp log export command 2017-06-09 22:19:07 +01:00
Luck 5c5d1e8d0a Fixes some issues with username storage and handling
- Fix the yaml/json UUID cache corrupting username data when performing uuid --> username checks
- Fix handling of usernames when users are loaded

Closes #301
2017-06-09 18:20:12 +01:00
Luck ff0c988a1d Don't store attributes for permissions with only 'value: true' in YAML/JSON storage files 2017-06-07 21:04:14 +01:00
Luck b9fc8f4b5f Add MongoDB collection prefix option 2017-06-05 16:09:02 +01:00
Luck 2ecaa39cb6 Only resolve inheritances for groups which exist already 2017-06-04 16:41:20 +01:00
Luck 7b8654339c Maybe fix usernames not being updated in storage after name changes (#301) 2017-06-03 16:40:16 +01:00
dzegarek 306e252c31 Add pl_PL locale (#306) 2017-06-03 14:47:34 +01:00
Luck 87c3bd6293 Update README.md 2017-05-26 20:48:41 +01:00
Luck 307beebb58 Cleanup Bukkit PEX migration, fix user parents being transferred incorrectly 2017-05-25 22:24:55 +01:00
Luck 4109863aa9 Fix -s flag (#132) 2017-05-25 21:35:47 +01:00
Luck 0febdbe3a4 Update copyright headers in the API module 2017-05-21 09:47:08 +01:00
Luck 139dd5302b Cleanup login handling & reduce the amount of unnecessary logging output on startup 2017-05-18 22:30:01 +01:00
Luck cc907b6530 Don't catch exceptions thrown inside i/o (#291) 2017-05-18 21:16:31 +01:00
Luck ca1dacf2b6 Invalidate active context cache when a player changes world - closes #288 2017-05-16 21:52:46 +01:00
Luck abc1c164cf Expose MetaStacks in the API, general cleanup, release 3.2 2017-05-16 21:41:20 +01:00
Luck dc801464ef Refactor meta stacking to be mapped in MetaCache - towards lucko/LuckPermsPlaceholders#1 2017-05-16 19:13:08 +01:00
Luck 99c6fe20c2 Catch exceptions thrown by context calculators 2017-05-16 13:50:28 +01:00
Luck 9d780ae24a Fix misleading Vault debug message 2017-05-15 21:26:43 +01:00
Luck a44dec0402 Fix typo 2017-05-15 12:07:59 +01:00
Luck a081152baa Fix web editor url 2017-05-15 12:05:54 +01:00
Luck 9b50d48f46 fix compile 2017-05-14 22:41:25 +01:00
Luck 5121fc6b1f Cleanup 2017-05-14 22:15:25 +01:00
Luck d4ac261e85 Cleanup config keys, make editor URL configurable 2017-05-14 21:36:02 +01:00
Luck 2e9561371d Implement initial web editor support 2017-05-13 20:36:05 +01:00
Luck 942fd3c4ce Fix vault lookups with static context 2017-05-11 20:04:11 +01:00
Luck 8cf32752e9 Fix meta info only showing values in global context 2017-05-11 19:46:28 +01:00
Luck b240ca9939 Add parent cleartrack command, cleanup Messages enum 2017-05-09 16:26:55 +01:00
Luck e25d99129c Implement parent settrack command - closes #112 2017-05-09 14:06:16 +01:00
Luck 1fee47e087 Implement default contexts - closes #241 2017-05-09 13:36:43 +01:00
Luck e835b31277 Apply world rewrites on-top of the real world name, and apply recursively (#255) 2017-05-09 13:07:39 +01:00
Luck 6817945e12 Bump sponge API version, cleanup 2017-05-09 12:55:45 +01:00
Luck 030fb1262e Fix being able to negate permissions/parents/meta in specific contexts 2017-05-08 22:27:46 +01:00
Luck fae49096f3 Fix retrieving meta keys from Vault which contain delimited characters - closes #270 2017-05-08 21:43:20 +01:00
EuropeJing afd491ecea Update zh-CN locale (#281) 2017-05-08 20:17:51 +01:00
EuropeJing 09bc100ad9 Add zh-CN locale (#279) 2017-05-08 18:11:29 +01:00
Luck 037f18ac56 Fix zPerms parent group migration for users, and fix migration of temporary memberships 2017-05-08 17:45:17 +01:00
Luck a5746dfa21 Support sponge selector resolution - closes #275 2017-05-07 22:52:45 +01:00
Luck cedc5108fc Refactor Patterns to PatternCache 2017-05-07 13:56:42 +01:00
Luck 65af3d0f54 Add data constraints - closes #256 2017-05-07 13:44:29 +01:00
Luck 6c4fa65f91 Fix migrating weight with zPerms 2017-05-06 23:35:58 +01:00
Luck 4731ad8061 Fix migrating false zPerms nodes 2017-05-06 21:06:22 +01:00
Luck 7dc41e15d3 Fix users being cleaned up too early and then logging back into the server - closes #271 2017-05-06 18:24:44 +01:00
Luck 8326539d40 Refactor LP PermissionService to implement a modified API & add proxied classes 2017-05-03 20:14:31 +01:00
Luck 163e6e0f2a Always load user data caches alongside user instances 2017-05-02 16:55:08 +01:00
Luck f56bb251e9 Cleanup some stuff 2017-05-02 16:36:46 +01:00
Luck 152ca99276 Fix issue with bulk removing suffixes 2017-04-25 16:51:21 +01:00
Luck 7c398d2c67 Split up chat messages sent to console containing new lines 2017-04-23 20:51:24 +01:00
Luck a526c942ca Add config options to allow for finer control over how permissions are calculated, and set include-global to true on BungeeCord by default 2017-04-23 20:30:58 +01:00
Luck af8fd15929 improve speed of NodeTools#removeSamePermission 2017-04-23 11:51:56 +01:00
Luck 7bfd5d4bc8 implement atomic group insertion 2017-04-22 22:53:29 +01:00
Luck 4382d5c56d show uuid in log messages if username is null 2017-04-21 21:28:50 +01:00
Luck f43b9c96de cleanup login handling & add CountdownLatch to ensure the plugin has started before logins are handled 2017-04-21 19:10:25 +01:00
Luck c64f72e394 Fix issue with loading usernames on MongoDB - closes #257 2017-04-21 16:58:07 +01:00
Luck 3d54f832c5 cleanup duplicated method 2017-04-20 19:26:47 +01:00
Luck 867ba24c6c support glowstone (maybe) 2017-04-20 19:15:37 +01:00
Luck 9715c5394c Fix NPE caused by AllParentsByWeight primary group selector - closes #252 2017-04-18 17:11:07 +01:00
Luck 67b5c72520 Cleanup handling of unknown/null usernames for users 2017-04-17 19:31:52 +01:00
Articuno 43450f6cc7 Update RU locale (#250) 2017-04-17 10:12:37 +01:00
Luck a3737d4f35 fix typo 2017-04-16 11:08:54 +01:00
Luck 3314e94a9a Add not_on_track meta stack criteria 2017-04-16 11:06:05 +01:00
Luck a27436b086 Fix getting primary groups for offline users 2017-04-15 20:32:03 +01:00
Luck fe5554ffb1 fix build 2017-04-15 19:53:12 +01:00
Luck f305f8d822 Determine dynamic primary groups using current context 2017-04-15 19:08:04 +01:00
Luck 1f54bc41cc Cleanup poms, update copyright header 2017-04-15 19:01:52 +01:00
Luck c82d028429 fix yaml/json schema migration 2017-04-12 21:33:59 +01:00
Luck be2a8b7b07 Fix incorrect chat meta command usage 2017-04-12 17:59:51 +01:00
Luck 261fc82016 Remove getuuid command
why did that ever exist anyways
2017-04-12 17:25:22 +01:00
Luck 37b940f3a5 Convert promote / demote commands to use new context system, update en locale with latest changes 2017-04-12 17:11:01 +01:00
Luck 0504e904a2 Only perform flatfile schema migration if the new dir doesn't exist 2017-04-12 14:28:39 +01:00
Luck 71bfdd9bfd log the file name when exceptions are thrown during i/o 2017-04-12 14:09:51 +01:00
Articuno c7305f6b06 Update ru_RU locale (#238) 2017-04-11 10:47:43 +01:00
Luck 4fb07ff181 API changes for 3.1 2017-04-10 22:26:20 +01:00
Luck 4631dcf857 Ensure expired permissions are removed when users/groups are loaded for commands 2017-04-10 20:57:59 +01:00
Luck f6f9840eb7 Re-implement bulk updates 2017-04-10 19:33:23 +01:00
Luck 4de8165c95 fix issue with /reloading and permission registration 2017-04-10 18:17:09 +01:00
Luck 242672f49d Remove old bulk edit commands 2017-04-10 14:56:46 +01:00
creator3 c32c975a71 Fix accumulation of temporary perms with a world or server context (#235) 2017-04-08 20:49:10 +01:00
Luck 82e759d708 Make sure world names are lowercase'd 2017-04-08 17:00:36 +01:00
Luck 9de44d2605 Don't attempt to migrate empty permissions 2017-04-07 21:03:27 +01:00
Luck 132d0cf578 Fix export command switchprimarygroup output, and log player uuid if their username isn't included 2017-04-07 19:59:53 +01:00
Luck 029dc9f8d9 Make the standard MySQL driver the default again 2017-04-06 11:30:17 +01:00
Luck 5567b1dad8 Use the mariadb driver by default 2017-04-05 21:23:18 +01:00
Luck ea00ec64af Refactor NodeModel into a more useful class, remove duplicate context serialization methods 2017-04-04 19:19:31 +01:00
Luck 7259e6be0a Fixes for the verbose uploader 2017-04-04 17:17:57 +01:00
Luck 2e40557b39 Add '/lp group <group> listmembers' command - closes #203 2017-04-04 16:07:41 +01:00
Luck e68fc7c558 Improve performance of resolve methods in PermissionHolder, other cleanup 2017-04-04 15:22:25 +01:00
Luck 055dfb000d Only allow one server and one world in context sets parsed from command args 2017-04-04 13:47:50 +01:00
Luck b997ab6e3f Properly sort storage files - closes #227 2017-04-03 10:57:29 +01:00
Luck 25f31d0bb8 Cleanup sponge delegate classes 2017-04-03 10:27:31 +01:00
Luck 4cfd8a7e2c Fix broken command parameter & update default locale file 2017-04-03 09:53:26 +01:00
Luck 0ec19a8fee Implement accumulation of static contexts from a file 2017-04-03 01:42:49 +01:00
Luck 2749563f5d Replace guava caches with caffeine 2017-04-03 00:53:04 +01:00
Luck e7e2e3f7e0 Allow context pairs to be specified in commands, fix misuse of exceptions in the permission holder class 2017-04-02 18:44:05 +01:00
Luck 0a33c0aac5 Fix compatibility with older gson versions - closes #222 2017-04-01 07:26:05 +01:00
Articuno 24e09fd2d9 Add ru_RU.yml (#224) 2017-03-30 18:45:50 +01:00
Luck 4d0499a61e Avoid parsing UUID in sponge world calculator 2017-03-30 18:40:36 +01:00
Luck ae82807139 Add "use-vault-server" config option, depreciate vault primary group override feature 2017-03-27 17:35:28 +01:00
Luck 65147e1935 Remove missing permission nodes before adding new ones when saving users/groups with SQL storage 2017-03-27 16:54:59 +01:00
Luck 8e557d122b Fix some concurrency issues with login handling 2017-03-26 18:40:09 +01:00
Luck 486b19aa90 Cleanup some misc stuff 2017-03-26 16:10:49 +01:00
Luck 14cb34ac95 Force some config options to be read as lower case 2017-03-25 23:23:20 +00:00
Luck abfc23b04d Provide tab completion for rewritten arguments & add some more rules 2017-03-25 20:27:33 +00:00
Luck ebb24aefa1 Fix parent set command also adding default 2017-03-25 20:06:30 +00:00
Luck 2573f46f40 Fix removing temporary permissions/parents/meta in global context 2017-03-25 19:58:56 +00:00
Luck 5dcb8cd73a Output group/track lists in alphabetical order 2017-03-25 19:48:17 +00:00
Luck e4bfe09882 Don't bother loading test classes (#217) 2017-03-25 11:38:02 +00:00
Luck eecbfe04db Add es_ES locale 2017-03-25 11:13:45 +00:00
Luck 671e2adc32 Cleanup remaining (un)setPermission methods 2017-03-25 11:04:25 +00:00
Luck 1137e476dd Rewrite inheritance resolution implementation 2017-03-24 22:18:18 +00:00
Luck cb63b321d0 correct zPermissions migration logging tag 2017-03-23 23:18:03 +00:00
Luck c36b0d2975 Automatically push updates to other servers via the messaging service when commands are ran 2017-03-21 21:58:45 +00:00
Luck f8ad562b95 Rename "debug" classes to "verbose" 2017-03-20 17:22:18 +00:00
Luck c35ab38f36 Slight speed improvement for import processes 2017-03-19 20:52:35 +00:00
Luck 073b775566 Implement nicer json format for Sponge local data 2017-03-19 17:54:12 +00:00
Luck 85c7a7db8d Implement new file layout for YAML / JSON storage files (#211) 2017-03-19 15:37:30 +00:00
Luck 1e134df27d Clarify the file names of H2 and SQLite databases 2017-03-18 23:00:12 +00:00
Luck bdff84885a Enforce that ContextSets use the HashMultimap variant - closes #208 2017-03-18 20:18:18 +00:00
Luck f1a9c3722c Fix PM migration command not being registered 2017-03-18 17:26:44 +00:00
Luck 8b402f6423 Fix NoSuchMethodError being thrown for older Bukkit config classes 2017-03-18 15:34:29 +00:00
Luck a0aec52661 Correct the case of group names when retrieved from Node instances 2017-03-18 14:43:34 +00:00
Luck 407ab43dd1 Update PM migration to support latest version 2017-03-17 23:21:57 +00:00
Luck c2165e0196 Fix primary groups being selected in reverse order 2017-03-17 23:00:37 +00:00
Luck 2e75bc3f3b Add some alternate options for primary group calculation 2017-03-17 22:54:18 +00:00
Luck e91c2ca427 Add method to export Message enum and update language file 2017-03-17 21:17:59 +00:00
Luck 965ff04bcc Fix ClassCastException with MongoDB user search 2017-03-17 20:54:40 +00:00
Luck ac4bd418f3 Rename online-mode config option to use-server-uuids to better reflect/clarify its purpose 2017-03-17 20:51:06 +00:00
Luck e9e844c1f7 Include internal weight value in meta output if not already present 2017-03-13 20:17:54 +00:00
Luck aa2941fcdb Refactor and cleanup commands 2017-03-13 20:03:03 +00:00
Luck dbc909a317 Cleanup migration commands 2017-03-13 19:10:36 +00:00
Luck 11465a4ce9 Fix BungeePerms migration to account for group weights and negated permissions 2017-03-12 20:00:02 +00:00
Luck f5007f94dc Add server version info to the startup banner 2017-03-12 14:59:27 +00:00
Luck d18ac2e6eb Cleanup pom files, maybe improve build speed a bit 2017-03-12 14:28:35 +00:00
Luck b9fc5c39ae Listen for changes in data files and automatically update 2017-03-11 23:05:03 +00:00
Luck 9dc2278083 Cleanup a bit 2017-03-11 21:10:27 +00:00
Luck 281060a972 Make the clone commands work for existing tracks/groups too 2017-03-11 18:30:27 +00:00
Luck 91626f079d Fix mistake in removeprefix/removesuffix command descriptions 2017-03-11 18:26:29 +00:00
Luck 7305c6c54b Migrate group weightings onto the group itself as well as to the chat meta held by it 2017-03-11 18:24:25 +00:00
Luck bce7fa871d Fix getAllNodes cache not working properly, remove pre-process contexts on Bungee & cleanup some unused methods 2017-03-11 17:55:50 +00:00
Luck a35fd80763 remove placeholder expansion from main project 2017-03-11 14:02:17 +00:00
Luck b383f9dfbc Add some more placeholders to the expansion 2017-03-11 13:30:08 +00:00
Luck 680ad3c145 Update hikari version 2017-03-11 10:32:10 +00:00
Luck 7b712e7f90 Update readme 2017-03-10 23:30:08 +00:00
Luck 2462eac497 Run exporter in own thread and process user exports concurrently 2017-03-10 20:44:19 +00:00
Luck bb818c8942 Cleanup powerfulperms migration & remove support for older PP versions 2017-03-09 19:10:48 +00:00
Luck ddc881af11 Add new argument util method for reading context pairs 2017-03-09 17:56:15 +00:00
Luck 838fba9173 Switch all usages of file reader/writers to use java nio methods - closes #204 2017-03-09 17:55:33 +00:00
Luck 0b6f326c18 Fallback to uuid in the search command if the username is unknown 2017-03-07 22:17:49 +00:00
Luck 00895fc7ab Don't send json text on MC 1.7 2017-03-06 18:22:11 +00:00
Luck 07f38aa283 Fix possible issue with context conversion 2017-03-05 22:56:00 +00:00
Luck ecf1d3790c Fix issue where group nodes could be unset using the permission commands, and where users with per-server groups wouldn't be assigned to the default group globally 2017-03-05 19:05:05 +00:00
Luck 53c9e5bb4a Fix race condition with Bukkit join handling where players are denied entry but subsequently login slightly later 2017-03-05 00:59:44 +00:00
Luck b20b03113a Fix groupmanager global group migration on windows systems 2017-03-01 21:26:20 +00:00
Luck ec8273aa9f Change bungeecord leave event priority to wait longer before unloading data 2017-02-26 21:53:03 +00:00
Luck 2862f0dfae Fix creating delimiter patterns 2017-02-26 21:28:40 +00:00
Luck fd4963c74b Fix getUuid and getName API methods returning null for User, Group and Track instances 2017-02-26 20:46:37 +00:00
Luck df99ef4481 misc cleanup 2017-02-26 12:43:35 +00:00
Luck 35d1057673 Refactor sponge commands to use the proxied interfaces (closes #197) 2017-02-26 11:55:59 +00:00
Luck e6a90a18c4 Sort subjects properly 2017-02-26 01:16:54 +00:00
Luck 26afb69a14 Cleanup LuckPermsSubjectData (fixes #194) 2017-02-26 01:00:02 +00:00
Luck e8c0c43e9d misc cleanup 2017-02-24 19:31:45 +00:00
Luck 1707f333bf update javadocs link in readme 2017-02-23 21:59:43 +00:00
Luck 6798fb21b2 Events rewrite, remove most deprecated API methods (v3.0) 2017-02-19 14:57:20 +00:00
Luck 89ff3b169b Fix bukkit child permission handling to not include permissions with no children & cleanup permission registration 2017-02-18 21:01:09 +00:00
Luck abddb265be ensure all bukkit permissions are registered on startup 2017-02-18 08:50:06 +00:00
Luck b328fa74a7 Clarify thrown exception when a null context is returned 2017-02-16 21:45:43 +00:00
Luck f97aa651a0 Fix NPE caused by generating the wrong ExtractedContexts type - closes #185 2017-02-16 21:43:27 +00:00
Luck 8d86eed0a7 Don't bother adding checks to the listener queue if no listeners are registered 2017-02-15 19:39:24 +00:00
Luck 05f906a759 Add /lp tree command - closes #175 2017-02-15 19:21:27 +00:00
Luck 4b16be1b75 Fix setting chat meta with Vault, remove unnecessary permissible recalculations & general cleanup 2017-02-15 12:53:52 +00:00
Luck bd97a7c5d2 Respect prefix option set in subject - closes #149 2017-02-14 17:11:17 +00:00
Luck a3a23d8870 Remove redundant SQL queries and fix issue where multiple uuids could be mapped to the same username - fixes #179 2017-02-14 16:23:54 +00:00
Luck 30bddceac5 import log should be sent to console too 2017-02-13 16:26:41 +00:00
Luck 989a2cc89c Make the bukkit command manager more accessible 2017-02-13 12:53:22 +00:00
Luck 3f17e8c3c8 Test verbose filters before registering them (#178) 2017-02-12 17:19:16 +00:00
Luck 140e6b08ca Apply regex perms before wildcards 2017-02-11 12:12:28 +00:00
Luck 6a39b721ba Fix sponge service returning subjects in reverse priority order 2017-02-09 23:00:48 +00:00
Luck 1df6f4b9df Allow negated group permissions 2017-02-08 21:04:34 +00:00
Luck 9493fb3a7a Switch SpongeGroup meta handling to use MetaHolder - closes #171 2017-02-06 22:38:03 +00:00
Luck 0d1f3b855f Ignore commented lines on dump imports & add annotations to export files - closes #169 2017-02-05 09:58:24 +00:00
Michael Vorburger 0982154a15 "Explaination" --> "Explanation" (#168) 2017-02-04 22:32:34 +00:00
Luck 378f3f5efa Fix NPE for vault getUserMeta when defaultValue is null and the LP value is also null 2017-02-04 17:45:26 +00:00
Luck 9b8d6e1dc7 Modify node escaping to use "\" characters, and remove all limits on node/server/world strings - closes #166 2017-02-04 12:18:45 +00:00
Luck 6540c695de Add configurable duration handling when a holder already has a temporary permission/parent/option set - closes #152 2017-02-03 22:24:42 +00:00
Luck 1d71ec07be fix option lookups in specific contexts returning as global instead 2017-02-03 17:18:18 +00:00
Luck c837dd5cc8 fix jedis shading - closes #158 2017-02-02 16:00:18 +00:00
Luck bc52e4da0e Fix OPs disabled message 2017-02-02 15:58:34 +00:00
Luck f0b4040458 Fix Sponge PEX meta migration weightings 2017-02-02 15:33:15 +00:00
Luck d804c4be2a fix build 2017-02-02 15:16:08 +00:00
Luck ede413a213 Fix import/export handling - closes #159 2017-02-02 15:13:44 +00:00
Luck 9cee319ed9 Cleanup all migration commands - closes #63 2017-02-01 18:41:15 +00:00
Luck f7b281f655 Fix build 2017-01-31 12:32:18 +00:00
Luck 8dbb083b90 Fix migration log being sent to the console twice 2017-01-31 12:29:06 +00:00
Luck 0be6d658ed Refactor plugin and scheduler interfaces 2017-01-31 12:14:42 +00:00
Luck 1efce41767 Fix search command page number 2017-01-30 20:13:19 +00:00
Luck da23b6ea9a Fix search command page number 2017-01-30 20:13:19 +00:00
Luck a61d3b3fd4 Fix sponge PEX/PM migration issue with defaults 2017-01-29 21:56:09 +00:00
Luck ab9284b80f Use reflection in the #getAllKeys method instead of a list 2017-01-29 14:52:42 +00:00
Luck 424af27a47 Change update messages to account for more than just redis messaging 2017-01-29 11:09:11 +00:00
Luck 5039a05055 Update readme 2017-01-27 20:37:27 +00:00
Luck d150b22eae fix NPE on login 2017-01-26 21:05:44 +00:00
Luck a617675771 prettify the verbose paste output 2017-01-26 19:47:46 +00:00
Luck f27034bb35 Pull git commit id once only - should improve build time 2017-01-26 13:55:06 +00:00
Luck 86b203c21b Compile with shaded redis version - fixes #150 2017-01-26 13:54:23 +00:00
Luck 73c5a1ad9b Fix apache pool2 jar not loading correctly - closes #150 2017-01-25 22:07:50 +00:00
Luck 81c71777cb Fix some usage messages 2017-01-24 21:48:47 +00:00
Luck 599072eef6 Fix null config values throwing exception - closes #147 2017-01-24 20:13:18 +00:00
Luck 02ea3afbe9 Add "!" delimiter to verbose matching 2017-01-23 22:47:39 +00:00
Luck 0c1a2e82bf implement verbose expression matching 2017-01-23 22:43:52 +00:00
Luck f89fb87c92 Log the file name when I/O fails 2017-01-23 21:15:25 +00:00
Luck 98d6cf842a reword check result message slightly 2017-01-23 21:08:27 +00:00
Luck 69dc02b2c2 Add /lp check <user> <permission> command 2017-01-23 21:03:58 +00:00
Luck 7d1a3d32e9 Fix login NPE when async tasks run after the event has been fully handled 2017-01-23 16:22:25 +00:00
Luck d93cc826b2 Fix backwards compatibility with redis 2017-01-22 22:49:11 +00:00
Luck 8025f3a082 Fix all users sharing the same meta state 2017-01-22 22:19:29 +00:00
Luck 247871f678 Cancel messaging task when the message is sent 2017-01-22 21:47:57 +00:00
Luck 327c8b83be Implement BungeeCord & LilyPad messaging services - closes #142 2017-01-22 21:46:22 +00:00
Luck 0f8c334de8 FIx stacking backwards compatibility 2017-01-22 19:01:34 +00:00
Luck 292d4cd450 Implement stacking prefixes - closes #60 2017-01-22 18:23:08 +00:00
Luck 38d1c9974b Soften server checking regex - also towards #143 2017-01-22 16:36:06 +00:00
Luck 0be7300677 Fix node shorthand parsing - closes #143 2017-01-22 16:29:52 +00:00
Luck c03585aeca Fix using UTF-8 characters with MySQL - closes #129 2017-01-22 12:19:29 +00:00
Luck d39dad3287 Fix config reloading causing ClassCastExceptions 2017-01-22 11:58:48 +00:00
Luck 0a3ca3affe Add /lp reloadconfig command - closes #100 2017-01-21 20:14:25 +00:00
Luck b7cf0e6bc7 Refactor config handling - towards #100 2017-01-21 15:36:13 +00:00
Luck 7430013cc3 don't unload sponge data when a player quits 2017-01-20 20:02:42 +00:00
Luck 6dd093fe72 fix API ClassCastException 2017-01-19 21:29:54 +00:00
Luck 8a8d6f16ae Return subjects in priority order - related CodeCrafter47/BungeeTabListPlus#175 2017-01-19 21:09:44 +00:00
Luck 2e16844141 Remove console only commands - closes #137 2017-01-19 20:39:09 +00:00
Luck a152cc47c7 Fix bukkit login handling - closes #110 2017-01-19 20:04:22 +00:00
Luck 241507228f Colorize console info messages 2017-01-19 19:51:41 +00:00
Luck 8aa7d272fa Include license file in the jars 2017-01-19 19:03:59 +00:00
Luck 01ac5382ea Prevent some shutdown exceptions - closes #136 2017-01-19 18:56:22 +00:00
Luck 02b88a8357 Maybe fix default assignment parsing error with sponge 2017-01-18 22:40:25 +00:00
Luck c99d6556db Fix issues with default assignment loading on Sponge 2017-01-18 21:37:41 +00:00
Luck 1db777cd31 Remove world cache - fixes #135 2017-01-18 21:05:14 +00:00
Luck aea44fc8bc API changes for 2.17 - closes #123 2017-01-16 20:01:41 +00:00
Luck c0da9d49d9 make clickable message invert filter more specific 2017-01-16 16:55:59 +00:00
Luck ce42573f43 Properly invalidate user caches when defaults chance - fixes #118 2017-01-15 17:47:59 +00:00
Luck 148fe4c729 Make prefix/suffix string optional in the meta remove commands - related to #83 2017-01-15 15:11:35 +00:00
Luck 32fd484b58 Change promote / demote behaviour at the end of tracks - towards #112 2017-01-15 13:22:50 +00:00
Luck 7d24e748b7 Fix reading and writing UTF-8 characters from storage files - closes #129 2017-01-15 12:18:12 +00:00
Luck f1a1612f5d Subscribe to default permissions too 2017-01-14 23:49:45 +00:00
Luck 6501e5cf8d Fix bukkit permission subscriptions 2017-01-14 23:19:11 +00:00
Luck cd4a684613 Fix demote command not removing old group 2017-01-14 08:27:09 +00:00
Luck d06fda6d9d Add /lp search command 2017-01-13 20:11:25 +00:00
Luck 139010e75b Fix repo 2017-01-12 21:59:38 +00:00
Luck 7638b07e34 bump fanciful version 2017-01-12 21:48:16 +00:00
Luck f7bf4416c9 Fix illegal cast from LPSubject to SpongeGroup - fixes #126 2017-01-12 21:19:34 +00:00
Luck 2b96b656a9 constants do not need getters 2017-01-12 21:14:27 +00:00
Luck 0fe251b6ec Fix promote/demote commands and primary groups conflicting 2017-01-12 19:45:44 +00:00
Luck a1afc70bcb Cache regex permissions when they get processed 2017-01-12 19:45:15 +00:00
Luck ced3e6959c Add methods to get a list of users/groups with a specific permission 2017-01-11 21:25:57 +00:00
Luck 1c229d54d9 Cleanup 2017-01-11 18:55:46 +00:00
Luck dd50193c18 Fix Sponge subjects from being unloaded and never reinitialized - closes #124 2017-01-10 19:17:45 +00:00
Luck ab0f9bbdbd Fix creating new tracks with SQLBacking 2017-01-09 19:24:12 +00:00
Luck 055d181c67 Fix KCauldron dependency loading - closes #121 2017-01-09 18:20:03 +00:00
Luck 7042c45deb Fix retrieving log from SQLBacking 2017-01-08 20:12:33 +00:00
Luck 960c2291b6 Fully implement new SQL schema & add migration code 2017-01-08 19:33:27 +00:00
Luck 773bfe1407 Automatically sort YAML/JSON storage - closes #113 2017-01-08 11:02:13 +00:00
Luck a23f995717 Hopefully fix #118 2017-01-08 10:44:48 +00:00
Luck bd509b3c75 Fix build 2017-01-05 18:30:09 +00:00
Luck a0f8ba9afb Fix NPE in LuckPermsSubjectData - closes #115 2017-01-05 18:27:58 +00:00
Luck a71e040c6d Fix NPE with Vault transient permissions - closes #117 2017-01-05 18:20:17 +00:00
Luck 454abec468 Cleanup vault hook 2017-01-05 18:19:14 +00:00
Luck 96035d5257 Fix clickable node list 2016-12-30 15:02:22 +00:00
Luck 9f2b59f2a2 Refactor SQLBacking - still towards #77 2016-12-30 14:27:43 +00:00
Luck a54046907d change first login event handling 2016-12-30 12:46:24 +00:00
Luck 2ce5679373 Fix issue where only the first request for a user subject would wait for the loading task to complete. Closes #108 2016-12-30 00:42:33 +00:00
Luck 2dad9f84fc Fixes towards #77 2016-12-27 14:55:21 +00:00
Luck a81a361a93 Fully implement new SQLBacking - towards #77 2016-12-27 14:27:05 +00:00
Luck 4660e68abf Some small fixes for new SQL backing 2016-12-27 13:03:59 +00:00
bakatrouble f8a77cf809 Change comments on configs; default ports for all storage backends 2016-12-27 12:39:54 +00:00
bakatrouble 0abe9598f6 It shouldn't be here 2016-12-27 12:39:54 +00:00
bakatrouble 20de713716 Some readability 2016-12-27 12:39:54 +00:00
bakatrouble 9dbef6acc2 Change providers syntax; fix port for PostgreSQL provider 2016-12-27 12:39:54 +00:00
bakatrouble 4c93bf7cf0 Fix connection leaking on batch inserts; fix IDEA analyser warning 2016-12-27 12:39:54 +00:00
bakatrouble a8fea0fc49 Implement NodeDataHolder 2016-12-27 12:39:54 +00:00
Luck 2d5975d6e3 Vault only save if a change was made 2016-12-27 12:24:19 +00:00
Luck 6874cfd5b1 WIP: implement better sql schema - towards #77 2016-12-24 20:30:35 +00:00
Luck d34013396a woops 2016-12-23 16:59:01 +00:00
Luck a35b0915ab Refactor SQL storage - towards #77 2016-12-23 16:55:35 +00:00
Luck b35f3b4375 Properly cleanup in the case of a reload - towards #100 2016-12-23 11:28:42 +00:00
Luck f4f9612789 Fix MongoDB auth-less connection 2016-12-23 10:14:41 +00:00
Luck bfc79c6051 Reduce page entry count to 15 - resolves #95 2016-12-22 22:06:41 +00:00
Luck d3e60487bb Download dependencies at runtime instead of shading them in the jar 2016-12-22 21:17:02 +00:00
Luck f36f411a8d Fix broken inheritance caching system - closes #97 2016-12-22 17:50:56 +00:00
Luck 35f4aea69f Maybe fix caching issues - closes #99 2016-12-22 15:34:22 +00:00
Luck 8795383e7c Make sync command reload sponge data too - resolves #98 2016-12-21 21:34:43 +00:00
Luck fc4750706b Cleanup sponge files and don't persist empty sections - resolves #96 2016-12-21 21:33:32 +00:00
Luck 0ae59bd3e6 show group weight value in the group info command output 2016-12-21 21:26:22 +00:00
Luck 61fd14c816 Add group setweight command - closes #94 2016-12-21 21:22:48 +00:00
Luck c7d3d87b09 Fix verbose recording filters (again) 2016-12-20 13:59:56 +00:00
Luck 5e68f7b58c Implement paginated permission listings - closes #80 2016-12-20 13:55:42 +00:00
Luck 8a692200d5 Improve memory footprint in low throughput caches 2016-12-20 12:42:20 +00:00
Luck 829eacb0fb Fix verbose recording not taking note of filters 2016-12-20 02:53:37 +00:00
Luck 9aeca91f22 Allow space on Sponge Group subjectcollection 2016-12-19 21:52:26 +00:00
Luck 1bdb512826 Ease handling of group names containing spaces, after a faulty migration process 2016-12-19 21:50:34 +00:00
Luck 060fa6e5f7 change weight node 2016-12-19 18:22:32 +00:00
Luck 171a54c0fc PEX migration - include username too. Closes #92 2016-12-19 01:22:47 +00:00
Luck 17406b448d Add more detail to the group info command 2016-12-18 23:34:33 +00:00
Luck b4b661a3ad Set default port 2016-12-18 10:16:05 +00:00
Luck 4857969ca4 Cache calls querying parent groups in bridge subjects - closes #69 2016-12-18 09:57:39 +00:00
Luck d9d01e09aa Cache collation keys - resolves #90 2016-12-18 09:42:27 +00:00
Luck dadca97d8a actually remove 2016-12-17 00:04:04 +00:00
Luck 8afba8b53d remove /p alias 2016-12-17 00:03:21 +00:00
Luck 85dac1184c silence NPE in autoop listener 2016-12-16 22:47:44 +00:00
Luck 4167460d28 Print true/false alongside permission info output for consoles without color. Closes #84 2016-12-16 19:21:36 +00:00
Eric Coan 1d8a60749d help tame mysql connection settings
this commit further helps tame the mysql connection pool (and really
reconnecting to the pool even when the underlying db goes down) further
from commit: #31a597c

this sets up `setValidationTimeout`, and `setConnectionTestQuery`
in order to better (more speedily(?)/fastly(?)/<other adective>ly(?))
handle connection timeouts in a timely manner. (although admittedly
this is already handeled well imo with the cache). however, it could
be better ™️.

in order to do this I did the following things:
  1. Switch to `TimeUnit.SECONDS.toMillis` instead of manually entering
     milliseconds, and having the time in seconds as a comment. just
     makes it more readable imo. if you want me to change it back I can
     I'm not like attached to this or anything.
  2. Perform more common validation timeouts with `setValidationTimeout`
     this allows us to potentially bump back up the connection timeout
     (although I see no harm leaving it where it is), although allows
     us to still "fail-fast" in a way when doing validations.
  3. Use `setConnectionTestQuery` for people who somehow someway
     may not be using a JDBC4 compliant driver.
2016-12-16 17:14:24 +00:00
Luck 31a597ca81 lower mysql connection timeout - may help with #81 2016-12-12 22:21:54 +00:00
Luck e5e77ffec5 Add PEX track migration - closes #78 2016-12-12 19:51:21 +00:00
Luck 41c3df41b4 Allow group weights as permission nodes - resolves #73 2016-12-12 19:30:42 +00:00
Luck 053066f1a7 add parent clear command - closes #67 2016-12-12 19:06:23 +00:00
Luck 21135dac07 Implement (partially) clickable permission lists - towards #68 2016-12-12 18:56:48 +00:00
Luck 22ccce3208 Default the value to true in set/settemp commands if no arg is given. Closes #82 2016-12-12 16:52:15 +00:00
Luck 70aa3964ee Run all commands on the same thread - fixes #79 2016-12-11 11:34:18 +00:00
Luck 167489823a more lenient command blocking 2016-12-09 19:39:05 +00:00
Luck d1426f1b37 change jar names 2016-12-08 19:33:49 +00:00
Luck 7dcdc59c8e Fix IllegalArgumentException with BiMap#put 2016-12-08 16:30:00 +00:00
Luck 1e13ee87af cleanup imports 2016-12-07 22:21:22 +00:00
Luck 5101c1a759 fix build 2016-12-07 22:16:01 +00:00
Slind14 74bb079625 Fix zPermissions imports (PR #72, fixes #61)
* removed zPerm inherit loop check. (blocked the import due to throwing NPE)

* should fix zperm migration (group inheritance and memberships)

* zperm import, include username

* zperm import: fixed memberships
2016-12-07 22:13:50 +00:00
Luck 2da7979d94 Partially add clickable command listings - towards #68 2016-12-07 22:09:11 +00:00
Luck 4ecb2c7c27 Closes #58 - Disable OP commands on Sponge 2016-12-07 21:27:50 +00:00
Luck 251f51b01c add missing messages 2016-12-07 21:20:54 +00:00
Luck 2fba9b83af apply group rewrites to vault - resolves #59 2016-12-07 21:18:57 +00:00
Luck 1c97cb3cec Sponge: Fix migration for subjects with identifiers containing spaces 2016-12-07 21:14:24 +00:00
Luck 25511f898c implement clickable message base - towards #68 2016-12-07 21:08:40 +00:00
Luck d820f153a9 idk 2016-12-06 22:35:06 +00:00
Luck 77b06acad4 declare child states 2016-12-06 21:53:57 +00:00
Luck 6760a96527 Ensure holder state is always declared 2016-12-06 21:48:37 +00:00
Luck 257f426ab9 implement cached state for all permission holders. towards #69 2016-12-06 21:33:55 +00:00
Luck 3771a50f30 cleanup 2016-12-06 19:21:48 +00:00
dracnis 85ee211172 Update VaultChatHook.java
need update as soon as possible.
2016-12-06 19:03:01 +00:00
Luck 1b7a66b41a Fix #66 2016-12-04 23:09:12 +00:00
Luck 8f9a1aa931 Add verbose pastebin upload functionality - resolves #55 2016-12-03 19:30:25 +00:00
Luck 8b60fd0e55 Sponge: remove spammy user not already loaded message 2016-12-03 14:11:53 +00:00
Luck cd7b3b4f6e Fix compat with older guava versions 2016-12-03 13:55:51 +00:00
Luck 83b0f62d59 Implement full caching for non user/group subjects 2016-12-03 13:26:17 +00:00
Luck dd3a78ada8 Fix #65 2016-12-03 11:08:47 +00:00
Luck 307e2b889c Changes for version 2.16 2016-12-02 20:20:31 +00:00
Luck a063f7664d Fix #54 - getPermissionValue not checking default user 2016-12-02 17:26:38 +00:00
Luck b1ab857592 Merge remote-tracking branch 'origin/master' 2016-12-02 17:21:10 +00:00
Luck 2b8bbc434f WIP: Sponge service refactor 2016-12-02 17:20:36 +00:00
Luck c6878c27b9 Fix Vault #setPrefix method 2016-11-30 21:43:10 +00:00
Luck 02ff4a4acb cleanup 2016-11-29 23:35:25 +00:00
Luck 23f757e916 fix formatting 2016-11-28 21:50:19 +00:00
Luck f0ababa409 Maybe fix lilypad uuid retrieval 2016-11-28 21:39:10 +00:00
Luck 331ff341f3 Fix autoop 2016-11-28 20:11:10 +00:00
Luck 793a84edfb Sponge: replace MemorySubjectData with own implementation 2016-11-26 17:19:04 +00:00
Luck 2893d4aebd Silence InterruptedException when the plugin disables 2016-11-26 13:21:21 +00:00
Luck b7ac7680d9 Fix NPE 2016-11-25 21:19:12 +00:00
Luck 18dd59ed0f Refactor Sponge subject handling 2016-11-25 20:59:28 +00:00
Luck 443906da55 Refactor managers 2016-11-25 18:28:10 +00:00
Luck a9f29da4f8 Fix potential memory leak 2016-11-24 21:59:48 +00:00
Luck cf456cff81 Implement tab completion for permissions 2016-11-24 19:07:01 +00:00
Luck 69b3c96e09 Fix Sponge subject data permission overrides 2016-11-23 22:17:49 +00:00
Luck 61eb86b3a0 Fix Sponge defaults serialization 2016-11-23 21:44:59 +00:00
Luck f0ad32bc37 Change PermissionService handling 2016-11-22 21:57:51 +00:00
Luck aeeb2820f9 Sponge: also migrate defaults 2016-11-22 21:14:43 +00:00
Luck 2d88405d69 Fix onLateEnable always being fired 2016-11-22 20:42:43 +00:00
Luck f32ed5db89 Fix Sponge PEX migration 2016-11-22 20:39:56 +00:00
Luck f1606ac51b API changes for 2.15 2016-11-22 18:27:40 +00:00
Luck d13eb1a55d Fix default assignments never being applied on Bungee 2016-11-21 18:26:37 +00:00
Luck 384fbf5464 Revert: Use faster wildcard parsing method 2016-11-21 17:07:13 +00:00
Luck 4874f9d051 Use faster wildcard parsing method 2016-11-20 20:41:39 +00:00
Luck 51732fa660 Rearrange some packages, general cleanup 2016-11-20 13:44:36 +00:00
Luck bb25632178 Improve info command 2016-11-19 21:56:11 +00:00
Luck 9a2cf82623 Improve user info command 2016-11-19 17:52:39 +00:00
Luck c0734fc29e refactor contexts slightly 2016-11-18 22:39:00 +00:00
Luck c60067e733 Maybe fix zPerms migration & tidy up shorthand parser 2016-11-17 22:02:47 +00:00
Luck 6293634e36 refactor shorthand nodes 2016-11-17 20:50:37 +00:00
Luck a047695a84 Fix issue with nodes never being removed on sync with flatfile storage types 2016-11-17 19:01:58 +00:00
Luck db9d84ed76 Maybe fix issue with corrupted permission migration 2016-11-15 20:18:32 +00:00
Luck e296b1df60 Fix migration commands never being executed 2016-11-15 18:17:35 +00:00
Luck b72e5f5437 Update plugin.yml to make LuckPerms always enable before Vault 2016-11-14 22:50:11 +00:00
Luck de09ae94b8 Fix Vault hook - thanks @Yann151924 2016-11-14 22:32:06 +00:00
Luck b36a33f015 Make meta info command show where meta was inherited from 2016-11-14 20:40:33 +00:00
Luck d95891256b Setup a users calculated data when loaded by the SubjectCollection 2016-11-14 18:55:10 +00:00
Luck 9c8097ecb9 Sponge: Implement support for editing more than just users/groups with commands 2016-11-14 18:45:48 +00:00
Luck 18a3dfd604 cleanup 2016-11-13 19:30:46 +00:00
Luck 59fd337e44 remove debug messages, woops 2016-11-13 11:12:06 +00:00
Luck 696cd235fd Fix meta serialization. Resolves #41 2016-11-13 11:09:57 +00:00
Luck 59c7efccb2 Fix Sponge plugin guice load failure. Thanks @gravityfox 2016-11-13 09:44:34 +00:00
Luck b031ebbffd Update readme 2016-11-12 17:27:15 +00:00
Luck 67415babc2 Fix javadocs & fix compile 2016-11-12 16:25:44 +00:00
Luck 563dd4683d Changes for & release of API 2.14 2016-11-12 14:10:42 +00:00
Luck e9131f729a add methods for older sponge api versions 2016-11-11 22:54:09 +00:00
Luck c4ea626e33 Fix PM migration 2016-11-11 20:43:05 +00:00
Luck fefba7976b Actually register new migration command 2016-11-11 20:35:11 +00:00
Luck 2ce8555692 Add Sponge PermissionManager migration support 2016-11-11 20:31:42 +00:00
Luck 9fe9c386bb Sponge: rely less on dummy subjects 2016-11-11 19:32:25 +00:00
Luck e8cd2c7548 More command refactors 2016-11-10 22:13:53 +00:00
Luck 158d8b086a Command refactor 2016-11-10 19:19:43 +00:00
Luck 1c534d7475 More cleanup 2016-11-08 20:46:29 +00:00
Luck 90f8dbe243 Refactor commands 2016-11-07 22:02:48 +00:00
Luck 0c33b26fa9 Refactor meta accumulation 2016-11-07 19:01:15 +00:00
Luck d320679f69 Implement proper meta inheritance handling 2016-11-07 17:32:17 +00:00
Luck 8d5398b5a3 Make nodes with more contexts take priority over nodes with less 2016-11-06 16:15:45 +00:00
Luck 6cd8593fa5 Fix vault primary group override feature 2016-11-06 15:11:28 +00:00
Luck 5ebbc178a5 Remove messenger system & more cleanup 2016-11-06 14:56:13 +00:00
Luck 4f6e229943 Small cleanup 2016-11-05 23:23:08 +00:00
Luck 3e846d9527 Maybe fix split storage - closes #38 2016-11-05 21:43:48 +00:00
Luck 981d745b74 Fix verbose system 2016-11-05 19:19:29 +00:00
Luck 2dd0858960 Allow multiple verbose filters 2016-11-05 19:01:06 +00:00
Luck f72819a664 Try to reduce contention in PermissionHolder 2016-11-05 17:49:52 +00:00
Luck 5361b1e87b Implement group weights 2016-11-05 09:04:26 +00:00
Luck e15d03ed4e Fix parents being cleared on promote/demote 2016-11-05 07:53:18 +00:00
Luck 6c9041ce40 Improve meta info command 2016-11-04 19:13:39 +00:00
Luck 8da96e6e48 Re-add showtracks/showpos commands 2016-11-04 18:36:32 +00:00
Luck 385aa6d438 Add set "none" command as an alternative to unset 2016-11-04 16:40:55 +00:00
Luck 79f24a5944 Improve track functionality. Resolves #39 2016-11-01 21:34:54 +00:00
Luck 80570717f9 Fix slow datastore performance when using the API 2016-11-01 19:41:40 +00:00
Luck ebab79c4ca Maybe fix blocking issue with #getPermissions 2016-11-01 19:38:08 +00:00
Luck 42882ebe11 Update some ugly messages 2016-10-31 22:25:42 +00:00
Luck d2de26f765 Move hasperm/inheritsperm commands & add parent set command. Resolves #40 2016-10-31 19:27:04 +00:00
Luck e2cebfbd16 Refactor Node class 2016-10-31 18:18:31 +00:00
Luck a58cc6bdf3 Refactor PermissionHolder 2016-10-30 21:29:14 +00:00
Luck 36bc1553c0 Implement Sponge timings 2016-10-30 19:35:11 +00:00
Luck 17b06c39e9 Ignore negated primary group override nodes & fix broken message 2016-10-30 15:29:55 +00:00
Luck ba2f6eb7be Update .gitignore 2016-10-30 13:37:25 +00:00
Luck b93145f26d Change some listener priorities 2016-10-30 13:23:45 +00:00
Luck e88ea9c13d Don't fully unload Sponge user subjects 2016-10-30 13:21:43 +00:00
Luck 1275d0023d Listen to PlayerQuit on monitor priority 2016-10-29 22:58:06 +01:00
Luck 27f6f225c9 whoops 2016-10-29 21:56:55 +01:00
Luck 41362aa34a Use a temporary executor until the bukkit one has started 2016-10-29 21:54:13 +01:00
Luck a99609e016 Don't wrap buffer tasks in scheduler calls 2016-10-29 21:23:30 +01:00
Luck c0ea2d8ec3 Fix data not being loaded sync when the plugin starts 2016-10-29 21:14:59 +01:00
Luck bb6b31d715 change Sponge listener priorities 2016-10-29 21:12:55 +01:00
Luck 21695dd2cb Implement support for Bukkit child permissions 2016-10-28 19:16:32 +01:00
Luck 531835c948 Fix GroupManager primary group migration 2016-10-28 18:00:18 +01:00
Luck 77e3b351fd Fix GroupManager user migration 2016-10-28 17:58:36 +01:00
Luck 66f756575a Remove redundant config option 2016-10-27 18:48:38 +01:00
Luck 7acc8bc7ed Add verbose command 2016-10-27 17:46:44 +01:00
Luck 0a4d337a53 Cache context lookups & refactor Sponge subjects 2016-10-27 16:32:14 +01:00
Luck 0198068a13 Improve permission lookup speed (slightly) 2016-10-26 21:35:44 +01:00
Luck 1c15f8462f Don't run commands through the buffer system 2016-10-26 19:52:03 +01:00
Luck 3929ce0dfc Fix compile 2016-10-26 19:32:41 +01:00
Luck 7deeaf305d Experimental: Run I/O after commands in a new thread 2016-10-26 17:55:38 +01:00
Luck 0f04c06e13 Remove redundant method 2016-10-26 17:19:56 +01:00
Luck d1863fa714 Implement more customizable primary groups 2016-10-26 17:19:33 +01:00
Luck 46b122a167 Fix memory leak preventing users from being unloaded 2016-10-25 18:44:11 +01:00
Luck ee3db1e5c5 Maybe fix GroupManager primary group migration 2016-10-25 15:02:49 +01:00
Luck bd830617c9 Small cleanup 2016-10-25 11:14:56 +01:00
Luck a9b6493091 A few small optimizations 2016-10-24 18:48:39 +01:00
Luck 9894e45516 Fix issue with Vault lookups not being preprocessed 2016-10-24 15:57:05 +01:00
Luck 2cfc82f3aa Implement support for instant data propagation with Redis 2016-10-24 14:38:12 +01:00
Luck bb9eab0989 Lower sync wait buffer & fix export command 2016-10-24 13:02:26 +01:00
Luck dc87ec1c82 Update placeholder expansion 2016-10-24 09:57:29 +01:00
Luck 98b7b65ce7 Remove PEX dependency 2016-10-24 09:22:53 +01:00
Luck 9f8f32b33e Fix suffixes not being applied 2016-10-23 22:02:48 +01:00
Luck a80ec6d893 Implement PermissionsEx 2.0 migration for Sponge 2016-10-23 20:42:58 +01:00
Luck 4d85930f5a Refactor migration classes 2016-10-23 20:42:25 +01:00
Luck f722f4112d Update default-lang.yml 2016-10-23 17:59:34 +01:00
Luck 383276f47a Refactor contexts, expose cached data in the API & release 2.13 2016-10-23 16:46:53 +01:00
Luck 33c78e4a17 Use LoadingCache instead of a regular map + more datastore fixes 2016-10-22 20:39:26 +01:00
Luck 55a0de7899 Lower buffer time to 1 second. Should resolve any issues with changes being overridden. (related: #32) 2016-10-22 18:52:51 +01:00
Luck 6b3aab66bf Fix some #saveX methods being waited for, when they can just be ran async 2016-10-22 09:35:11 +01:00
Luck 77e70ef8d3 Fix deadlocks caused by waiting for async operations to complete before the scheduler has started 2016-10-22 09:21:30 +01:00
Luck 9b92143501 prevent logins until the plugin has started 2016-10-22 00:07:30 +01:00
Luck 87f94f6b8f add started value to bukkit plugin 2016-10-22 00:05:33 +01:00
Luck 5d955e77b6 Make the max pool size configurable 2016-10-21 22:22:06 +01:00
Luck 270a276b98 Refactor SQL storage to not hold onto connections for as long 2016-10-21 22:07:14 +01:00
Luck be7d914e39 Finish the buffering refactor - still WIP. Towards #32 2016-10-21 18:34:53 +01:00
Luck 37fc00cce8 Refactoring storage - WIP. Towards #32 2016-10-20 21:55:34 +01:00
Luck 0d515abadb Cleanup some bad code in SQLDatastore. Might help #32 2016-10-19 23:30:30 +01:00
Luck daef01194e Shade MySQL connector into Sponge jar. Resolves #31 2016-10-19 22:23:43 +01:00
Luck 258bf1cc41 small cleanup 2016-10-19 20:57:53 +01:00
Luck ce3d7829d7 Update internal permissions to match the new command layouts 2016-10-19 20:14:16 +01:00
Luck c66a01c1a6 Fix temporary permission expirations never persisting. Fixes #30 2016-10-19 17:37:26 +01:00
Luck d113a92ce5 Cleanup permission calculation 2016-10-18 20:48:59 +01:00
Luck 7b655d12df Add set-primary-group option to the default assignments 2016-10-17 18:23:41 +01:00
Luck a4c872f1e8 Fix per-world permissions not working until a user switches worlds 2016-10-17 17:10:02 +01:00
Luck 0e7d9bf9c1 Bump hikari version 2016-10-16 21:05:25 +01:00
Luck 6252a5bc75 Fix invalid property 2016-10-16 20:53:12 +01:00
Luck e4e80c9c31 Update to SpongeAPI 5.0.0 release 2016-10-16 18:13:55 +01:00
Luck 165c5610c3 Add extra Hikari flag 2016-10-16 17:24:02 +01:00
Luck 13fbc7dd39 Implement default assignment system (#25) 2016-10-16 13:58:57 +01:00
Luck 02a75fc32a Reimplement autoop on Bukkit & other misc fixes 2016-10-15 21:04:04 +01:00
Luck 699c4d107b Swap the javaassist maven plugin with a better method 2016-10-15 08:59:49 +01:00
Luck e4810302e1 Implement meta / Sponge option commands & fix meta caching system. Fully resolves #23 2016-10-14 22:49:32 +01:00
Luck 73f10cad66 Make the recent command changes backwards compatible 2016-10-14 20:42:00 +01:00
Luck f1d670dc46 refactor permission commands 2016-10-14 19:55:22 +01:00
Luck 045539c752 refactor inheritance commands 2016-10-14 19:19:57 +01:00
Luck 782c09b686 Refine bulk group edit primary group check 2016-10-13 21:29:30 +01:00
Luck 6109718c67 Cleanup some remaining TODOs 2016-10-13 21:16:34 +01:00
Luck cd758d7e48 Bump minor version 2016-10-13 20:40:09 +01:00
Luck fcb0fcadeb Fix StackOverflowException 2016-10-13 20:36:08 +01:00
Luck 26fb506560 Reorganize packages 2016-10-13 20:07:10 +01:00
Luck b6c4239322 Fix NPE 2016-10-13 19:43:48 +01:00
Luck 74f9283f18 Silence exception on #giveDefaultIfNeeded. Resolves #26 2016-10-13 19:25:31 +01:00
Luck 60e6ae6e23 Fix Sponge implementation, remove standalone module 2016-10-13 19:13:34 +01:00
Luck 83d9229295 Refactor caching system (WIP) - still working towards #23 2016-10-12 21:57:57 +01:00
Luck e079b0f3ed Fix meta command showing when a user doesn't have permission to use it 2016-10-11 21:17:04 +01:00
Luck d433a5461d Refactor meta commands, working towards #23 2016-10-11 21:12:10 +01:00
Luck 2c43f6bf21 Fix global permissions and groups sometimes not applying 2016-10-11 19:31:55 +01:00
Luck ac57509a29 Fix prefix/suffix priorities being ignored 2016-10-11 19:31:26 +01:00
Luck c5ce655cf6 Add Vault chat debug messages 2016-10-11 19:06:18 +01:00
Luck 9fe05efb4e Don't force the default group 2016-10-11 18:54:42 +01:00
Luck dcf207f5e5 Fix exception, resolves #20 and #22 2016-10-10 22:39:24 +01:00
Luck 11facab71c Fix NPE, resolves #19 2016-10-10 22:26:39 +01:00
Luck 5b4975f34c Implement persisting subjects (+ defaults) 2016-10-10 18:58:43 +01:00
Luck 069e535f1a Avoid odd behavior where Sponge prevents User subjects from being GCed 2016-10-09 21:34:05 +01:00
Luck 1eb053447e Make refresh calls in SpongeListener run async 2016-10-09 20:49:17 +01:00
Luck 93c7c06b2d Cleanup some Sponge subject classes 2016-10-09 13:14:58 +01:00
Luck b0085bc1e1 Update readme 2016-10-09 10:58:14 +01:00
Luck 9133951446 I'm dumb 2016-10-08 16:45:18 +01:00
Luck 7853d4686a Fix NPE with LPPermissibles & refreshing users 2016-10-08 16:43:57 +01:00
Luck ed5892eb56 add option to ignore vault world parameters 2016-10-08 15:01:54 +01:00
Luck 687804de2c small change to BukkitConfig 2016-10-08 09:05:48 +01:00
Luck 9d166041ab Account for inheritance and wildcards in SimpleSubject 2016-10-07 18:11:59 +01:00
Luck 924041bff4 Add server and world args to clear command, and add clearmeta command 2016-10-06 21:23:27 +01:00
Luck e9216d3e0f Allow the prefix to be modified by the lang file 2016-10-06 19:54:52 +01:00
Luck db8f1bca66 Fix API javadoc & fix Bukkit legacy build 2016-10-06 17:21:04 +01:00
Luck 2429831153 API changes for 2.11 2016-10-05 21:40:54 +01:00
Luck 80d2246634 Fix exporting users not in the default group 2016-10-04 20:48:58 +01:00
Luck 56df2477ca Fix UnsupportedOperationExceptions with #getPermissions 2016-10-04 17:30:27 +01:00
Luck 9b4384dc33 Revert: Merge dummy implementations 2016-10-04 17:15:10 +01:00
Luck bc65857831 Fix CME 2016-10-04 17:13:32 +01:00
Luck de462d2385 Merge dummy implementations 2016-10-04 16:58:54 +01:00
Luck 90150428be Inject a dummy on quit instead of a real PermBase instance 2016-10-04 16:19:41 +01:00
Luck 2a7f951f4f Fix NPE / crash on player quit 2016-10-04 16:10:06 +01:00
Luck 82789328c1 Pre-process permissions and apply immediately on login events 2016-10-04 14:57:00 +01:00
Luck 13bccd1d3f Fix users not receiving permission updates 2016-10-03 21:41:47 +01:00
Luck 43c514132d Cache node deserialization 2016-10-03 21:18:59 +01:00
Luck 9e0fdcbfee Fix memory leak, woops 2016-10-03 20:43:36 +01:00
Luck 008dc3fc52 Move some classes around 2016-10-03 20:42:11 +01:00
Luck 9fde237d9b Swap slow get method 2016-10-03 19:53:43 +01:00
Luck d626c08b4c Small fix for #getAllWithPermission 2016-10-03 16:45:52 +01:00
Luck 58e223e74b Implement bulk prefix/suffix removal 2016-10-02 21:17:59 +01:00
Luck 1da1df156e Fix issues related to Node comparisons 2016-10-02 15:44:46 +01:00
Luck 3442372281 Cleanup random debug messages 2016-10-02 15:43:44 +01:00
Luck 1b3b50c113 Refactor PermissionHolder & Sponge subjects 2016-10-02 15:05:53 +01:00
Luck 18e126b781 Fix issue with permissions sometimes not being removed 2016-10-02 10:33:58 +01:00
Luck c88600adda Make User constructor protected. Closes #18. 2016-10-01 22:56:57 +01:00
Luck 4787361e66 Implement locks to hopefully resolve race conditions with I/O - experimental 2016-10-01 19:03:05 +01:00
Luck b5ece8b5bd Fix exception 2016-09-30 22:26:39 +01:00
Luck 7ee3116f29 Maybe fix broken inheritance 2016-09-30 20:43:08 +01:00
Luck 1fc0d77971 Cache & fix (and maybe break) Vault Chat implementation 2016-09-30 20:08:59 +01:00
Luck a32ab4bf7f Show where a permission was inherited from in the inheritsperm command 2016-09-30 19:21:19 +01:00
Luck 2d8083bf18 Another Vault fix & cleanup User / Group classes 2016-09-30 17:45:29 +01:00
Luck 63b9be9845 Change Vault behavior & cleanup Node class 2016-09-30 17:09:19 +01:00
Luck 85a83d8c71 Add logging output to Vault 2016-09-29 22:04:46 +01:00
Luck 71b33a296c Calculate Sponge defaults using context 2016-09-29 20:38:03 +01:00
Luck becdfd6f03 Silence subject load errors unless debug-permission-checks is true 2016-09-29 20:02:38 +01:00
Luck 41744f9416 Add clone commands 2016-09-29 18:07:41 +01:00
Luck cb89a92ba9 Message colour changes and standardization 2016-09-28 21:16:07 +01:00
Luck 93d54373c6 Add detailed command info system 2016-09-28 20:59:08 +01:00
Luck 385addfe08 cleanup 2016-09-27 20:21:13 +01:00
Luck 4c21957b04 Cache Vault lookups & properly sort listnodes output 2016-09-27 20:18:06 +01:00
Luck ab6b011225 Fix permission lookups being case sensitive 2016-09-26 18:52:01 +01:00
Luck e72d91503c Maybe nicer looking messages 2016-09-26 18:42:46 +01:00
Luck b9ee206908 Add some more bulk edit commands 2016-09-25 21:23:48 +01:00
Luck 4c9abba5fa Maybe fix vault (again) 2016-09-25 19:26:36 +01:00
Luck 3424b0542a Release 2.10 2016-09-25 17:32:58 +01:00
Luck fec90b8958 Add bulkchange commands 2016-09-25 17:29:11 +01:00
Luck 4da7fe4ff9 Small fixes to context system 2016-09-25 16:55:14 +01:00
Luck c53623dd67 Make command usage output easier to read 2016-09-25 14:34:27 +01:00
Luck 6540ffa4dd Refactor storage 2016-09-25 12:47:15 +01:00
Luck 5ee6db02ff Proper context implementation - WIP 2016-09-25 10:19:36 +01:00
Luck d8221f466a Fix messages not being formatted correctly 2016-09-24 17:22:33 +01:00
Luck 462bea2a09 Remove broken repo, maybe fix build 2016-09-24 16:58:45 +01:00
Luck f452a97278 fix typo 2016-09-23 22:19:17 +01:00
Luck eb9d2be587 Add locale file support 2016-09-23 22:14:40 +01:00
Luck df1e747861 Add commands to view inherited groups 2016-09-23 19:23:31 +01:00
Luck f48595b1ff Add world and group name rewriting, refactor configs 2016-09-23 18:58:19 +01:00
Luck 12cd4e19cb Update config comments 2016-09-22 18:25:49 +01:00
Luck a195e94522 Calculate defaults after all plugins have loaded 2016-09-22 17:34:51 +01:00
Luck 02abb39dc2 Change #isPermissionSet to be more like the Bukkit impl 2016-09-21 22:04:18 +01:00
Luck f7a0b1ef78 Refactor default permissions to be less bad 2016-09-21 21:30:42 +01:00
Luck 7678f25879 Fix default permissions not properly applying on Bukkit 2016-09-21 17:40:05 +01:00
Luck fa9324bda8 Implement basic standalone base, working towards #9 2016-09-20 21:50:28 +01:00
Luck 1e72f9d8fe Listen on lowest priority, may fix issues with plugins checking for permissions on login events 2016-09-20 21:04:53 +01:00
Luck 50fd954599 Use a BiMap in UuidCache 2016-09-19 21:13:45 +01:00
Luck b1e34b55f8 Re-add regex permissions & actually take note of the config options 2016-09-19 21:00:23 +01:00
Luck cff1b8a411 Separate PermissionProcessor into own class 2016-09-19 20:45:37 +01:00
Luck 6ffa6720be Make more specific wildcards take priority over less specific ones 2016-09-19 20:36:52 +01:00
Luck f52a106165 Order nodes alphabetically after other priority rules have been applied 2016-09-19 17:31:00 +01:00
Luck bf247b71e1 Fix possible race condition & maybe use better Hikari flags 2016-09-18 23:13:20 +01:00
Luck 66818e4c82 Fix build 2016-09-17 23:46:11 +01:00
Luck 23d53d39b4 Refactor permission calculation 2016-09-17 23:15:07 +01:00
Luck 30ea5a5b69 Fix no permissions applying when include-global is false, and better support per-server/per-world groups 2016-09-17 19:05:56 +01:00
Luck e7a210dc06 Update default configs 2016-09-16 22:09:55 +01:00
Luck 497de9824a Actually pass on a single wildcard node so it gets applied 2016-09-16 21:46:55 +01:00
Luck be74b50762 Fixes for offline mode servers 2016-09-16 21:24:25 +01:00
Luck f2e06b56e7 Cache permission lookups 2016-09-16 21:11:12 +01:00
Luck f6aa20c300 Fix compile 2016-09-15 17:12:19 +01:00
Luck 5e16134f6f Provide prefixes and suffixes through the PS options 2016-09-15 17:06:27 +01:00
Luck 6165fcbb21 Fix #getDefaults for users 2016-09-15 16:54:12 +01:00
Luck 831e882db0 Actually apply default permissions on Sponge 2016-09-15 16:53:03 +01:00
Luck feb8bf4bd3 Update readme 2016-09-14 20:16:36 +01:00
Luck ce3ee866ca Sponge fixes 2016-09-14 19:37:20 +01:00
Luck d29dd35689 Support the latest powerfulperms so-called "api" 2016-09-13 20:14:16 +01:00
Luck 3a0a89853f Apply negated wildcards 2016-09-13 17:23:16 +01:00
Luck e7ca79d251 Use Splitter instead of Patterns, don't split arguments in quotes 2016-09-12 19:00:37 +01:00
Luck 22426bab33 Update placeholders to use the latest API version 2016-09-11 15:36:19 +01:00
Luck 116094ea96 Maybe fix an issue with per-server prefixes/suffixes 2016-09-11 14:34:38 +01:00
Luck 9df39a9545 Inject PermissibleBase instead of using attachments. Resolves #14 2016-09-11 11:50:59 +01:00
Luck b8f44df723 Add missing headers 2016-09-10 22:40:36 +01:00
Luck 74f275eb69 Add more info the importer error output 2016-09-10 22:08:07 +01:00
Luck 1142cbcb2c Add platform type to the info command 2016-09-10 21:54:31 +01:00
Luck 37749e5829 Don't apply the default group when exporting users 2016-09-10 16:53:04 +01:00
Luck f9025c7a51 fix #getUniqueUsers for SQL storage types 2016-09-10 16:38:37 +01:00
Luck c7bfc38477 Build an extra jar with guava and gson shaded to support 1.7 2016-09-10 16:32:37 +01:00
Luck 7ca394d7b9 Add some extra console output to the debug command 2016-09-10 14:35:12 +01:00
Luck 31884ea59d Maybe fix race condition with messages not sending 2016-09-10 14:31:42 +01:00
Luck e79b7c7023 Update readme 2016-09-10 09:04:59 +01:00
Luck 1fdb4e8ade Merge pull request #11 from HeroCC/patch-1
Fix PermissionsEx false node migration
2016-09-09 21:49:43 +01:00
HeroCC 53db8c5928 Fix PermissionsEx false node migration
PermissionsEx false nodes begin with a '-' not a '!'
2016-09-09 16:39:13 -04:00
Luck 07514000a4 Fix global groups not being migrated from GroupManager 2016-09-09 18:41:15 +01:00
Luck f28721e55a Possible fix for permissions not applying on BungeeCord 2016-09-09 18:32:50 +01:00
Luck fc230291d3 Fix ops not receiving all permission nodes 2016-09-09 18:00:38 +01:00
Luck 89ff4cfa40 Add a much better system for exporting data 2016-09-08 21:01:37 +01:00
Luck d786b6abb2 Fix removing negative nodes 2016-09-08 17:28:31 +01:00
Luck fb0e694155 Add auto-op. Closes #8 2016-09-07 23:21:24 +01:00
Luck cd6cac1fb6 Fix bad grammar in config option comment 2016-09-07 21:01:03 +01:00
Luck ea07f05097 Release 2.8 2016-09-07 20:53:33 +01:00
Luck d84767af68 Fix blank users not receiving group permission updates 2016-09-06 22:28:37 +01:00
Luck aab73a8d81 Add more shorthand nodes 2016-09-06 22:27:46 +01:00
Luck 995fc2ccd8 Bump internal release version and add missing javadoc 2016-09-05 20:06:41 +01:00
Luck 60bcd5f643 Release 2.7 2016-09-05 20:00:01 +01:00
Luck ba04fb320b Remove unnecessary reflection 2016-09-05 16:44:59 +01:00
Luck 770b7dc282 Fix permissions not being removed on Sponge 2016-09-04 17:59:01 +01:00
Luck ed85eee36c Fix inherited permissions not applying on Sponge 2016-09-04 16:25:10 +01:00
Luck 23df8a2df8 Some small fixes 2016-09-04 16:24:36 +01:00
Luck 36cd388607 Slight re-wording 2016-09-03 21:34:35 +01:00
Luck 4d48ef1939 Add comment about Paper's "bungee-online-mode" option. Resolves #6 2016-09-03 21:30:37 +01:00
Luck 7970e2a1c6 Add bPermissions migration 2016-09-03 18:15:52 +01:00
Luck cee96d7daa make SenderFactory nicer & maybe faster 2016-09-03 00:14:40 +01:00
Luck 861c1ddd69 remove #childInit 2016-09-02 19:19:22 +01:00
Luck 5dec5a54cb Add YAML storage support 2016-09-02 19:15:31 +01:00
Luck 5c760aabd4 Fire PermissionRefreshEvent after the nodes have actually updated 2016-09-01 13:00:22 +01:00
Luck 1a2fa5d8c3 Fix log notify 2016-08-31 21:02:06 +01:00
Luck ef0c53da82 fix formatting 2016-08-31 09:38:47 +01:00
Luck 3fd62a80e2 Add support for split storage 2016-08-31 09:30:19 +01:00
Luck 5c19dd8b15 .-. 2016-08-30 22:38:08 +01:00
Luck 1fc88e147f Make output of listnodes nicer 2016-08-30 18:04:30 +01:00
Luck 9b4bbe0500 Make log notifications toggleable 2016-08-30 16:02:01 +01:00
Luck b37fdd3619 Add user to group instead of failing in setprimarygroup command 2016-08-30 13:23:48 +01:00
Luck ab00c41452 Fix NPE, and properly send possible permissions in BukkitUser 2016-08-30 13:06:36 +01:00
Luck c15727377b Apply single '*' wildcard 2016-08-30 12:49:46 +01:00
Luck 1e6f32bdc4 Add extra disallowed character 2016-08-30 11:54:18 +01:00
Luck 42e69c98a7 Change name limitation to be more flexible 2016-08-30 11:52:32 +01:00
Luck a217727bb4 Match negative priorities and fix PEX weight migration 2016-08-30 11:04:34 +01:00
Luck ba10b1c06e Fix removal of temporary nodes 2016-08-30 10:22:55 +01:00
Luck 075ba33e8b Add prefix/suffix/meta commands 2016-08-30 10:22:25 +01:00
Luck 19dbc7d90a formatting pls 2016-08-30 07:47:52 +01:00
Boomclaw ade70bb7ba PEX migration carries weights of prefixes/suffixes of groups and individuals (#5)
* PEX migration carries weights of prefixes/suffixes of groups and individuals.

* Forgot to increase maxGroupWeight.
2016-08-29 22:45:19 +01:00
Luck 4b67913eee getGroup methods should not include inherited groups 2016-08-29 22:03:10 +01:00
Luck 75858c1555 Use new Node system in #getGroups 2016-08-29 21:38:47 +01:00
Luck 659baaf5fb Make #getPlayerGroups return global too 2016-08-29 21:35:11 +01:00
Luck 3c83c578eb Fix typo 2016-08-29 18:40:37 +01:00
Luck 3ddbf1da87 Migrate PEX primary groups 2016-08-29 17:57:47 +01:00
Luck 35cb5b81dc hopefully fix server stopped responding error with SkipListSet 2016-08-29 16:28:36 +01:00
Luck 02d9b996a7 woops 2016-08-29 15:51:19 +01:00
Luck d4cf6a5ad7 Remove subjects from cache when they leave the server 2016-08-29 13:32:21 +01:00
Luck 9fdb4fa25f Maybe fix sponge permissions not expiring 2016-08-29 13:02:56 +01:00
Luck d5bc1cdf5d Fix not clearing user's permissions, and issue with unsetting permissions 2016-08-29 12:53:05 +01:00
Luck f5995c0afa Fix usernames showing as "null" and NPE related to primaryGroup not copying correctly 2016-08-29 12:11:03 +01:00
Luck 2cc65160b4 Bump release version 2016-08-28 22:12:34 +01:00
Luck 57f5a7c4cd Release 1.6 2016-08-28 22:05:10 +01:00
Luck 6aea3b53f3 Only save unique users 2016-08-28 21:36:16 +01:00
Luck 9f5e194a6e bug fixes 2016-08-28 17:43:02 +01:00
Luck 0831585a27 Fix SQL datastore 2016-08-28 15:43:21 +01:00
Luck b2cf6dce2d Prepare for 1.6 release 2016-08-28 15:29:02 +01:00
Luck a3ebf86f6b More progress towards 1.6: implement PermissionService 2016-08-28 14:57:03 +01:00
Luck 2a305b1c55 More progress towards 1.6: add transient permissions 2016-08-27 22:01:17 +01:00
Luck 2ea9b36c77 Build against Sponge API 5.0.0 2016-08-27 16:59:00 +01:00
Luck edaf174ebf Complete refactor of permissions/nodes. progress towards 1.6 2016-08-27 00:32:39 +01:00
Luck c4497db06c progress towards permissionservice 2016-08-26 16:58:47 +01:00
Luck 9873415303 Fix NPE 2016-08-25 18:07:50 +01:00
Luck 2b71476cfe Implement ConsecutiveExecutor 2016-08-25 18:07:32 +01:00
Luck 44d14001e1 Partially implement PermissionService 2016-08-25 17:23:27 +01:00
Luck de5fda6a18 Add some extra debugging output to PP migration 2016-08-25 01:31:38 +01:00
Luck 8b83a1d9a2 Fix sponge startup exception 2016-08-24 22:38:52 +01:00
Luck c0a0239eeb Update readme 2016-08-24 10:24:37 +01:00
Luck 84f377451e Make placeholder identifier lowercase 2016-08-23 20:11:53 +01:00
Luck 21d0c9ab0e Add some PlaceholderAPI placeholders 2016-08-23 19:32:58 +01:00
Luck f9c1cdb4bd Add group and track rename commands 2016-08-23 15:52:51 +01:00
Luck e89444141b Add logging for the migration processes 2016-08-23 15:18:20 +01:00
Luck 9cd4e01d8e Copy prefixes and suffixes during migration processes 2016-08-23 12:36:20 +01:00
Luck f7fa08d5e9 Call #recalculatePermissions on the main thread 2016-08-23 12:10:11 +01:00
Luck 7a4135319f Convert PermissionAttachment to use ConcurrentMap, and do refreshPermissions async 2016-08-22 22:39:40 +01:00
Luck 41fca40a36 Add some null / arg checks to Vault chat impl 2016-08-22 21:12:42 +01:00
Luck 9dbfa76b26 Add Vault chat support using permission nodes 2016-08-22 20:59:52 +01:00
Luck 20eeade06f Migration for BungeePerms 2016-08-22 19:46:37 +01:00
Luck cd9f18ffdb Properly close DB objects once PP migration is complete 2016-08-22 17:01:41 +01:00
Luck f7baf67985 Improvements to the JavaDocs in the API 2016-08-22 15:50:20 +01:00
Luck 692bf30cf5 Attempt to fix PermissionsEx migration 2016-08-22 07:07:13 +01:00
Luck 41b33fbd7a Fix typo 2016-08-22 00:22:06 +01:00
Luck 5dc551c05d Complete the migration system 2016-08-21 23:31:38 +01:00
Luck dd7aee9d15 Partially add migration support 2016-08-21 22:20:14 +01:00
Luck bbeed1e4ed A few small fixes 2016-08-20 17:49:23 +01:00
Luck 471084a9ef Fix NPE 2016-08-20 16:29:59 +01:00
Luck 6fc00976a0 Fire PermRefreshEvent in sponge too 2016-08-20 16:26:32 +01:00
Luck 4aa753515d Add events 2016-08-20 15:43:54 +01:00
Luck 7e933966cf revert remove sources 2016-08-20 02:19:03 +01:00
Luck b4d179f7b2 use a proper repo instead of the rubbish jenkins one 2016-08-20 01:39:19 +01:00
Luck a51acdbc88 remove sources 2016-08-19 22:23:28 +01:00
Luck 52e63a228d Update readme 2016-08-19 21:54:40 +01:00
Luck 9424d2d2ba Process shorthand in server/world names 2016-08-19 19:36:04 +01:00
Luck 0c12eebe6f Check temporary permissions separately to the sync task 2016-08-19 19:10:36 +01:00
872 changed files with 90117 additions and 18403 deletions

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
github: lucko
patreon: luckdev
+74 -34
View File
@@ -1,37 +1,77 @@
# built application files
*.jar
# Java class files
*.class
# Local configuration file (sdk path, etc)
logs/
# Eclipse project files
.classpath
.project
# Intellij project files
*.iml
*.ipr
*.iws
.idea/
# Gradle
.gradletasknamecache
### Gradle & IntelliJ ###
.gradle/
/.idea/
build/
bin/
gradle/
gradlew*
out/
run/
*.iml
.idea_modules/
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
.externalToolBuilders/
*.launch
.factorypath
.recommenders/
.apt_generated/
.project
.classpath
### Linux ###
*~
.fuse_hidden*
.directory
.Trash-*
.nfs*
### macOS ###
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
*.stackdump
[Dd]esktop.ini
$RECYCLE.BIN/
*.lnk
+26
View File
@@ -0,0 +1,26 @@
### :speech_balloon: Looking for support?
Details about support for the project can be found [here, on the Wiki Homepage](https://github.com/lucko/LuckPerms/wiki#support).
### :bug: Reporting bugs?
Before reporting a bug or issue, please make sure that the issue is actually being caused by or related to LuckPerms. We get a lot of reports which are caused by other software - please double check!
If you're unsure, feel free to ask using the above resources BEFORE making a report.
Bugs or issues should be reported using the [GitHub Issues tab](https://github.com/lucko/LuckPerms/issues).
### :pencil: Want to contribute code?
#### Pull Requests
If you make any changes or improvements to the plugin which you think would be beneficial to others, 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). Generally, try to copy the style of code found in the class you're editing.
If you're considering submitting a substantial pull request, please open an issue so we can discuss the change before starting work on the contribution. Most pull requests are happily accepted, but larger changes may have an inpact on the maintainability of the project, and require more consideration.
#### Project Layout
The project is split up into a few seperate modules.
* **API** - The public, semantically versioned API used by other plugins wishing to integrate with and retrieve data from LuckPerms. This module (for the most part) does not contain any implementation itself, and is provided by the plugin.
* **Common** - The common module contains most of the code which implements the respective LuckPerms plugins. This abstract module reduces duplicated code throughout the project.
* **Bukkit, BungeeCord, Sponge, Nukkit & Velocity** - Each use the common module to implement plugins on the respective server platforms.
+22
View File
@@ -0,0 +1,22 @@
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
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+3 -2
View File
@@ -1,6 +1,7 @@
MIT License
Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
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
@@ -18,4 +19,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
+33 -237
View File
@@ -1,254 +1,50 @@
# LuckPerms [![Build Status](https://ci.lucko.me/job/LuckPerms/badge/icon)](https://ci.lucko.me/job/LuckPerms/)
A permissions implementation for Bukkit/Spigot, BungeeCord and Sponge.
![alt text](https://i.imgur.com/ToguFkQ.png "Banner")
# LuckPerms
[![Build Status](https://ci.lucko.me/job/LuckPerms/badge/icon)](https://ci.lucko.me/job/LuckPerms/)
[![javadoc](https://javadoc.io/badge2/net.luckperms/api/javadoc.svg)](https://javadoc.io/doc/net.luckperms/api)
[![Maven Central](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/net/luckperms/api/maven-metadata.xml.svg?label=maven%20central&colorB=brightgreen)](https://search.maven.org/artifact/net.luckperms/api)
[![Discord](https://img.shields.io/discord/241667244927483904.svg?logo=discord&label=)](https://discord.gg/luckperms)
## Links
* **Development Builds** - <https://ci.lucko.me/job/LuckPerms>
* **Javadocs** - <https://jd.lucko.me/LuckPerms>
LuckPerms is an advanced permissions implementation aiming to be a fast, reliable and flexible alternative to existing permission plugins. The project's main goals are centered around high performance and a wide feature set, filling the gaps of functionality and building upon existing features found in other plugins.
## Features
* **Group inheritance** - users can be members of multiple groups, groups can inherit other groups
* **Temporary permissions** - users/groups can be given permissions that expire after a given time
* **Wildcard permissions** - users/groups can be given wildcard permissions (e.g. "minecraft.command.*"), even when plugins haven't implemented their own wildcards.
* **Temporary groups** - users/groups can be added to/inherit other groups temporarily
* **Multi-server support** - data is synced across all servers/platforms
* **Full offline-mode/mixed-mode support** - player permissions are synced properly over offline-mode or mixed online/offline-mode networks.
* **Per-server permissions/groups** - define user/group permissions that only apply on certain servers
* **Per-world permissions/groups** - define user/group permissions that only apply on certain worlds (on BungeeCord, a connected Bukkit/Spigot instance is treated as a world)
* **Tracks / paths / ladders** - users can be promoted/demoted along multiple group tracks
* **Vault Support** - hooks into Vault to integrate with other plugins
* **Developer API** - easily integrate LuckPerms into your own projects
* **Advanced action logging** - keep track of permission changes over time
* **Easily switch between storage systems** - export a log file from one datastore and import it into another
* **Easy and simple setup and configuration using commands** - no editing yml files, yuck
* **Negated permissions and groups** - define special rules for certain users/groups
* **Regex permissions** - define special permissions using regex
* **Shorthand nodes** - add nodes using the LuckPerms shorthand system
* **Full support for UUIDs, even in Offline Mode** - users can change their usernames without losing permissions. In offline mode, a single user has the same internal UUID across a network.
* **Permission data stored within MySQL in a json format** - easily integrate the LuckPerms backend into your other projects
* **Well documented** - API methods have comprehensive Java docs, it's clear what each method does.
* **Efficient/lightweight** - maybe? Who knows, it might be.
* **Open Sourced, Free...** - you shouldn't have to pay $10+ for a "powerful" permissions plugin.
* **BungeeCord compatible** - permissions, users and groups are synced across all LuckPerms instances
* **Sponge compatible** - permissions, users and groups are synced across all LuckPerms instances (bukkit --> sponge, for example)
* **Support for MySQL, MongoDB, SQLite, H2 & Flatfile (JSON)** - other storage methods coming soon (maybe)
LuckPerms also includes an extensive API for developers, and support for a variety of Minecraft server software & data storage options.
## Setup
All configuration options are in the **config.yml/luckperms.conf** file, which is generated automagically when the plugin first starts.
Still not convinced? More information can be found on the wiki, under: [Why LuckPerms?](https://github.com/lucko/LuckPerms/wiki/Why-LuckPerms)
You can define the settings for per-server permissions, the storage method and credentials within this file.
## Useful Links
## Info
### Permission Calculation
#### Permissions are calculated based on a priority system as follows.
The latest **downloads** can be found on the [project's homepage](https://luckperms.net/).
* **Non wildcard/regex permissions will be overridden by normal permissions**
More information about the project & how to use the plugin can be found in the [wiki](https://github.com/lucko/LuckPerms/wiki).
Example: if a user has a true permission set for "luckperms.\*", and a false permission set for "luckperms.something", the non-wildcard permission will override the wildcard, and "luckperms.something" will be set to false, despite the wildcard.
## Building
LuckPerms uses Gradle to handle dependencies & building.
* **More specific wildcards override less specific ones**
#### Requirements
* Java 8 JDK or newer
* Git
Example: if a user has "luckperms.\*" set to true, but "luckperms.user.\*" set to false, all of the user permissions will be set to false, despite the more generic wildcard for "luckperms.*".
* **Temporary permissions will override non-temporary permissions.**
Example: if a user has a false permission set for "test.node", and a temporary true permission set for "test.node", the temporary permission will override the permanent one, and the user will be granted the true node.
* **World specific permissions will override generic permissions.**
Example: if a user has a global "fly.use" permission, and then has a negated "fly.use" permission in the "world_nether" world, the world specific permission will override the globally defined one, and the user will be granted the negated node (provided they're in that world, of course.).
* **Server specific permissions will override generic/global permissions.**
Example: if a user has a global "fly.use" permission, and then has a negated "fly.use" permission on the "factions" server, the server specific permission will override the globally defined one, and the user will be granted the negated node (provided they're on that server).
* **Inherited permissions will be overridden by an objects own permissions.**
Example: A user is a member of the default group, which grants "some.thing.perm", but the users own permissions has "some.thing.perm" set to false. The inherited permission will be overridden by the users own permissions, and the user will be granted the negative node.
### Temporary Permissions
Temporary permissions are checked each time a user/group is loaded, and when the sync task runs. This means if you set a temporary permission to expire after 30 seconds, it won't actually be removed until the sync task runs.
The only way around this is to decrease the sync interval.
### Shorthand Permissions
LuckPerms has it's own system (although it's quite similar to PermissionsEx :P) that allows you to set permissions in a shorthand format.
Using the LuckPerms permission nodes as an example, say for instance, you wanted to let a user set and unset permissions for both groups and users.
Without shorthand, you would have to apply 4 nodes.
```
luckperms.user.setpermission
luckperms.user.unsetpermission
luckperms.group.setpermission
luckperms.group.unsetpermission
```
However, with shorthand, you can just apply the following node:
`luckperms.(user|group).(setpermission|unsetpermission)`
You use brackets to define part of a node as a shorthand group, and then use the vertical bar `|` to separate entries.
There are some limitations, firstly, you cannot use shorthand in the first part of the node. (The "luckperms" part in the example above)
Additionally, you cannot combine shorthand and normal text in the same part of the node.
For example, `luckperms.(user|group).(set|unset)permission` would not work.
### Regex
LuckPerms has support for regex when defining permission nodes and server/world names.
Whenever regex is used, it MUST be prefixed with "R=", so LuckPerms knows to treat it as regex, and not as a normal string.
For example, if you wanted to give all members of the default group, the `essentials.fly` permission on all of your hub servers, where the hub server names are hub1, hub2, hub3, etc.
You would use the command `/perms group default set essentials.fly true R=hub\d+`.
You can also use regex in permission nodes.
Once again using LuckPerms permissions as an example, if you wanted a user to be able to create both groups and tracks, you would normally just add the two permission nodes. However with regex, you can just add one. `luckperms\.create.*` Remember to escape any characters, specifically dots, as the entire node will be parsed.
## API
LuckPerms has an extensive API, allowing for easy integration with other projects. To use the Api, you need to obtain an instance of the `LuckPermsApi` interface. This can be done in a number of ways.
```java
// On all platforms (throws IllegalStateException if the API is not loaded)
final LuckPermsApi api = LuckPerms.getApi();
// Or with Optional
Optional<LuckPermsApi> provider = LuckPerms.getApiSafe();
if (provider.isPresent()) {
final LuckPermsApi api = provider.get();
}
// On Bukkit/Spigot
ServicesManager manager = Bukkit.getServicesManager();
if (manager.isProvidedFor(LuckPermsApi.class)) {
final LuckPermsApi api = manager.getRegistration(LuckPermsApi.class).getProvider();
}
// On Sponge
Optional<LuckPermsApi> provider = Sponge.getServiceManager().provide(LuckPermsApi.class);
if (provider.isPresent()) {
final LuckPermsApi api = provider.get();
}
#### Compiling from source
```sh
git clone https://github.com/lucko/LuckPerms.git
cd LuckPerms/
./gradlew build
```
If you want to use LuckPerms in your onEnable method, you need to add the following to your plugins `plugin.yml`.
```yml
depend: [LuckPerms]
```
All of the available methods can be seen in the various interfaces in the `luckperms-api` module.
You can find the output jars in the `build/libs` directories.
You can add LuckPerms as a Maven dependency by adding the following to your projects `pom.xml`.
````xml
<repositories>
<repository>
<id>luck-repo</id>
<url>https://repo.lucko.me/</url>
</repository>
</repositories>
## Contributing
#### Pull Requests
If you make any changes or improvements to the plugin which you think would be beneficial to others, please consider making a pull request to merge your changes back into the upstream project. (especially if your changes are bug fixes!)
<dependencies>
<dependency>
<groupId>me.lucko.luckperms</groupId>
<artifactId>luckperms-api</artifactId>
<version>2.3</version>
</dependency>
</dependencies>
````
LuckPerms loosely follows the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html). Generally, try to copy the style of code found in the class you're editing.
## Versioning
As of version 2.0, LuckPerms roughly follows the standards set out in Semantic Versioning.
#### Project Layout
The project is split up into a few separate modules.
The only difference is that the patch number is not included anywhere within the pom, and is calculated each build, based upon how may commits have been made since the last tag. (A new tag is made every minor version)
This means that API versions do not have a patch number (as no API changes are made in patches). API versions will be x.y, and each individual build of LuckPerms will follow x.y.z.
## Commands
Command usage is printed to the console/chat whenever invalid arguments are provided. Simply typing /perms will list all commands a user has permission to use.
### Aliases
| Bukkit | Bungee |
|------------------|------------------|
| /luckperms | /luckpermsbungee |
| /perms | /bperms |
| /permissions | /bpermissions |
| /lp | /lpb |
| /perm | /bperm |
Arguments: \<required\> [optional]
Users with OP have access to all commands.
Additionally, you can use wildcards to grant users access to a selection of commands.
* **All commands** - luckperms.*
* **All user commands** - luckperms.user.*
* **All group commands** - luckperms.group.*
* **All track commands** - luckperms.track.*
* **All log commands** - luckperms.log.*
### General
* /perms - n/a
* /perms sync - luckperms.sync
* /perms info - luckperms.info
* /perms debug - luckperms.debug
* /perms import \<file\> - luckperms.import
* /perms creategroup \<group\> - luckperms.creategroup
* /perms deletegroup \<group\> - luckperms.deletegroup
* /perms listgroups - luckperms.listgroups
* /perms createtrack \<track\> - luckperms.createtrack
* /perms deletetrack \<track\> - luckperms.deletetrack
* /perms listtracks - luckperms.listtracks
### User
* /perms user \<user\> info - luckperms.user.info
* /perms user \<user\> getuuid - luckperms.user.getuuid
* /perms user \<user\> listnodes - luckperms.user.listnodes
* /perms user \<user\> haspermission \<node\> [server] [world] - luckperms.user.haspermission
* /perms user \<user\> inheritspermission \<node\> [server] [world] - luckperms.user.inheritspermission
* /perms user \<user\> set \<node\> \<true/false\> [server] [world] - luckperms.user.setpermission
* /perms user \<user\> unset \<node\> [server] [world] - luckperms.user.unsetpermission
* /perms user \<user\> addgroup \<group\> [server] [world] - luckperms.user.addgroup
* /perms user \<user\> removegroup \<group\> [server] [world] - luckperms.user.removegroup
* /perms user \<user\> settemp \<node\> \<true/false\> \<duration\> [server] [world] - luckperms.user.settemppermission
* /perms user \<user\> unsettemp \<node\> [server] [world] - luckperms.user.unsettemppermission
* /perms user \<user\> addtempgroup \<group\> \<duration\> [server] [world] - luckperms.user.addtempgroup
* /perms user \<user\> removetempgroup \<group\> [server] [world] - luckperms.user.removetempgroup
* /perms user \<user\> setprimarygroup \<group\> - luckperms.user.setprimarygroup
* /perms user \<user\> showtracks - luckperms.user.showtracks
* /perms user \<user\> promote \<track\> - luckperms.user.promote
* /perms user \<user\> demote \<track\> - luckperms.user.demote
* /perms user \<user\> showpos \<track\> - luckperms.user.showpos
* /perms user \<user\> clear - luckperms.user.clear
### Group
* /perms group \<group\> info - luckperms.group.info
* /perms group \<group\> listnodes - luckperms.group.listnodes
* /perms group \<group\> haspermission \<node\> [server] [world] - luckperms.group.haspermission
* /perms group \<group\> inheritspermission \<node\> [server] [world] - luckperms.group.inheritspermission
* /perms group \<group\> set \<node\> \<true/false\> [server] [world] - luckperms.group.setpermission
* /perms group \<group\> unset \<node\> [server] [world] - luckperms.group.unsetpermission
* /perms group \<group\> setinherit \<group\> [server] [world] - luckperms.group.setinherit
* /perms group \<group\> unsetinherit \<group\> [server] [world] - luckperms.group.unsetinherit
* /perms group \<group\> settemp \<node\> \<true/false\> \<duration\> [server] [world] - settemppermission
* /perms group \<group\> unsettemp \<node\> [server] [world] - luckperms.group.unsettemppermission
* /perms group \<group\> settempinherit \<group\> \<duration\> [server] [world] - luckperms.group.settempinherit
* /perms group \<group\> unsettempinherit \<group\> [server] [world] - luckperms.group.unsettempinherit
* /perms group \<group\> showtracks - luckperms.group.showtracks
* /perms group \<group\> clear - luckperms.group.clear
### Track
* /perms track \<track\> info - luckperms.track.info
* /perms track \<track\> append \<group\> - luckperms.track.append
* /perms track \<track\> insert \<group\> \<position\> - luckperms.track.insert
* /perms track \<track\> remove \<group\> - luckperms.track.remove
* /perms track \<track\> clear - luckperms.track.clear
### Log
* /perms log recent [user] [page] - luckperms.log.recent
* /perms log search \<query\> [page] - luckperms.log.search
* /perms log notify [on|off] - luckperms.log.notify
* /perms log export \<file\> - luckperms.log.export
* /perms log userhistory \<user\> [page] - luckperms.log.userhistory
* /perms log grouphistory \<group\> [page] - luckperms.log.grouphistory
* /perms log trackhistory \<track\> [page] - luckperms.log.trackhistory
* **API** - The public, semantically versioned API used by other plugins wishing to integrate with and retrieve data from LuckPerms. This module (for the most part) does not contain any implementation itself, and is provided by the plugin.
* **Common** - The common module contains most of the code which implements the respective LuckPerms plugins. This abstract module reduces duplicated code throughout the project.
* **Bukkit, BungeeCord, Sponge, Nukkit & Velocity** - Each use the common module to implement plugins on the respective server platforms.
## License
See LICENSE.md.
LuckPerms is licensed under the permissive MIT license. Please see [`LICENSE.txt`](https://github.com/lucko/LuckPerms/blob/master/LICENSE.txt) for more info.
+99
View File
@@ -0,0 +1,99 @@
group = 'net.luckperms'
project.version = '5.1'
dependencies {
compileOnly 'org.checkerframework:checker-qual:2.5.5'
}
// Only used occasionally for deployment - not needed for normal builds.
/*
if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')) {
apply plugin: 'signing'
javadoc {
title = 'LuckPerms API (v' + project.ext.apiVersion + ')'
options.encoding = 'UTF-8'
options.charSet = 'UTF-8'
options.links(
'https://docs.oracle.com/javase/8/docs/api/'
)
options.addStringOption('Xdoclint:none', '-quiet')
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier 'javadoc'
from javadoc.destinationDir
}
task sourcesJar(type: Jar) {
classifier 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar
archives sourcesJar
}
signing {
useGpgCmd()
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom {
project {
name 'LuckPerms API'
description 'An advanced permissions plugin for Bukkit/Spigot, BungeeCord, Sponge, Nukkit and Velocity.'
url 'https://luckperms.net'
licenses {
license {
name 'MIT'
url 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id 'lucko'
name 'Luck'
url 'https://lucko.me'
email 'git@lucko.me'
}
}
scm {
connection 'scm:git:https://github.com/lucko/LuckPerms.git'
developerConnection 'scm:git:git@github.com:lucko/LuckPerms.git'
url 'https://github.com/lucko/LuckPerms'
}
ciManagement {
system 'Jenkins'
url 'https://ci.lucko.me/job/LuckPerms'
}
issueManagement {
system 'GitHub'
url 'https://github.com/lucko/LuckPerms/issues'
}
}
}
}
}
}
}
*/
-39
View File
@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>luckperms</artifactId>
<groupId>me.lucko.luckperms</groupId>
<version>2.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>luckperms-api</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<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-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -1,104 +0,0 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.api;
import me.lucko.luckperms.api.data.Callback;
import java.util.UUID;
/**
* Wrapper interface for the internal Datastore instance
*
* <p> The implementations of this interface limit access to the datastore and add parameter checks to further prevent
* errors and ensure all API interactions to not damage the state of the plugin.
*/
@SuppressWarnings("unused")
public interface Datastore {
String getName();
boolean isAcceptingLogins();
Async async();
Sync sync();
Future future();
interface Async {
void logAction(LogEntry entry, Callback<Boolean> callback);
void getLog(Callback<Log> callback);
void loadOrCreateUser(UUID uuid, String username, Callback<Boolean> callback);
void loadUser(UUID uuid, Callback<Boolean> callback);
void saveUser(User user, Callback<Boolean> callback);
void createAndLoadGroup(String name, Callback<Boolean> callback);
void loadGroup(String name, Callback<Boolean> callback);
void loadAllGroups(Callback<Boolean> callback);
void saveGroup(Group group, Callback<Boolean> callback);
void deleteGroup(Group group, Callback<Boolean> callback);
void createAndLoadTrack(String name, Callback<Boolean> callback);
void loadTrack(String name, Callback<Boolean> callback);
void loadAllTracks(Callback<Boolean> callback);
void saveTrack(Track track, Callback<Boolean> callback);
void deleteTrack(Track track, Callback<Boolean> callback);
void saveUUIDData(String username, UUID uuid, Callback<Boolean> callback);
void getUUID(String username, Callback<UUID> callback);
}
interface Sync {
boolean logAction(LogEntry entry);
Log getLog();
boolean loadOrCreateUser(UUID uuid, String username);
boolean loadUser(UUID uuid);
boolean saveUser(User user);
boolean createAndLoadGroup(String name);
boolean loadGroup(String name);
boolean loadAllGroups();
boolean saveGroup(Group group);
boolean deleteGroup(Group group);
boolean createAndLoadTrack(String name);
boolean loadTrack(String name);
boolean loadAllTracks();
boolean saveTrack(Track track);
boolean deleteTrack(Track track);
boolean saveUUIDData(String username, UUID uuid);
UUID getUUID(String username);
}
interface Future {
java.util.concurrent.Future<Boolean> logAction(LogEntry entry);
java.util.concurrent.Future<Log> getLog();
java.util.concurrent.Future<Boolean> loadOrCreateUser(UUID uuid, String username);
java.util.concurrent.Future<Boolean> loadUser(UUID uuid);
java.util.concurrent.Future<Boolean> saveUser(User user);
java.util.concurrent.Future<Boolean> createAndLoadGroup(String name);
java.util.concurrent.Future<Boolean> loadGroup(String name);
java.util.concurrent.Future<Boolean> loadAllGroups();
java.util.concurrent.Future<Boolean> saveGroup(Group group);
java.util.concurrent.Future<Boolean> deleteGroup(Group group);
java.util.concurrent.Future<Boolean> createAndLoadTrack(String name);
java.util.concurrent.Future<Boolean> loadTrack(String name);
java.util.concurrent.Future<Boolean> loadAllTracks();
java.util.concurrent.Future<Boolean> saveTrack(Track track);
java.util.concurrent.Future<Boolean> deleteTrack(Track track);
java.util.concurrent.Future<Boolean> saveUUIDData(String username, UUID uuid);
java.util.concurrent.Future<UUID> getUUID(String username);
}
}
@@ -1,195 +0,0 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.api;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List;
/**
* Wrapper interface for internal Group instances
*
* <p> The implementations of this interface limit access to the Group and add parameter checks to further prevent
* errors and ensure all API interactions to not damage the state of the group.
*/
@SuppressWarnings("unused")
public interface Group extends PermissionHolder {
/**
* @return the name of the group
*/
String getName();
/**
* check to see if a group inherits a group
* @param group The group to check membership of
* @return true if the user is a member of the group
*/
boolean inheritsGroup(Group group);
/**
* check to see if the group inherits a group on a specific server
* @param group The group to check membership of
* @param server The server to check on
* @return true if the group inherits the group
*/
boolean inheritsGroup(Group group, String server);
/**
* check to see if the group inherits a group on a specific server
* @param group The group to check membership of
* @param server The server to check on
* @param world The world to check on
* @return true if the group inherits the group
*/
boolean inheritsGroup(Group group, String server, String world);
/**
* Make this group inherit another group
* @param group the group to be inherited
* @throws ObjectAlreadyHasException if the group already inherits the group
*/
void setInheritGroup(Group group) throws ObjectAlreadyHasException;
/**
* Make this group inherit another group on a specific server
* @param group the group to be inherited
* @param server The server to add the group on
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
*/
void setInheritGroup(Group group, String server) throws ObjectAlreadyHasException;
/**
* Make this group inherit another group on a specific server
* @param group the group to be inherited
* @param server The server to add the group on
* @param world The world to add the group on
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
*/
void setInheritGroup(Group group, String server, String world) throws ObjectAlreadyHasException;
/**
* Make this group inherit another group on a specific server
* @param group the group to be inherited
* @param expireAt when the group should expire
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
*/
void setInheritGroup(Group group, long expireAt) throws ObjectAlreadyHasException;
/**
* Make this group inherit another group on a specific server
* @param group the group to be inherited
* @param server The server to add the group on
* @param expireAt when the group should expire
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
*/
void setInheritGroup(Group group, String server, long expireAt) throws ObjectAlreadyHasException;
/**
* Make this group inherit another group on a specific server
* @param group the group to be inherited
* @param server The server to add the group on
* @param world The world to add the group on
* @param expireAt when the group should expire
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
*/
void setInheritGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException;
/**
* Remove a previously set inheritance
* @param group the group to uninherit
* @throws ObjectLacksException if the group does not already inherit the group
*/
void unsetInheritGroup(Group group) throws ObjectLacksException;
/**
* Remove a previously set inheritance
* @param group the group to uninherit
* @param temporary if the group being removed is temporary
* @throws ObjectLacksException if the group does not already inherit the group
*/
void unsetInheritGroup(Group group, boolean temporary) throws ObjectLacksException;
/**
* Remove a previously set inheritance
* @param group the group to uninherit
* @param server The server to remove the group on
* @throws ObjectLacksException if the group does not already inherit the group
*/
void unsetInheritGroup(Group group, String server) throws ObjectLacksException;
/**
* Remove a previously set inheritance
* @param group the group to uninherit
* @param server The server to remove the group on
* @param world The world to remove the group on
* @throws ObjectLacksException if the group does not already inherit the group
*/
void unsetInheritGroup(Group group, String server, String world) throws ObjectLacksException;
/**
* Remove a previously set inheritance
* @param group the group to uninherit
* @param server The server to remove the group on
* @param temporary if the group being removed is temporary
* @throws ObjectLacksException if the group does not already inherit the group
*/
void unsetInheritGroup(Group group, String server, boolean temporary) throws ObjectLacksException;
/**
* Remove a previously set inheritance
* @param group the group to uninherit
* @param server The server to remove the group on
* @param world The world to remove the group on
* @param temporary if the group being removed is temporary
* @throws ObjectLacksException if the group does not already inherit the group
*/
void unsetInheritGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
/**
* Clear all of the groups permission nodes
*/
void clearNodes();
/**
* Get a {@link List} of all of the groups the group inherits, on all servers
* @return a {@link List} of group names
*/
List<String> getGroupNames();
/**
* Get a {@link List} of the groups the group inherits on a specific server
* @param server the server to check
* @param world the world to check
* @return a {@link List} of group names
*/
List<String> getLocalGroups(String server, String world);
/**
* Get a {@link List} of the groups the group inherits on a specific server
* @param server the server to check
* @return a {@link List} of group names
*/
List<String> getLocalGroups(String server);
}
@@ -1,96 +0,0 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.api;
import me.lucko.luckperms.api.data.DatastoreConfiguration;
import me.lucko.luckperms.api.data.MySQLConfiguration;
/**
* A wrapper interface for the internal LuckPerms configuration, providing read only access.
*/
public interface LPConfiguration {
/**
* @return the name of this server
*/
String getServer();
/**
* @return how often a sync task will run in minutes
*/
int getSyncTime();
/**
* @return the default group, in a node representation
*/
String getDefaultGroupNode();
/**
* @return the name of the default group
*/
String getDefaultGroupName();
/**
* @return if the users on this server will have their global permissions applied
*/
boolean getIncludeGlobalPerms();
/**
* @return the online mode setting in the config
*/
boolean getOnlineMode();
/**
* @return if LuckPerms is applying wildcard permissions
*/
boolean getApplyWildcards();
/**
* @return if LuckPerms is resolving and applying regex permissions
*/
boolean getApplyRegex();
/**
* @return if LuckPerms is expanding shorthand permissions
*/
boolean getApplyShorthand();
/**
* @return the database values set in the configuration
* @deprecated use {@link #getDatastoreConfig()}
*/
@SuppressWarnings("deprecation")
@Deprecated
MySQLConfiguration getDatabaseValues();
/**
* @return the values set for data storage in the configuration
*/
DatastoreConfiguration getDatastoreConfig();
/**
* @return the storage method string from the configuration
*/
String getStorageMethod();
}
@@ -1,64 +0,0 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.api;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.UUID;
/**
* Represents the internal LuckPerms log.
* All content is immutable. You can add to the log using the {@link Datastore}, and then request an updated copy.
*/
@SuppressWarnings("unused")
public interface Log {
/**
* @return a {@link SortedSet} of all of the {@link LogEntry} objects in this {@link Log}
*/
SortedSet<LogEntry> getContent();
SortedSet<LogEntry> getRecent();
SortedMap<Integer, LogEntry> getRecent(int pageNo);
int getRecentMaxPages();
SortedSet<LogEntry> getRecent(UUID actor);
SortedMap<Integer, LogEntry> getRecent(int pageNo, UUID actor);
int getRecentMaxPages(UUID actor);
SortedSet<LogEntry> getUserHistory(UUID uuid);
SortedMap<Integer, LogEntry> getUserHistory(int pageNo, UUID uuid);
int getUserHistoryMaxPages(UUID uuid);
SortedSet<LogEntry> getGroupHistory(String name);
SortedMap<Integer, LogEntry> getGroupHistory(int pageNo, String name);
int getGroupHistoryMaxPages(String name);
SortedSet<LogEntry> getTrackHistory(String name);
SortedMap<Integer, LogEntry> getTrackHistory(int pageNo, String name);
int getTrackHistoryMaxPages(String name);
SortedSet<LogEntry> getSearch(String query);
SortedMap<Integer, LogEntry> getSearch(int pageNo, String query);
int getSearchMaxPages(String query);
}
@@ -1,315 +0,0 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.api;
import java.util.UUID;
public class LogEntry implements Comparable<LogEntry> {
public static LogEntryBuilder builder() {
return new LogEntryBuilder();
}
private static final String FORMAT = "&8(&e%s&8) [&a%s&8] (&b%s&8) &7--> &f%s";
private long timestamp;
private UUID actor;
private String actorName;
private char type;
private UUID acted;
private String actedName;
private String action;
public LogEntry(long timestamp, UUID actor, String actorName, char type, UUID acted, String actedName, String action) {
if (actor == null) {
throw new NullPointerException("actor");
}
if (actorName == null) {
throw new NullPointerException("actorName");
}
if (actedName == null) {
throw new NullPointerException("actedName");
}
if (action == null) {
throw new NullPointerException("action");
}
this.timestamp = timestamp;
this.actor = actor;
this.actorName = actorName;
this.type = type;
this.acted = acted;
this.actedName = actedName;
this.action = action;
}
protected LogEntry() {
this.timestamp = 0L;
this.actor = null;
this.actorName = null;
this.type = Character.MIN_VALUE;
this.acted = null;
this.actedName = null;
this.action = null;
}
@Override
public int compareTo(LogEntry o) {
return equals(o) ? 0 : (Long.compare(timestamp, o.getTimestamp()) == 0 ? 1 : Long.compare(timestamp, o.getTimestamp()));
}
public boolean matchesSearch(String query) {
query = query.toLowerCase();
return actorName.toLowerCase().contains(query) || actedName.toLowerCase().contains(query)
|| action.toLowerCase().contains(query);
}
public String getFormatted() {
return String.format(FORMAT,
actorName,
Character.toString(type),
actedName,
action
);
}
public long getTimestamp() {
return timestamp;
}
public UUID getActor() {
return actor;
}
public String getActorName() {
return actorName;
}
public char getType() {
return type;
}
public UUID getActed() {
return acted;
}
public String getActedName() {
return actedName;
}
public String getAction() {
return action;
}
void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
void setActor(UUID actor) {
this.actor = actor;
}
void setActorName(String actorName) {
this.actorName = actorName;
}
void setType(char type) {
this.type = type;
}
void setActed(UUID acted) {
this.acted = acted;
}
void setActedName(String actedName) {
this.actedName = actedName;
}
void setAction(String action) {
this.action = action;
}
@Override
public String toString() {
return "LogEntry(timestamp=" + this.getTimestamp() + ", actor=" + this.getActor() + ", actorName=" +
this.getActorName() + ", type=" + this.getType() + ", acted=" + this.getActed() + ", actedName=" +
this.getActedName() + ", action=" + this.getAction() + ")";
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof LogEntry)) return false;
final LogEntry other = (LogEntry) o;
if (this.getTimestamp() != other.getTimestamp()) return false;
final Object this$actor = this.getActor();
final Object other$actor = other.getActor();
if (this$actor == null ? other$actor != null : !this$actor.equals(other$actor)) return false;
final Object this$actorName = this.getActorName();
final Object other$actorName = other.getActorName();
if (this$actorName == null ? other$actorName != null : !this$actorName.equals(other$actorName)) return false;
if (this.getType() != other.getType()) return false;
final Object this$acted = this.getActed();
final Object other$acted = other.getActed();
if (this$acted == null ? other$acted != null : !this$acted.equals(other$acted)) return false;
final Object this$actedName = this.getActedName();
final Object other$actedName = other.getActedName();
if (this$actedName == null ? other$actedName != null : !this$actedName.equals(other$actedName)) return false;
final Object this$action = this.getAction();
final Object other$action = other.getAction();
return this$action == null ? other$action == null : this$action.equals(other$action);
}
@Override
public int hashCode() {
final int PRIME = 59;
int result = 1;
final long $timestamp = this.getTimestamp();
result = result * PRIME + (int) ($timestamp >>> 32 ^ $timestamp);
final Object $actor = this.getActor();
result = result * PRIME + ($actor == null ? 43 : $actor.hashCode());
final Object $actorName = this.getActorName();
result = result * PRIME + ($actorName == null ? 43 : $actorName.hashCode());
result = result * PRIME + this.getType();
final Object $acted = this.getActed();
result = result * PRIME + ($acted == null ? 43 : $acted.hashCode());
final Object $actedName = this.getActedName();
result = result * PRIME + ($actedName == null ? 43 : $actedName.hashCode());
final Object $action = this.getAction();
result = result * PRIME + ($action == null ? 43 : $action.hashCode());
return result;
}
public static class LogEntryBuilder extends AbstractLogEntryBuilder<LogEntry, LogEntry.LogEntryBuilder> {
@Override
protected LogEntry createObj() {
return new LogEntry();
}
@Override
protected LogEntryBuilder getThis() {
return this;
}
}
public static abstract class AbstractLogEntryBuilder<T extends LogEntry, B extends AbstractLogEntryBuilder<T, B>> {
private T obj;
private B thisObj;
public AbstractLogEntryBuilder() {
obj = createObj();
thisObj = getThis();
}
protected abstract T createObj();
protected abstract B getThis();
public long getTimestamp() {
return obj.getTimestamp();
}
public UUID getActor() {
return obj.getActor();
}
public String getActorName() {
return obj.getActorName();
}
public char getType() {
return obj.getType();
}
public UUID getActed() {
return obj.getActed();
}
public String getActedName() {
return obj.getActedName();
}
public String getAction() {
return obj.getAction();
}
public B timestamp(long timestamp) {
obj.setTimestamp(timestamp);
return thisObj;
}
public B actor(UUID actor) {
obj.setActor(actor);
return thisObj;
}
public B actorName(String actorName) {
obj.setActorName(actorName);
return thisObj;
}
public B type(char type) {
obj.setType(type);
return thisObj;
}
public B acted(UUID acted) {
obj.setActed(acted);
return thisObj;
}
public B actedName(String actedName) {
obj.setActedName(actedName);
return thisObj;
}
public B action(String action) {
obj.setAction(action);
return thisObj;
}
public T build() {
if (getActor() == null) {
throw new NullPointerException("actor");
}
if (getActorName() == null) {
throw new NullPointerException("actorName");
}
if (getActedName() == null) {
throw new NullPointerException("actedName");
}
if (getAction() == null) {
throw new NullPointerException("action");
}
return obj;
}
@Override
public String toString() {
return "LogEntry.LogEntryBuilder(timestamp=" + getTimestamp() + ", actor=" + getActor() + ", actorName=" +
getActorName() + ", type=" + getType() + ", acted=" + getActed() + ", actedName=" + getActedName() +
", action=" + getAction() + ")";
}
}
}
@@ -1,164 +0,0 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.api;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
/**
* The root Api interface in LuckPerms
*/
@SuppressWarnings("unused")
public interface LuckPermsApi {
/**
* Schedules an update task to run
*/
void runUpdateTask();
/**
* @return the version of the plugin running on the platform
*/
String getVersion();
/**
* Gets a wrapped {@link LPConfiguration} instance, with read only access
* @return a configuration instance
*/
LPConfiguration getConfiguration();
/**
* Gets a wrapped {@link Datastore} instance, with somewhat limited access
* @return a datastore instance
*/
Datastore getDatastore();
/**
* Gets the {@link Logger} wrapping used by the platform
* @return the logger instance
*/
Logger getLogger();
/**
* Gets a wrapped {@link UuidCache} instance, providing read access to the LuckPerms internal uuid caching system
* @return a uuidcache instance
*/
UuidCache getUuidCache();
/**
* Gets a wrapped user object from the user storage
* @param uuid the uuid of the user to get
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
*/
User getUser(UUID uuid);
/**
* Gets a wrapped user object from the user storage. This method does not return null, unlike {@link #getUser(UUID)}
* @param uuid the uuid of the user to get
* @return an optional {@link User} object
*/
Optional<User> getUserSafe(UUID uuid);
/**
* Gets a wrapped user object from the user storage
* @param name the username of the user to get
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
*/
User getUser(String name);
/**
* Gets a wrapped user object from the user storage. This method does not return null, unlike {@link #getUser(String)}
* @param name the username of the user to get
* @return an optional {@link User} object
*/
Optional<User> getUserSafe(String name);
/**
* Gets a set of all loaded users.
* @return a {@link Set} of {@link User} objects
*/
Set<User> getUsers();
/**
* Check if a user is loaded in memory
* @param uuid the uuid to check for
* @return true if the user is loaded
*/
boolean isUserLoaded(UUID uuid);
/**
* Gets a wrapped group object from the group storage
* @param name the name of the group to get
* @return a {@link Group} object, if one matching the name exists, or null if not
*/
Group getGroup(String name);
/**
* Gets a wrapped group object from the group storage. This method does not return null, unlike {@link #getGroup}
* @param name the name of the group to get
* @return an optional {@link Group} object
*/
Optional<Group> getGroupSafe(String name);
/**
* Gets a set of all loaded groups.
* @return a {@link Set} of {@link Group} objects
*/
Set<Group> getGroups();
/**
* Check if a group is loaded in memory
* @param name the name to check for
* @return true if the group is loaded
*/
boolean isGroupLoaded(String name);
/**
* Gets a wrapped track object from the track storage
* @param name the name of the track to get
* @return a {@link Track} object, if one matching the name exists, or null if not
*/
Track getTrack(String name);
/**
* Gets a wrapped tracj object from the track storage. This method does not return null, unlike {@link #getTrack}
* @param name the name of the track to get
* @return an optional {@link Track} object
*/
Optional<Track> getTrackSafe(String name);
/**
* Gets a set of all loaded tracks.
* @return a {@link Set} of {@link Track} objects
*/
Set<Track> getTracks();
/**
* Check if a track is loaded in memory
* @param name the name to check for
* @return true if the track is loaded
*/
boolean isTrackLoaded(String name);
}
@@ -1,319 +0,0 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.api;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List;
import java.util.Map;
/**
* Wrapper interface for internal PermissionHolder (user/group) instances
*
* <p> The implementations of this interface limit access to the object and add parameter checks to further prevent
* errors and ensure all API interactions to not damage the state of the object.
*/
@SuppressWarnings("unused")
public interface PermissionHolder {
String getObjectName();
Map<String, Boolean> getNodes();
/**
* Checks to see if the object has a certain permission
* @param node The permission node
* @param b If the node is true/false(negated)
* @return true if the user has the permission
*/
boolean hasPermission(String node, boolean b);
/**
* Checks to see the the object has a permission on a certain server
* @param node The permission node
* @param b If the node is true/false(negated)
* @param server The server
* @return true if the user has the permission
*/
boolean hasPermission(String node, boolean b, String server);
/**
* Checks to see the the object has a permission on a certain server
* @param node The permission node
* @param b If the node is true/false(negated)
* @param server The server
* @param world The world
* @return true if the user has the permission
*/
boolean hasPermission(String node, boolean b, String server, String world);
/**
* Checks to see the the object has a permission on a certain server
* @param node The permission node
* @param b If the node is true/false(negated)
* @param temporary if the permission is temporary
* @return true if the user has the permission
*/
boolean hasPermission(String node, boolean b, boolean temporary);
/**
* Checks to see the the object has a permission on a certain server
* @param node The permission node
* @param b If the node is true/false(negated)
* @param server The server to check on
* @param temporary if the permission is temporary
* @return true if the user has the permission
*/
boolean hasPermission(String node, boolean b, String server, boolean temporary);
/**
* Checks to see the the object has a permission on a certain server
* @param node The permission node
* @param b If the node is true/false(negated)
* @param server The server to check on
* @param world The world to check on
* @param temporary if the permission is temporary
* @return true if the user has the permission
*/
boolean hasPermission(String node, boolean b, String server, String world, boolean temporary);
/**
* Checks to see if the object inherits a certain permission
* @param node The permission node
* @param b If the node is true/false(negated)
* @return true if the user inherits the permission
*/
boolean inheritsPermission(String node, boolean b);
/**
* Checks to see the the object inherits a permission on a certain server
* @param node The permission node
* @param b If the node is true/false(negated)
* @param server The server
* @return true if the user inherits the permission
*/
boolean inheritsPermission(String node, boolean b, String server);
/**
* Checks to see the the object inherits a permission on a certain server
* @param node The permission node
* @param b If the node is true/false(negated)
* @param server The server
* @param world The world
* @return true if the user inherits the permission
*/
boolean inheritsPermission(String node, boolean b, String server, String world);
/**
* Checks to see if the object inherits a certain permission
* @param node The permission node
* @param b If the node is true/false(negated)
* @param temporary if the permission is temporary
* @return true if the user inherits the permission
*/
boolean inheritsPermission(String node, boolean b, boolean temporary);
/**
* Checks to see if the object inherits a certain permission
* @param node The permission node
* @param b If the node is true/false(negated)
* @param server The server
* @param temporary if the permission is temporary
* @return true if the user inherits the permission
*/
boolean inheritsPermission(String node, boolean b, String server, boolean temporary);
/**
* Checks to see if the object inherits a certain permission
* @param node The permission node
* @param b If the node is true/false(negated)
* @param server The server
* @param world The world
* @param temporary if the permission is temporary
* @return true if the user inherits the permission
*/
boolean inheritsPermission(String node, boolean b, String server, String world, boolean temporary);
/**
* Sets a permission for the object
* @param node The node to be set
* @param value What to set the node to - true/false(negated)
* @throws ObjectAlreadyHasException if the object already has the permission
*/
void setPermission(String node, boolean value) throws ObjectAlreadyHasException;
/**
* Sets a permission for the object
* @param node The node to set
* @param value What to set the node to - true/false(negated)
* @param server The server to set the permission on
* @throws ObjectAlreadyHasException if the object already has the permission
*/
void setPermission(String node, boolean value, String server) throws ObjectAlreadyHasException;
/**
* Sets a permission for the object
* @param node The node to set
* @param value What to set the node to - true/false(negated)
* @param server The server to set the permission on
* @param world The world to set the permission on
* @throws ObjectAlreadyHasException if the object already has the permission
*/
void setPermission(String node, boolean value, String server, String world) throws ObjectAlreadyHasException;
/**
* Sets a permission for the object
* @param node The node to set
* @param value What to set the node to - true/false(negated)
* @param expireAt The time in unixtime when the permission will expire
* @throws ObjectAlreadyHasException if the object already has the permission
*/
void setPermission(String node, boolean value, long expireAt) throws ObjectAlreadyHasException;
/**
* Sets a permission for the object
* @param node The node to set
* @param value What to set the node to - true/false(negated)
* @param server The server to set the permission on
* @param expireAt The time in unixtime when the permission will expire
* @throws ObjectAlreadyHasException if the object already has the permission
*/
void setPermission(String node, boolean value, String server, long expireAt) throws ObjectAlreadyHasException;
/**
* Sets a permission for the object
* @param node The node to set
* @param value What to set the node to - true/false(negated)
* @param server The server to set the permission on
* @param world The world to set the permission on
* @param expireAt The time in unixtime when the permission will expire
* @throws ObjectAlreadyHasException if the object already has the permission
*/
void setPermission(String node, boolean value, String server, String world, long expireAt) throws ObjectAlreadyHasException;
/**
* Unsets a permission for the object
* @param node The node to be unset
* @param temporary if the permission being removed is temporary
* @throws ObjectLacksException if the node wasn't already set
*/
void unsetPermission(String node, boolean temporary) throws ObjectLacksException;
/**
* Unsets a permission for the object
* @param node The node to be unset
* @throws ObjectLacksException if the node wasn't already set
*/
void unsetPermission(String node) throws ObjectLacksException;
/**
* Unsets a permission for the object
* @param node The node to be unset
* @param server The server to unset the node on
* @throws ObjectLacksException if the node wasn't already set
*/
void unsetPermission(String node, String server) throws ObjectLacksException;
/**
* Unsets a permission for the object
* @param node The node to be unset
* @param server The server to unset the node on
* @param world The world to unset the node on
* @throws ObjectLacksException if the node wasn't already set
*/
void unsetPermission(String node, String server, String world) throws ObjectLacksException;
/**
* Unsets a permission for the object
* @param node The node to be unset
* @param server The server to unset the node on
* @param temporary if the permission being unset is temporary
* @throws ObjectLacksException if the node wasn't already set
*/
void unsetPermission(String node, String server, boolean temporary) throws ObjectLacksException;
/**
* Unsets a permission for the object
* @param node The node to be unset
* @param server The server to unset the node on
* @param world The world to unset the node on
* @param temporary if the permission being unset is temporary
* @throws ObjectLacksException if the node wasn't already set
*/
void unsetPermission(String node, String server, String world, boolean temporary) throws ObjectLacksException;
/**
* Gets the permissions and inherited permissions that apply to a specific server
* @param server The server to get nodes for
* @param world The world to get nodes for
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
* @param possibleNodes A list of possible permission nodes for wildcard permission handling
* @return a {@link Map} of the permissions
*/
Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups, List<String> possibleNodes);
/**
* Gets the permissions and inherited permissions that apply to a specific server
* @param server The server to get nodes for
* @param world The world to get nodes for
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
* @return a {@link Map} of the permissions
*/
Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups);
/**
* Gets the permissions and inherited permissions that apply to a specific server
* @param server The server to get nodes for
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
* @param possibleNodes A list of possible permission nodes for wildcard permission handling
* @return a {@link Map} of the permissions
*/
Map<String, Boolean> getLocalPermissions(String server, List<String> excludedGroups, List<String> possibleNodes);
/**
* Gets the permissions and inherited permissions that apply to a specific server
* @param server The server to get nodes for
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
* @return a {@link Map} of the permissions
*/
Map<String, Boolean> getLocalPermissions(String server, List<String> excludedGroups);
/**
* Processes the objects and returns the temporary ones.
* @return a map of temporary nodes
*/
Map<Map.Entry<String, Boolean>, Long> getTemporaryNodes();
/**
* Processes the objects and returns the non-temporary ones.
* @return a map of permanent nodes
*/
Map<String, Boolean> getPermanentNodes();
/**
* Removes temporary permissions that have expired
*/
void auditTemporaryPermissions();
}
@@ -1,118 +0,0 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.api;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List;
/**
* Wrapper interface for internal Track instances
*
* <p> The implementations of this interface limit access to the Track and add parameter checks to further prevent
* errors and ensure all API interactions to not damage the state of the track.
*/
@SuppressWarnings("unused")
public interface Track {
String getName();
/**
* Gets an ordered list of the groups on this track
* @return am ordered {@link List} of the groups on this track
*/
List<String> getGroups();
/**
* Gets the number of groups on this track
* @return the number of groups on this track
*/
int getSize();
/**
* Gets the next group on the track, after the one provided
* @param current the group before the group being requested
* @return the group name, or null if the end of the track has been reached
* @throws ObjectLacksException if the track does not contain the group given
*/
String getNext(Group current) throws ObjectLacksException;
/**
* Gets the group before the group provided
* @param current the group after the group being requested
* @return the group name, or null if the start of the track has been reached
* @throws ObjectLacksException if the track does not contain the group given
*/
String getPrevious(Group current) throws ObjectLacksException;
/**
* Appends a group to the end of this track
* @param group the group to append
* @throws ObjectAlreadyHasException if the group is already on this track somewhere
*/
void appendGroup(Group group) throws ObjectAlreadyHasException;
/**
* Inserts a group at a certain position on this track
* @param group the group to be inserted
* @param position the index position (a value of 0 inserts at the start)
* @throws ObjectAlreadyHasException if the group is already on this track somewhere
* @throws IndexOutOfBoundsException if the position is less than 0 or greater than the size of the track
*/
void insertGroup(Group group, int position) throws ObjectAlreadyHasException, IndexOutOfBoundsException;
/**
* Removes a group from this track
* @param group the group to remove
* @throws ObjectLacksException if the group is not on this track
*/
void removeGroup(Group group) throws ObjectLacksException;
/**
* Removes a group from this track
* @param group the group to remove
* @throws ObjectLacksException if the group is not on this track
*/
void removeGroup(String group) throws ObjectLacksException;
/**
* Checks if a group features on this track
* @param group the group to check
* @return true if the group is on this track
*/
boolean containsGroup(Group group);
/**
* Checks if a group features on this track
* @param group the group to check
* @return true if the group is on this track
*/
boolean containsGroup(String group);
/**
* Clear all of the groups within this track
*/
void clearGroups();
}
@@ -1,220 +0,0 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.api;
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List;
import java.util.UUID;
/**
* Wrapper interface for internal User instances
*
* <p> The implementations of this interface limit access to the User and add parameter checks to further prevent
* errors and ensure all API interactions to not damage the state of the user.
*/
@SuppressWarnings("unused")
public interface User extends PermissionHolder {
/**
* @return the users Mojang assigned unique id
*/
UUID getUuid();
/**
* @return the Users Username
*/
String getName();
/**
* Gets the users primary group
* @return the users primary group
*/
String getPrimaryGroup();
/**
* Sets a users primary group
* @param s the new primary group
* @throws ObjectAlreadyHasException if the user already has this set as their primary group
*/
void setPrimaryGroup(String s) throws ObjectAlreadyHasException;
/**
* Refresh and re-assign the users permissions
*/
void refreshPermissions();
/**
* Check to see if the user is a member of a group
* @param group The group to check membership of
* @return true if the user is a member of the group
*/
boolean isInGroup(Group group);
/**
* Check to see if a user is a member of a group on a specific server
* @param group The group to check membership of
* @param server The server to check on
* @return true if the user is a member of the group
*/
boolean isInGroup(Group group, String server);
/**
* Check to see if a user is a member of a group on a specific server
* @param group The group to check membership of
* @param server The server to check on
* @param world The world to check on
* @return true if the user is a member of the group
*/
boolean isInGroup(Group group, String server, String world);
/**
* Add a user to a group
* @param group The group to add the user to
* @throws ObjectAlreadyHasException if the user is already a member of the group
*/
void addGroup(Group group) throws ObjectAlreadyHasException;
/**
* Add a user to a group on a specific server
* @param group The group to add the user to
* @param server The server to add the group on
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
*/
void addGroup(Group group, String server) throws ObjectAlreadyHasException;
/**
* Add a user to a group on a specific server
* @param group The group to add the user to
* @param server The server to add the group on
* @param world The world to add the group on
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
*/
void addGroup(Group group, String server, String world) throws ObjectAlreadyHasException;
/**
* Add a user to a group on a specific server
* @param group The group to add the user to
* @param expireAt when the group should expire
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
*/
void addGroup(Group group, long expireAt) throws ObjectAlreadyHasException;
/**
* Add a user to a group on a specific server
* @param group The group to add the user to
* @param server The server to add the group on
* @param expireAt when the group should expire
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
*/
void addGroup(Group group, String server, long expireAt) throws ObjectAlreadyHasException;
/**
* Add a user to a group on a specific server
* @param group The group to add the user to
* @param server The server to add the group on
* @param world The world to add the group on
* @param expireAt when the group should expire
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
*/
void addGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException;
/**
* Remove the user from a group
* @param group the group to remove the user from
* @throws ObjectLacksException if the user isn't a member of the group
*/
void removeGroup(Group group) throws ObjectLacksException;
/**
* Remove the user from a group
* @param group the group to remove the user from
* @param temporary if the group being removed is temporary
* @throws ObjectLacksException if the user isn't a member of the group
*/
void removeGroup(Group group, boolean temporary) throws ObjectLacksException;
/**
* Remove the user from a group
* @param group The group to remove the user from
* @param server The server to remove the group on
* @throws ObjectLacksException if the user isn't a member of the group
*/
void removeGroup(Group group, String server) throws ObjectLacksException;
/**
* Remove the user from a group
* @param group The group to remove the user from
* @param server The server to remove the group on
* @param world The world to remove the group on
* @throws ObjectLacksException if the user isn't a member of the group
*/
void removeGroup(Group group, String server, String world) throws ObjectLacksException;
/**
* Remove the user from a group
* @param group The group to remove the user from
* @param server The server to remove the group on
* @param temporary if the group being removed is temporary
* @throws ObjectLacksException if the user isn't a member of the group
*/
void removeGroup(Group group, String server, boolean temporary) throws ObjectLacksException;
/**
* Remove the user from a group
* @param group The group to remove the user from
* @param server The server to remove the group on
* @param world The world to remove the group on
* @param temporary if the group being removed is temporary
* @throws ObjectLacksException if the user isn't a member of the group
*/
void removeGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
/**
* Clear all of the users permission nodes
*/
void clearNodes();
/**
* Get a {@link List} of all of the groups the user is a member of, on all servers
* @return a {@link List} of group names
*/
List<String> getGroupNames();
/**
* Get a {@link List} of the groups the user is a member of on a specific server
* @param server the server to check
* @param world the world to check
* @return a {@link List} of group names
*/
List<String> getLocalGroups(String server, String world);
/**
* Get a {@link List} of the groups the user is a member of on a specific server
* @param server the server to check
* @return a {@link List} of group names
*/
List<String> getLocalGroups(String server);
}
@@ -1,54 +0,0 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.lucko.luckperms.api;
import java.util.UUID;
/**
* This UuidCache is a means of allowing users to have the same internal UUID across a network of offline mode servers
* or mixed offline mode and online mode servers. Platforms running in offline mode generate a random UUID for a user when
* they first join the server, but this UUID will then not be consistent across the network. LuckPerms will instead check
* the datastore cache, to get a UUID for a user that is consistent across an entire network.
*
* <p> If you want to get a user object from the datastore using the api on a server in offline mode, you will need to use this cache,
* OR use Datastore#getUUID, for users that are not online.
*
* <p> WARNING: THIS IS ONLY EFFECTIVE FOR ONLINE PLAYERS. USE THE DATASTORE METHODS FOR OFFLINE PLAYERS.
*/
public interface UuidCache {
/**
* Gets a users internal "LuckPerms" UUID, from the one given by the server.
* @param external the UUID assigned by the server, through Player#getUniqueId or ProxiedPlayer#getUniqueId
* @return the corresponding internal UUID
*/
UUID getUUID(UUID external);
/**
* Gets a users external, server assigned or Mojang assigned unique id, from the internal one used within LuckPerms.
* @param internal the UUID used within LuckPerms, through User#getUuid
* @return the corresponding external UUID
*/
UUID getExternalUUID(UUID internal);
}
@@ -0,0 +1,254 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api;
import net.luckperms.api.actionlog.ActionLogger;
import net.luckperms.api.context.ContextCalculator;
import net.luckperms.api.context.ContextManager;
import net.luckperms.api.event.EventBus;
import net.luckperms.api.messaging.MessagingService;
import net.luckperms.api.messenger.MessengerProvider;
import net.luckperms.api.metastacking.MetaStackDefinition;
import net.luckperms.api.metastacking.MetaStackElement;
import net.luckperms.api.metastacking.MetaStackFactory;
import net.luckperms.api.model.group.Group;
import net.luckperms.api.model.group.GroupManager;
import net.luckperms.api.model.user.User;
import net.luckperms.api.model.user.UserManager;
import net.luckperms.api.node.NodeBuilderRegistry;
import net.luckperms.api.node.matcher.NodeMatcherFactory;
import net.luckperms.api.platform.Platform;
import net.luckperms.api.platform.PlayerAdapter;
import net.luckperms.api.platform.PluginMetadata;
import net.luckperms.api.query.QueryOptionsRegistry;
import net.luckperms.api.track.Track;
import net.luckperms.api.track.TrackManager;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
/**
* The LuckPerms API.
*
* <p>The API allows other plugins on the server to read and modify LuckPerms
* data, change behaviour of the plugin, listen to certain events, and integrate
* LuckPerms into other plugins and systems.</p>
*
* <p>This interface represents the base of the API package. All functions are
* accessed via this interface.</p>
*
* <p>To start using the API, you need to obtain an instance of this interface.
* These are registered by the LuckPerms plugin to the platforms Services
* Manager. This is the preferred method for obtaining an instance.</p>
*
* <p>For ease of use, and for platforms without a Service Manager, an instance
* can also be obtained from the static singleton accessor in
* {@link LuckPermsProvider}.</p>
*/
public interface LuckPerms {
/**
* Gets the name of this server.
*
* <p>This is defined in the LuckPerms configuration file, and is used for
* server specific permission handling.</p>
*
* <p>The default server name is "global".</p>
*
* @return the server name
*/
@NonNull String getServerName();
/**
* Gets the {@link UserManager}, responsible for managing
* {@link User} instances.
*
* <p>This manager can be used to retrieve instances of {@link User} by uuid
* or name, or query all loaded users.</p>
*
* @return the user manager
*/
@NonNull UserManager getUserManager();
/**
* Gets the {@link GroupManager}, responsible for managing
* {@link Group} instances.
*
* <p>This manager can be used to retrieve instances of {@link Group} by
* name, or query all loaded groups.</p>
*
* @return the group manager
*/
@NonNull GroupManager getGroupManager();
/**
* Gets the {@link TrackManager}, responsible for managing
* {@link Track} instances.
*
* <p>This manager can be used to retrieve instances of {@link Track} by
* name, or query all loaded tracks.</p>
*
* @return the track manager
*/
@NonNull TrackManager getTrackManager();
/**
* Gets the {@link PlayerAdapter} instance, a utility class for adapting platform Player
* instances to {@link User}s.
*
* <p>The {@code playerClass} parameter must be equal to the class or interface used by the
* server platform to represent players.</p>
*
* <p>Specifically:</p>
*
* <p></p>
* <ul>
* <li>{@code org.bukkit.entity.Player}</li>
* <li>{@code net.md_5.bungee.api.connection.ProxiedPlayer}</li>
* <li>{@code org.spongepowered.api/entity.living.player.Player}</li>
* <li>{@code cn.nukkit.Player}</li>
* <li>{@code com.velocitypowered.api.proxy.Player}</li>
* </ul>
*
* @param playerClass the class used by the platform to represent players
* @param <T> the player class type
* @return the player adapter
* @throws IllegalArgumentException if the player class is not correct
* @since 5.1
*/
<T> @NonNull PlayerAdapter<T> getPlayerAdapter(@NonNull Class<T> playerClass);
/**
* Gets the {@link Platform}, which represents the server platform the
* plugin is running on.
*
* @return the platform
*/
@NonNull Platform getPlatform();
/**
* Gets the {@link PluginMetadata}, responsible for providing metadata about
* the LuckPerms plugin currently running.
*
* @return the plugin metadata
*/
@NonNull PluginMetadata getPluginMetadata();
/**
* Gets the {@link EventBus}, used for subscribing to internal LuckPerms
* events.
*
* @return the event bus
*/
@NonNull EventBus getEventBus();
/**
* Gets the {@link MessagingService}, used to dispatch updates throughout a
* network of servers running the plugin.
*
* <p>Not all instances of LuckPerms will have a messaging service setup and
* configured.</p>
*
* @return the messaging service instance, if present.
*/
@NonNull Optional<MessagingService> getMessagingService();
/**
* Gets the {@link ActionLogger}, responsible for saving and broadcasting
* defined actions occurring on the platform.
*
* @return the action logger
*/
@NonNull ActionLogger getActionLogger();
/**
* Gets the {@link ContextManager}, responsible for managing
* {@link ContextCalculator}s, and calculating applicable contexts.
*
* @return the context manager
*/
@NonNull ContextManager getContextManager();
/**
* Gets the {@link NodeBuilderRegistry}.
*
* @return the node builder registry
*/
@NonNull NodeBuilderRegistry getNodeBuilderRegistry();
/**
* Gets the {@link QueryOptionsRegistry}.
*
* @return the query options registry
* @since 5.1
*/
@NonNull QueryOptionsRegistry getQueryOptionsRegistry();
/**
* Gets the {@link MetaStackFactory}.
*
* <p>The metastack factory provides methods for retrieving
* {@link MetaStackElement}s and constructing
* {@link MetaStackDefinition}s.</p>
*
* @return the meta stack factory
*/
@NonNull MetaStackFactory getMetaStackFactory();
/**
* Gets the {@link NodeMatcherFactory}.
*
* @return the node matcher factory
* @since 5.1
*/
@NonNull NodeMatcherFactory getNodeMatcherFactory();
/**
* Schedules the execution of an update task, and returns an encapsulation
* of the task as a {@link CompletableFuture}.
*
* <p>The exact actions performed in an update task remains an
* implementation detail of the plugin, however, as a minimum, it is
* expected to perform a full reload of user, group and track data, and
* ensure that any changes are fully applied and propagated.</p>
*
* @return a future
*/
@NonNull CompletableFuture<Void> runUpdateTask();
/**
* Registers a {@link MessengerProvider} for use by the platform.
*
* <p>Note that the mere action of registering a provider doesn't
* necessarily mean that it will be used.</p>
*
* @param messengerProvider the messenger provider.
*/
void registerMessengerProvider(@NonNull MessengerProvider messengerProvider);
}
@@ -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
@@ -20,48 +23,44 @@
* SOFTWARE.
*/
package me.lucko.luckperms;
package net.luckperms.api;
import me.lucko.luckperms.api.LuckPermsApi;
import java.util.Optional;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Static access to LuckPerms
* Provides static access to the {@link LuckPerms} service.
*
* <p>Ideally, the ServiceManager for the platform should be used to obtain an
* instance, however, this provider can be used if you need static access.</p>
*/
public final class LuckPerms {
private static LuckPermsApi api = null;
public final class LuckPermsProvider {
private static LuckPerms instance = null;
/**
* Gets an instance of {@link LuckPermsApi}
* Gets an instance of the {@link LuckPerms} service,
* throwing {@link IllegalStateException} if an instance is not yet loaded.
*
* <p>Will never return null.</p>
*
* @return an api instance
* @throws IllegalStateException if the api is not loaded
*/
public static LuckPermsApi getApi() {
if (api == null) {
throw new IllegalStateException("API is not loaded.");
public static @NonNull LuckPerms get() {
if (instance == null) {
throw new IllegalStateException("The LuckPerms API is not loaded.");
}
return api;
return instance;
}
/**
* Gets an instance of {@link LuckPermsApi} safely. Unlike {@link LuckPerms#getApi}, this method will not throw an
* {@link IllegalStateException} if the api is not loaded, rather return an empty {@link Optional}.
* @return an optional api instance
*/
public static Optional<LuckPermsApi> getApiSafe() {
return Optional.ofNullable(api);
static void register(LuckPerms instance) {
LuckPermsProvider.instance = instance;
}
static void registerProvider(LuckPermsApi luckPermsApi) {
api = luckPermsApi;
static void unregister() {
LuckPermsProvider.instance = null;
}
static void unregisterProvider() {
api = null;
}
private LuckPerms() {
private LuckPermsProvider() {
throw new UnsupportedOperationException("This class cannot be instantiated.");
}
@@ -0,0 +1,208 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.actionlog;
import net.luckperms.api.LuckPermsProvider;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.time.Instant;
import java.util.Optional;
import java.util.UUID;
/**
* Represents a logged action.
*/
public interface Action extends Comparable<Action> {
/**
* Gets a {@link Action.Builder}
*
* @return a new builder
*/
static @NonNull Builder builder() {
return LuckPermsProvider.get().getActionLogger().actionBuilder();
}
/**
* Gets the time when the action occurred.
*
* @return the timestamp
*/
@NonNull Instant getTimestamp();
/**
* Gets the source of the action.
*
* @return the source
*/
@NonNull Source getSource();
/**
* Gets the target of the action.
*
* @return the target
*/
@NonNull Target getTarget();
/**
* Returns a string describing the action which took place.
*
* <p>In most instances, this returns a variation of the command string which caused
* the change.</p>
*
* @return the action
*/
@NonNull String getDescription();
/**
* Represents the source of an action.
*/
interface Source {
/**
* Gets the source unique id.
*
* @return the source unique id
*/
@NonNull UUID getUniqueId();
/**
* Gets the source name.
*
* @return the source name
*/
@NonNull String getName();
}
/**
* Represents the target of an action.
*/
interface Target {
/**
* Gets the target unique id.
*
* @return the target unique id
*/
@NonNull Optional<UUID> getUniqueId();
/**
* Gets the target name.
*
* @return the target name
*/
@NonNull String getName();
/**
* Gets the target type.
*
* @return the target type
*/
@NonNull Type getType();
/**
* Represents the type of a {@link Target}.
*/
enum Type {
USER, GROUP, TRACK
}
}
/**
* Builds an {@link Action} instance
*/
interface Builder {
/**
* Sets the timestamp of the entry.
*
* @param timestamp the timestamp
* @return the builder
* @see Action#getTimestamp()
*/
@NonNull Builder timestamp(@NonNull Instant timestamp);
/**
* Sets the actor of the entry.
*
* @param actor the actor
* @return the builder
*/
@NonNull Builder source(@NonNull UUID actor);
/**
* Sets the actor name of the entry.
*
* @param actorName the actor name
* @return the builder
*/
@NonNull Builder sourceName(@NonNull String actorName);
/**
* Sets the type of the entry.
*
* @param type the type
* @return the builder
*/
@NonNull Builder targetType(Action.Target.Type type);
/**
* Sets the acted object for the entry.
*
* @param acted the acted object
* @return the builder
*/
@NonNull Builder target(@Nullable UUID acted);
/**
* Sets the acted name for the entry.
*
* @param actedName the acted name
* @return the builder
*/
@NonNull Builder targetName(@NonNull String actedName);
/**
* Sets the action of the entry.
*
* @param action the action
* @return the builder
*/
@NonNull Builder description(@NonNull String action);
/**
* Creates a {@link Action} instance from the builder.
*
* @return a new log entry instance
*/
@NonNull Action build();
}
}
@@ -0,0 +1,84 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.actionlog;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.SortedSet;
import java.util.UUID;
/**
* Represents the internal LuckPerms log.
*
* <p>The returned instance provides a copy of the data at the time of retrieval.</p>
*
* <p>Any changes made to log entries will only apply to this instance of the log.
* You can add to the log using the {@link ActionLogger}, and then request an updated copy.</p>
*
* <p>All methods are thread safe, and return immutable and thread safe collections.</p>
*/
public interface ActionLog {
/**
* Gets the {@link Action}s that make up this log.
*
* @return the content
*/
@NonNull SortedSet<Action> getContent();
/**
* Gets the entries in the log performed by the given actor.
*
* @param actor the uuid of the actor to filter by
* @return the content for the given actor
*/
@NonNull SortedSet<Action> getContent(@NonNull UUID actor);
/**
* Gets the log content for a given user
*
* @param uniqueId the uuid to filter by
* @return all content in this log where the user = uuid
*/
@NonNull SortedSet<Action> getUserHistory(@NonNull UUID uniqueId);
/**
* Gets the log content for a given group
*
* @param name the name to filter by
* @return all content in this log where the group = name
*/
@NonNull SortedSet<Action> getGroupHistory(@NonNull String name);
/**
* Gets the log content for a given track
*
* @param name the name to filter by
* @return all content in this log where the track = name
*/
@NonNull SortedSet<Action> getTrackHistory(@NonNull String name);
}
@@ -0,0 +1,90 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.actionlog;
import net.luckperms.api.messaging.MessagingService;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.concurrent.CompletableFuture;
/**
* Represents the object responsible for handling action logging.
*/
public interface ActionLogger {
/**
* Returns a new {@link Action.Builder} instance
*
* @return a new builder
*/
Action.@NonNull Builder actionBuilder();
/**
* Gets a {@link ActionLog} instance from the plugin storage.
*
* @return a log instance
*/
@NonNull CompletableFuture<ActionLog> getLog();
/**
* Submits a log entry to the plugin to be handled.
*
* <p>This method submits the log to the storage provider and broadcasts
* it.</p>
*
* <p>It is therefore roughly equivalent to calling
* {@link #submitToStorage(Action)} and {@link #broadcastAction(Action)},
* however, using this method is preferred to making the calls individually.</p>
*
* <p>If you want to submit a log entry but don't know which method to pick,
* use this one.</p>
*
* @param entry the entry to submit
* @return a future which will complete when the action is done
*/
@NonNull CompletableFuture<Void> submit(@NonNull Action entry);
/**
* Submits a log entry to the plugins storage handler.
*
* @param entry the entry to submit
* @return a future which will complete when the action is done
*/
@NonNull CompletableFuture<Void> submitToStorage(@NonNull Action entry);
/**
* Submits a log entry to the plugins log broadcasting handler.
*
* <p>If enabled, this method will also dispatch the log entry via the
* plugins {@link MessagingService}.</p>
*
* @param entry the entry to submit
* @return a future which will complete when the action is done
*/
@NonNull CompletableFuture<Void> broadcastAction(@NonNull Action entry);
}
@@ -0,0 +1,44 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.cacheddata;
import net.luckperms.api.query.QueryOptions;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Holds cached lookup data for a given set of query options.
*/
public interface CachedData {
/**
* Gets the query options this container is holding data for.
*
* @return the query options this container is caching
*/
@NonNull QueryOptions getQueryOptions();
}
@@ -0,0 +1,250 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.cacheddata;
import net.luckperms.api.context.ContextManager;
import net.luckperms.api.model.PermissionHolder;
import net.luckperms.api.model.group.Group;
import net.luckperms.api.model.user.User;
import net.luckperms.api.query.QueryOptions;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.concurrent.CompletableFuture;
/**
* Holds cached permission and meta lookup data for a {@link PermissionHolder}.
*
* <p>All calls will account for inheritance, as well as any default data
* provided by the platform. This calls are heavily cached and are therefore
* fast.</p>
*/
public interface CachedDataManager {
/**
* Gets the manager for {@link CachedPermissionData}.
*
* @return the permission data manager
*/
@NonNull Container<CachedPermissionData> permissionData();
/**
* Gets the manager for {@link CachedMetaData}.
*
* @return the meta data manager
*/
@NonNull Container<CachedMetaData> metaData();
/**
* Gets PermissionData from the cache, using the given query options.
*
* @param queryOptions the query options
* @return a permission data instance
*/
@NonNull CachedPermissionData getPermissionData(@NonNull QueryOptions queryOptions);
/**
* Gets MetaData from the cache, using the given query options.
*
* @param queryOptions the query options
* @return a meta data instance
*/
@NonNull CachedMetaData getMetaData(@NonNull QueryOptions queryOptions);
/**
* Gets PermissionData from the cache, using the most appropriate query options
* available at the time.
*
* <p>For {@link User}s, the most appropriate query options will be their
* {@link ContextManager#getQueryOptions(User) current active query options} if the
* corresponding player is online, and otherwise, will fallback to
* {@link ContextManager#getStaticQueryOptions() the current static query options}
* if they are offline.</p>
*
* <p>For {@link Group}s, the most appropriate query options will always be
* {@link ContextManager#getStaticQueryOptions()} the current static query options.</p>
*
* @return a permission data instance
* @since 5.1
*/
@NonNull CachedPermissionData getPermissionData();
/**
* Gets MetaData from the cache, using the most appropriate query options
* available at the time.
*
* <p>For {@link User}s, the most appropriate query options will be their
* {@link ContextManager#getQueryOptions(User) current active query options} if the
* corresponding player is online, and otherwise, will fallback to
* {@link ContextManager#getStaticQueryOptions() the current static query options}
* if they are offline.</p>
*
* <p>For {@link Group}s, the most appropriate query options will always be
* {@link ContextManager#getStaticQueryOptions()} the current static query options.</p>
*
* @return a meta data instance
* @since 5.1
* @see PermissionHolder#getQueryOptions()
*/
@NonNull CachedMetaData getMetaData();
/**
* Invalidates all cached {@link CachedPermissionData} and {@link CachedMetaData}
* instances.
*/
void invalidate();
/**
* Invalidates all of the underlying Permission calculators.
*
* <p>Can be called to allow for an update in defaults.</p>
*/
void invalidatePermissionCalculators();
/**
* Manages a specific type of {@link CachedData cached data} within
* a {@link CachedDataManager} instance.
*
* @param <T> the data type
*/
interface Container<T extends CachedData> {
/**
* Gets {@link T data} from the cache.
*
* @param queryOptions the query options
* @return a data instance
* @throws NullPointerException if contexts is null
*/
@NonNull T get(@NonNull QueryOptions queryOptions);
/**
* Calculates {@link T data}, bypassing the cache.
*
* <p>The result of this operation is calculated each time the method is called.
* The result is not added to the internal cache.</p>
*
* <p>It is therefore highly recommended to use {@link #get(QueryOptions)} instead.</p>
*
* <p>The use cases of this method are more around constructing one-time
* instances of {@link T data}, without adding the result to the cache.</p>
*
* @param queryOptions the query options
* @return a data instance
* @throws NullPointerException if contexts is null
*/
@NonNull T calculate(@NonNull QueryOptions queryOptions);
/**
* (Re)calculates data for a given context.
*
* <p>This method returns immediately in all cases. The (re)calculation is
* performed asynchronously and applied to the cache in the background.</p>
*
* <p>If there was a previous data instance associated with
* the given {@link QueryOptions}, then that instance will continue to be returned by
* {@link #get(QueryOptions)} until the recalculation is completed.</p>
*
* <p>If there was no value calculated and cached prior to the call of this
* method, then one will be calculated.</p>
*
* @param queryOptions the query options
* @throws NullPointerException if contexts is null
*/
void recalculate(@NonNull QueryOptions queryOptions);
/**
* (Re)loads permission data for a given context.
*
* <p>Unlike {@link #recalculate(QueryOptions)}, this method immediately
* invalidates any previous data values contained within the cache,
* and then schedules a task to reload a new data instance to
* replace the one which was invalidated.</p>
*
* <p>The invalidation happens immediately during the execution of this method.
* The result of the re-computation encapsulated by the future.</p>
*
* <p>Subsequent calls to {@link #get(QueryOptions)} will block until
* the result of this operation is complete.</p>
*
* <p>If there was no value calculated and cached prior to the call of this
* method, then one will be calculated.</p>
*
* <p>This method returns a Future so users can optionally choose to wait
* until the recalculation has been performed.</p>
*
* @param queryOptions the query options.
* @return a future
* @throws NullPointerException if contexts is null
*/
@NonNull CompletableFuture<? extends T> reload(@NonNull QueryOptions queryOptions);
/**
* Recalculates data for all known contexts.
*
* <p>This method returns immediately. The recalculation is performed
* asynchronously and applied to the cache in the background.</p>
*
* <p>The previous data instances will continue to be returned
* by {@link #get(QueryOptions)} until the recalculation is completed.</p>
*/
void recalculate();
/**
* Reloads permission data for all known contexts.
*
* <p>Unlike {@link #recalculate()}, this method immediately
* invalidates all previous data values contained within the cache,
* and then schedules a task to reload new data instances to
* replace the ones which were invalidated.</p>
*
* <p>The invalidation happens immediately during the execution of this method.
* The result of the re-computation encapsulated by the future.</p>
*
* <p>Subsequent calls to {@link #get(QueryOptions)} will block until
* the result of this operation is complete.</p>
*
* <p>This method returns a Future so users can optionally choose to wait
* until the recalculation has been performed.</p>
*
* @return a future
*/
@NonNull CompletableFuture<Void> reload();
/**
* Invalidates any cached data instances mapped to the given context.
*
* @param queryOptions the queryOptions to invalidate for
*/
void invalidate(@NonNull QueryOptions queryOptions);
/**
* Invalidates all cached data instances.
*/
void invalidate();
}
}
@@ -0,0 +1,111 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.cacheddata;
import net.luckperms.api.metastacking.MetaStackDefinition;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
/**
* Holds cached meta lookup data for a specific set of contexts.
*/
public interface CachedMetaData extends CachedData {
/**
* Gets a value for the given meta key.
*
* @param key the key
* @return the value
*/
@Nullable String getMetaValue(String key);
/**
* Gets the holder's highest priority prefix, or null if the holder has no prefixes
*
* @return a prefix string, or null
*/
@Nullable String getPrefix();
/**
* Gets the holder's highest priority suffix, or null if the holder has no suffixes
*
* @return a suffix string, or null
*/
@Nullable String getSuffix();
/**
* Gets an immutable copy of the meta this holder has.
*
* @return an immutable map of meta
*/
@NonNull Map<String, List<String>> getMeta();
/**
* Gets an immutable sorted map of all of the prefixes the holder has, whereby the first
* value is the highest priority prefix.
*
* @return a sorted map of prefixes
*/
@NonNull SortedMap<Integer, String> getPrefixes();
/**
* Gets an immutable sorted map of all of the suffixes the holder has, whereby the first
* value is the highest priority suffix.
*
* @return a sorted map of suffixes
*/
@NonNull SortedMap<Integer, String> getSuffixes();
/**
* Gets the name of the holders primary group.
*
* <p>Will return {@code null} for Group holder types.</p>
*
* @return the name of the primary group
* @since 5.1
*/
@Nullable String getPrimaryGroup();
/**
* Gets the definition used for the prefix stack
*
* @return the definition used for the prefix stack
*/
@NonNull MetaStackDefinition getPrefixStackDefinition();
/**
* Gets the definition used for the suffix stack
*
* @return the definition used for the suffix stack
*/
@NonNull MetaStackDefinition getSuffixStackDefinition();
}
@@ -0,0 +1,62 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.cacheddata;
import net.luckperms.api.util.Tristate;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Map;
/**
* Holds cached permission lookup data for a specific set of contexts.
*/
public interface CachedPermissionData extends CachedData {
/**
* Gets a permission check result for the given permission node.
*
* @param permission the permission node
* @return a tristate result
* @throws NullPointerException if permission is null
*/
@NonNull Tristate checkPermission(@NonNull String permission);
/**
* Invalidates the underlying permission calculator cache.
*
* <p>Can be called to allow for an update in defaults.</p>
*/
void invalidateCache();
/**
* Gets an immutable copy of the permission map backing the permission calculator
*
* @return an immutable set of permissions
*/
@NonNull Map<String, Boolean> getPermissionMap();
}
@@ -0,0 +1,99 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.context;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Represents an individual context pair.
*
* <p>Context keys and values may not be null or empty. A key/value will be
* deemed empty if it's length is zero, or if it consists of only space
* characters.</p>
*/
public interface Context {
/**
* Tests whether {@code key} is valid.
*
* <p>Context keys and values may not be null or empty. A key/value will be
* deemed empty if it's length is zero, or if it consists of only space
* characters.</p>
*
* <p>An exception is thrown when an invalid key is added to a {@link ContextSet}.</p>
*
* @param key the key to test
* @return true if valid, false otherwise.
* @since 5.1
*/
static boolean isValidKey(@Nullable String key) {
if (key == null || key.isEmpty()) {
return false;
}
// look for a non-whitespace character
for (int i = 0, n = key.length(); i < n; i++) {
if (key.charAt(i) != ' ') {
return true;
}
}
return false;
}
/**
* Tests whether {@code value} is valid.
*
* <p>Context keys and values may not be null or empty. A key/value will be
* deemed empty if it's length is zero, or if it consists of only space
* characters.</p>
*
* <p>An exception is thrown when an invalid value is added to a {@link ContextSet}.</p>
*
* @param value the value to test
* @return true if valid, false otherwise.
* @since 5.1
*/
static boolean isValidValue(@Nullable String value) {
return isValidKey(value); // the same for now...
}
/**
* Gets the context key.
*
* @return the key
*/
@NonNull String getKey();
/**
* Gets the context value
*
* @return the value
*/
@NonNull String getValue();
}
@@ -0,0 +1,110 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.context;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
import java.util.function.Function;
/**
* Calculates the contexts applicable for a contextual subject.
*
* <p>Implementations of this interface should satisfy the following
* requirements:</p>
* <ul>
* <li>Context lookups should be <i>fast</i>: lookup methods are likely to
* be invoked frequently, and should therefore be fast to execute. If
* determining the current contexts involves a particularly time consuming
* lookup (database queries, network requests, etc), then such results
* should be cached ahead of time.</li>
*
* <li>Context lookups should be <i>thread-safe</i>: lookups will sometimes
* be performed from "async" threads, and therefore should not access any
* part of the server only safe for access from a sync context. If
* necessary, such results should be determined ahead of time and stored in
* a thread-safe collection for retrieval later.</li>
*
* <li>Context lookups should <i>not query active contexts</i>: doing so is
* likely to result in a stack overflow, or thread deadlock. Care should be
* taken to avoid (indirect) calls to the same calculator.</li>
* </ul>
* <p></p>
*
* <p>Calculators should be registered using
* {@link ContextManager#registerCalculator(ContextCalculator)}.</p>
*/
@FunctionalInterface
public interface ContextCalculator<T> {
/**
* Creates a new {@link ContextCalculator} that provides a single context.
*
* @param key the key of the context provided by the calculator
* @param valueFunction the function used to compute the corresponding value
* for each query. A context will not be "accumulated"
* if the value returned is null.
* @param <T> the contextual type
* @return the resultant calculator
*/
static <T> @NonNull ContextCalculator<T> forSingleContext(@NonNull String key, @NonNull Function<T, String> valueFunction) {
Objects.requireNonNull(key, "key");
Objects.requireNonNull(valueFunction, "valueFunction");
return (target, consumer) -> {
String value = valueFunction.apply(target);
if (value != null) {
consumer.accept(key, value);
}
};
}
/**
* Submits any contexts this calculator determines to be applicable to
* the {@code target} contextual subject.
*
* <p>Care should be taken to ensure implementations of this method meet the
* general requirements for {@link ContextCalculator}, defined in the class
* doc.</p>
*
* @param target the target contextual subject for this operation
* @param consumer the {@link ContextConsumer} to submit contexts to
*/
void calculate(@NonNull T target, @NonNull ContextConsumer consumer);
/**
* Gets a {@link ContextSet}, containing some/all of the contexts this
* calculator could potentially submit.
*
* <p>The result of this call is primarily intended on providing
* suggestions to end users when defining permissions.</p>
*
* @return a set of potential contexts
*/
default ContextSet estimatePotentialContexts() {
return ImmutableContextSet.empty();
}
}
@@ -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
@@ -20,38 +23,42 @@
* SOFTWARE.
*/
package me.lucko.luckperms.tracks;
package net.luckperms.api.context;
import me.lucko.luckperms.utils.AbstractManager;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Set;
import java.util.stream.Collectors;
public class TrackManager extends AbstractManager<String, Track> {
/**
* Functional interface that accepts context key value pairs.
*/
@FunctionalInterface
public interface ContextConsumer {
/**
* Returns a set of tracks that contain at least one of the groups from the Set provided
* @param group the group to filter by
* @return a set of tracks that the groups could be a member of
* Accepts a context pair.
*
* @param key the key
* @param value the value
*/
public Set<Track> getApplicableTracks(String group) {
return objects.values().stream()
.filter(t -> t.containsGroup(group))
.collect(Collectors.toSet());
}
void accept(@NonNull String key, @NonNull String value);
@Override
protected void copy(Track from, Track to) {
to.setGroups(from.getGroups());
/**
* Accepts a context pair.
*
* @param context the context
*/
default void accept(@NonNull Context context) {
accept(context.getKey(), context.getValue());
}
/**
* Makes a new track object
* @param name The name of the track
* @return a new {@link Track} object
* Accepts a context set.
*
* @param contextSet the context set
*/
@Override
public Track make(String name) {
return new Track(name);
default void accept(@NonNull ContextSet contextSet) {
for (Context entry : contextSet) {
accept(entry);
}
}
}
@@ -0,0 +1,156 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.context;
import net.luckperms.api.model.user.User;
import net.luckperms.api.query.QueryMode;
import net.luckperms.api.query.QueryOptions;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Optional;
/**
* Manages {@link ContextCalculator}s, and calculates applicable contexts for a
* given type.
*
* <p>This interface accepts {@link Object} types as a parameter to avoid having to depend
* on specific server implementations. In all cases, the "player" or "subject" type for
* the platform must be used.</p>
*
* <p>Specifically:</p>
*
* <p></p>
* <ul>
* <li>{@code org.bukkit.entity.Player}</li>
* <li>{@code net.md_5.bungee.api.connection.ProxiedPlayer}</li>
* <li>{@code org.spongepowered.api.service.permission.Subject}</li>
* <li>{@code cn.nukkit.Player}</li>
* <li>{@code com.velocitypowered.api.proxy.Player}</li>
* </ul>
*/
public interface ContextManager {
/**
* Queries the ContextManager for current context values for the subject.
*
* @param subject the subject
* @return the applicable context for the subject
*/
@NonNull ImmutableContextSet getContext(@NonNull Object subject);
/**
* Queries the ContextManager for current context values for the given User.
*
* <p>This will only return a value if the player corresponding to the
* {@link User} is online.</p>
*
* <p>If you need to obtain a {@link ImmutableContextSet} instance
* regardless, you should initially try this method, and then fallback on
* {@link #getStaticContext()}.</p>
*
* @param user the user
* @return the applicable context for the subject
*/
@NonNull Optional<ImmutableContextSet> getContext(@NonNull User user);
/**
* Gets the contexts from the static calculators in this manager.
*
* <p>Static calculators provide the same context for all subjects, and are
* marked as such when registered.</p>
*
* @return the current active static contexts
*/
@NonNull ImmutableContextSet getStaticContext();
/**
* Creates a new {@link QueryOptions.Builder}.
*
* @param mode the mode
* @return a new query options builder
*/
QueryOptions.@NonNull Builder queryOptionsBuilder(@NonNull QueryMode mode);
/**
* Obtains current {@link QueryOptions} for the subject.
*
* @param subject the subject
* @return the query options for the subject
*/
@NonNull QueryOptions getQueryOptions(@NonNull Object subject);
/**
* Obtains current {@link QueryOptions} for the given User.
*
* <p>This will only return a value if the player corresponding to the
* {@link User} is online.</p>
*
* <p>If you need to obtain a {@link QueryOptions} instance regardless, you should
* initially try this method, and then fallback on {@link #getStaticQueryOptions()}.</p>
*
* @param user the user
* @return the query options for the subject
*/
@NonNull Optional<QueryOptions> getQueryOptions(@NonNull User user);
/**
* Gets the static query options, using the registered static context calculators.
*
* @return the current static query options
*/
@NonNull QueryOptions getStaticQueryOptions();
/**
* Registers a context calculator with the manager.
*
* @param calculator the calculator
*/
void registerCalculator(@NonNull ContextCalculator<?> calculator);
/**
* Unregisters a context calculator with the manager.
*
* @param calculator the calculator
*/
void unregisterCalculator(@NonNull ContextCalculator<?> calculator);
/**
* Gets the {@link ContextSetFactory}, responsible for creating
* {@link ContextSet} instances.
*
* @return the context set factory
*/
@NonNull ContextSetFactory getContextSetFactory();
/**
* Invalidates the lookup cache for a given subject
*
* @param subject the subject
*/
void invalidateCache(@NonNull Object subject);
}
@@ -0,0 +1,226 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.context;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
/**
* A set of contexts.
*
* <p>Context in the most basic sense simply means the circumstances where
* something will apply.</p>
*
* <p>A single "context" consists of a key and a value, both strings. The key
* represents the type of context, and the value represents the setting of the
* context key.</p>
*
* <p>Contexts can be combined with each other to form so called
* "context sets" - simply a collection of context pairs.</p>
*
* <p>Context keys and values are case-insensitive, and will be converted to
* {@link String#toLowerCase() lowercase} by all implementations.</p>
*
* <p>Context keys and values may not be null or empty. A key/value will be
* deemed empty if it's length is zero, or if it consists of only space
* characters.</p>
*
* <p>Two default ContextSet implementations are provided.
* {@link MutableContextSet} allows the addition and removal of context keys
* after construction, and {@link ImmutableContextSet} does not.</p>
*/
public interface ContextSet extends Iterable<Context> {
/**
* Gets if this {@link ContextSet} is immutable.
*
* <p>The state of immutable instances will never change.</p>
*
* @return true if the set is immutable
*/
boolean isImmutable();
/**
* Returns an immutable representation of this {@link ContextSet}.
*
* <p>If the set is already immutable, the same object will be returned.
* If the set is mutable, an immutable copy will be made.</p>
*
* @return an immutable representation of this set
*/
@NonNull ImmutableContextSet immutableCopy();
/**
* Creates a mutable copy of this {@link ContextSet}.
*
* <p>A new copy is returned regardless of the
* {@link #isImmutable() mutability} of this set.</p>
*
* @return a mutable ContextSet
*/
@NonNull MutableContextSet mutableCopy();
/**
* Returns a {@link Set} of {@link Context}s representing the current
* state of this {@link ContextSet}.
*
* <p>The returned set is immutable, and is a copy of the current set.
* (will not update live)</p>
*
* @return an immutable set
*/
@NonNull Set<Context> toSet();
/**
* Returns a {@link Map} representing the current state of this
* {@link ContextSet}.
*
* <p>The returned set is immutable, and is a copy of the current set.
* (will not update live)</p>
*
* @return a map
*/
@NonNull Map<String, Set<String>> toMap();
/**
* Returns a {@link Map} <b>loosely</b> representing the current state of
* this {@link ContextSet}.
*
* <p>The returned map is immutable, and is a copy of the current set.
* (will not update live)</p>
*
* <p>As a single context key can be mapped to multiple values, this method
* may not be a true representation of the set.</p>
*
* @return an immutable map
* @deprecated because the resultant map may not contain all data in the ContextSet
*/
@Deprecated
@NonNull Map<String, String> toFlattenedMap();
/**
* Returns an {@link Iterator} over each of the context pairs in this set.
*
* <p>The returned iterator represents the state of the set at the time of creation. It is not
* updated as the set changes.</p>
*
* <p>The iterator does not support {@link Iterator#remove()} calls.</p>
*
* @return an iterator
*/
@Override
@NonNull Iterator<Context> iterator();
/**
* Returns if the {@link ContextSet} contains at least one value for the
* given key.
*
* @param key the key to check for
* @return true if the set contains a value for the key
* @throws NullPointerException if the key is null
*/
boolean containsKey(@NonNull String key);
/**
* Returns a {@link Set} of the values mapped to the given key.
*
* <p>The returned set is immutable, and only represents the current state
* of the {@link ContextSet}. (will not update live)</p>
*
* @param key the key to get values for
* @return a set of values
* @throws NullPointerException if the key is null
*/
@NonNull Set<String> getValues(@NonNull String key);
/**
* Returns any value from this {@link ContextSet} matching the key, if present.
*
* <p>Note that context keys can be mapped to multiple values.
* Use {@link #getValues(String)} to retrieve all associated values.</p>
*
* @param key the key to find values for
* @return an optional containing any match
*/
default @NonNull Optional<String> getAnyValue(@NonNull String key) {
return getValues(key).stream().findAny();
}
/**
* Returns if the {@link ContextSet} contains a given context pairing.
*
* @param key the key to look for
* @param value the value to look for
* @return true if the set contains the context pair
* @throws NullPointerException if the key or value is null
*/
boolean contains(@NonNull String key, @NonNull String value);
/**
* Returns if the {@link ContextSet} contains a given context pairing.
*
* @param entry the entry to look for
* @return true if the set contains the context pair
* @throws NullPointerException if the key or value is null
*/
default boolean contains(@NonNull Context entry) {
Objects.requireNonNull(entry, "entry");
return contains(entry.getKey(), entry.getValue());
}
/**
* Returns if this {@link ContextSet} is fully "satisfied" by another set.
*
* <p>For a context set to "satisfy" another, it must itself contain all of
* the context pairings in the other set.</p>
*
* <p>Mathematically, this method returns true if this set is a <b>subset</b> of the other.</p>
*
* @param other the other set to check
* @return true if all entries in this set are also in the other set
*/
boolean isSatisfiedBy(@NonNull ContextSet other);
/**
* Returns if the {@link ContextSet} is empty.
*
* @return true if the set is empty
*/
boolean isEmpty();
/**
* Gets the number of context pairs in the {@link ContextSet}.
*
* @return the size of the set
*/
int size();
}
@@ -0,0 +1,43 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.context;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A factory for creating {@link ContextSet}s.
*/
public interface ContextSetFactory {
ImmutableContextSet.@NonNull Builder immutableBuilder();
@NonNull ImmutableContextSet immutableOf(@NonNull String key, @NonNull String value);
@NonNull ImmutableContextSet immutableEmpty();
@NonNull MutableContextSet mutable();
}
@@ -0,0 +1,46 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.context;
/**
* Some default context keys used by the plugin.
*/
public final class DefaultContextKeys {
private DefaultContextKeys() {
throw new AssertionError();
}
/**
* The context key used to denote the subjects server.
*/
public static final String SERVER_KEY = "server";
/**
* The context key used to denote the subjects world.
*/
public static final String WORLD_KEY = "world";
}
@@ -0,0 +1,139 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.context;
import net.luckperms.api.LuckPermsProvider;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
/**
* An immutable implementation of {@link ContextSet}.
*/
public interface ImmutableContextSet extends ContextSet {
/**
* Creates an {@link ImmutableContextSet.Builder}.
*
* @return a new ImmutableContextSet builder
*/
static @NonNull Builder builder() {
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableBuilder();
}
/**
* Returns an empty {@link ImmutableContextSet}.
*
* @return an empty ImmutableContextSet
*/
static @NonNull ImmutableContextSet empty() {
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableEmpty();
}
/**
* Creates an {@link ImmutableContextSet} from a context pair.
*
* @param key the key
* @param value the value
* @return a new ImmutableContextSet containing one context pair
* @throws NullPointerException if key or value is null
*/
static @NonNull ImmutableContextSet of(@NonNull String key, @NonNull String value) {
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableOf(key, value);
}
/**
* @deprecated Already immutable!
*/
@Override
@Deprecated
@NonNull ImmutableContextSet immutableCopy();
/**
* A builder for {@link ImmutableContextSet}.
*/
interface Builder {
/**
* Adds a context to the set.
*
* @param key the key to add
* @param value the value to add
* @return the builder
* @throws NullPointerException if the key or value is null
* @see MutableContextSet#add(String, String)
*/
@NonNull Builder add(@NonNull String key, @NonNull String value);
/**
* Adds a context to the set.
*
* @param entry the entry to add
* @return the builder
* @throws NullPointerException if the entry is null
* @see MutableContextSet#add(Context)
*/
default @NonNull Builder add(@NonNull Context entry) {
Objects.requireNonNull(entry, "entry");
add(entry.getKey(), entry.getValue());
return this;
}
/**
* Adds the contexts contained in the given {@link Iterable} to the set.
*
* @param iterable an iterable of key value context pairs
* @return the builder
* @throws NullPointerException if iterable is null
* @see MutableContextSet#addAll(Iterable)
*/
default @NonNull Builder addAll(@NonNull Iterable<Context> iterable) {
for (Context e : Objects.requireNonNull(iterable, "iterable")) {
add(e);
}
return this;
}
/**
* Adds of of the contexts in another {@link ContextSet} to the set.
*
* @param contextSet the set to add from
* @return the builder
* @throws NullPointerException if the contextSet is null
* @see MutableContextSet#addAll(ContextSet)
*/
@NonNull Builder addAll(@NonNull ContextSet contextSet);
/**
* Creates a {@link ImmutableContextSet} from the values previously
* added to the builder.
*
* @return an {@link ImmutableContextSet} from the builder
*/
@NonNull ImmutableContextSet build();
}
}
@@ -0,0 +1,126 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.context;
import net.luckperms.api.LuckPermsProvider;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
/**
* A mutable implementation of {@link ContextSet}.
*/
public interface MutableContextSet extends ContextSet {
/**
* Creates a new empty MutableContextSet.
*
* @return a new MutableContextSet
*/
static @NonNull MutableContextSet create() {
return LuckPermsProvider.get().getContextManager().getContextSetFactory().mutable();
}
/**
* Creates a {@link MutableContextSet} from a context pair.
*
* @param key the key
* @param value the value
* @return a new MutableContextSet containing one context pair
* @throws NullPointerException if key or value is null
*/
static @NonNull MutableContextSet of(@NonNull String key, @NonNull String value) {
Objects.requireNonNull(key, "key");
Objects.requireNonNull(value, "value");
MutableContextSet set = create();
set.add(key, value);
return set;
}
/**
* Adds a context to this set.
*
* @param key the key to add
* @param value the value to add
* @throws NullPointerException if the key or value is null
*/
void add(@NonNull String key, @NonNull String value);
/**
* Adds a context to this set.
*
* @param entry the entry to add
* @throws NullPointerException if the entry is null
*/
default void add(@NonNull Context entry) {
Objects.requireNonNull(entry, "entry");
add(entry.getKey(), entry.getValue());
}
/**
* Adds the contexts contained in the given {@link Iterable} to this set.
*
* @param iterable an iterable of key value context pairs
* @throws NullPointerException if iterable is null
*/
default void addAll(@NonNull Iterable<Context> iterable) {
for (Context e : Objects.requireNonNull(iterable, "iterable")) {
add(e);
}
}
/**
* Adds of of the contexts in another {@link ContextSet} to this set.
*
* @param contextSet the set to add from
* @throws NullPointerException if the contextSet is null
*/
void addAll(@NonNull ContextSet contextSet);
/**
* Removes a context from this set.
*
* @param key the key to remove
* @param value the value to remove
* @throws NullPointerException if the key or value is null
*/
void remove(@NonNull String key, @NonNull String value);
/**
* Removes all contexts from this set with the given key.
*
* @param key the key to remove
* @throws NullPointerException if the key is null
*/
void removeAll(@NonNull String key);
/**
* Removes all contexts from the set.
*/
void clear();
}
@@ -0,0 +1,75 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.context;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
import java.util.function.Supplier;
/**
* Extension of {@link ContextCalculator} which provides the same context
* regardless of the subject.
*/
@FunctionalInterface
public interface StaticContextCalculator extends ContextCalculator<Object> {
/**
* Creates a new {@link StaticContextCalculator} that provides a single context.
*
* @param key the key of the context provided by the calculator
* @param valueFunction the function used to compute the corresponding value
* for each query. A context will not be "accumulated"
* if the value returned is null.
* @return the resultant calculator
*/
static StaticContextCalculator forSingleContext(String key, Supplier<String> valueFunction) {
Objects.requireNonNull(key, "key");
Objects.requireNonNull(valueFunction, "valueFunction");
return consumer -> {
String value = valueFunction.get();
if (value != null) {
consumer.accept(key, value);
}
};
}
/**
* Submits any contexts this calculator determines to be applicable.
*
* <p>Care should be taken to ensure implementations of this method meet the
* general requirements for {@link ContextCalculator}, defined in the class
* doc.</p>
*
* @param consumer the {@link ContextConsumer} to submit contexts to
*/
void calculate(@NonNull ContextConsumer consumer);
@Override
default void calculate(@NonNull Object target, @NonNull ContextConsumer consumer) {
calculate(consumer);
}
}
@@ -0,0 +1,83 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Set;
import java.util.function.Consumer;
/**
* The LuckPerms event bus.
*
* <p>Used to subscribe (or "listen") to LuckPerms events.</p>
*/
public interface EventBus {
/**
* Registers a new subscription to the given event.
*
* <p>The returned {@link EventSubscription} instance encapsulates the subscription state. It has
* methods which can be used to terminate the subscription, or view stats about the nature of
* the subscription.</p>
*
* @param eventClass the event class
* @param handler the event handler
* @param <T> the event class
* @return an event handler instance representing this subscription
*/
@NonNull <T extends LuckPermsEvent> EventSubscription<T> subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
/**
* Registers a new subscription to the given event.
*
* <p>The returned {@link EventSubscription} instance encapsulates the subscription state. It has
* methods which can be used to terminate the subscription, or view stats about the nature of
* the subscription.</p>
*
* <p>Unlike {@link #subscribe(Class, Consumer)}, this method accepts an additional parameter
* for {@code plugin}. This object must be a "plugin" instance on the platform, and is used to
* automatically {@link EventSubscription#close() unregister} the subscription when the
* corresponding plugin is disabled.</p>
*
* @param <T> the event class
* @param plugin a plugin instance to bind the subscription to.
* @param eventClass the event class
* @param handler the event handler
* @return an event handler instance representing this subscription
*/
@NonNull <T extends LuckPermsEvent> EventSubscription<T> subscribe(Object plugin, @NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
/**
* Gets a set of all registered handlers for a given event.
*
* @param eventClass the event to find handlers for
* @param <T> the event class
* @return an immutable set of event handlers
*/
@NonNull <T extends LuckPermsEvent> Set<EventSubscription<T>> getSubscriptions(@NonNull Class<T> eventClass);
}
@@ -0,0 +1,65 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.function.Consumer;
/**
* Represents a subscription to a {@link LuckPermsEvent}.
*
* @param <T> the event class
*/
public interface EventSubscription<T extends LuckPermsEvent> extends AutoCloseable {
/**
* Gets the class this handler is listening to
*
* @return the event class
*/
@NonNull Class<T> getEventClass();
/**
* Returns true if this handler is active
*
* @return true if this handler is still active
*/
boolean isActive();
/**
* Unregisters this handler from the event bus.
*/
@Override
void close();
/**
* Gets the event consumer responsible for handling the event
*
* @return the event consumer
*/
@NonNull Consumer<? super T> getHandler();
}
@@ -0,0 +1,51 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event;
import net.luckperms.api.LuckPerms;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A superinterface for all LuckPerms events.
*/
public interface LuckPermsEvent {
/**
* Get the API instance this event was dispatched from
*
* @return the api instance
*/
@NonNull LuckPerms getLuckPerms();
/**
* Gets the type of the event.
*
* @return the type of the event
*/
@NonNull Class<? extends LuckPermsEvent> getEventType();
}
@@ -0,0 +1,53 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.cause;
/**
* The cause of a group/track creation
*/
public enum CreationCause {
/**
* The creation was caused by a command
*/
COMMAND,
/**
* The creation was caused by the web editor
*/
WEB_EDITOR,
/**
* The creation was caused by an API call
*/
API,
/**
* The creation was caused by a LuckPerms internal
*/
INTERNAL
}
@@ -0,0 +1,48 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.cause;
/**
* The cause of a group/track deletion
*/
public enum DeletionCause {
/**
* The deletion was caused by a command
*/
COMMAND,
/**
* The deletion was caused by an API call
*/
API,
/**
* The deletion was caused by a LuckPerms internal
*/
INTERNAL
}
@@ -0,0 +1,47 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.extension;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.extension.Extension;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when an {@link Extension} is loaded.
*/
public interface ExtensionLoadEvent extends LuckPermsEvent {
/**
* Gets the extension that was loaded.
*
* @return the extension
*/
@Param(0)
@NonNull Extension getExtension();
}
@@ -0,0 +1,56 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.group;
import net.luckperms.api.cacheddata.CachedDataManager;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.group.Group;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a groups {@link CachedDataManager} is loaded.
*/
public interface GroupCacheLoadEvent extends LuckPermsEvent {
/**
* Gets the group whose data was loaded
*
* @return the group
*/
@Param(0)
@NonNull Group getGroup();
/**
* Gets the data that was loaded
*
* @return the loaded data
*/
@Param(1)
@NonNull CachedDataManager getLoadedData();
}
@@ -0,0 +1,56 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.group;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.cause.CreationCause;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.group.Group;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is created
*/
public interface GroupCreateEvent extends LuckPermsEvent {
/**
* Gets the new group
*
* @return the new group
*/
@Param(0)
@NonNull Group getGroup();
/**
* Gets the cause of the creation
*
* @return the cause of the creation
*/
@Param(1)
@NonNull CreationCause getCause();
}
@@ -0,0 +1,56 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.group;
import net.luckperms.api.cacheddata.CachedDataManager;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.group.Group;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a groups cached data is refreshed
*/
public interface GroupDataRecalculateEvent extends LuckPermsEvent {
/**
* Gets the group whose data was recalculated
*
* @return the group
*/
@Param(0)
@NonNull Group getGroup();
/**
* Gets the data that was recalculated
*
* @return the data
*/
@Param(1)
@NonNull CachedDataManager getData();
}
@@ -0,0 +1,66 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.group;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.cause.DeletionCause;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.node.Node;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Set;
/**
* Called when a group is deleted
*/
public interface GroupDeleteEvent extends LuckPermsEvent {
/**
* Gets the name of the deleted group
*
* @return the name of the deleted group
*/
@Param(0)
@NonNull String getGroupName();
/**
* Gets an immutable copy of the groups existing data
*
* @return a copy of the groups existing data
*/
@Param(1)
@NonNull Set<Node> getExistingData();
/**
* Gets the cause of the deletion
*
* @return the cause of the deletion
*/
@Param(2)
@NonNull DeletionCause getCause();
}
@@ -0,0 +1,37 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.group;
import net.luckperms.api.event.LuckPermsEvent;
/**
* Called when all groups have been loaded in from storage.
*
* <p>Usually only called on startup and in sync tasks.</p>
*/
public interface GroupLoadAllEvent extends LuckPermsEvent {
}
@@ -0,0 +1,49 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.group;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.group.Group;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is loaded into memory from the storage.
*
* Note that this event is not the same as {@link GroupCreateEvent}
*/
public interface GroupLoadEvent extends LuckPermsEvent {
/**
* Gets the group that was loaded
*
* @return the group that was loaded
*/
@Param(0)
@NonNull Group getGroup();
}
@@ -0,0 +1,77 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.log;
import net.luckperms.api.actionlog.Action;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a log entry is about to be sent to notifiable players on the platform
*/
public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
/**
* Gets the log entry to be broadcasted
*
* @return the log entry to be broadcasted
*/
@Param(0)
@NonNull Action getEntry();
/**
* Gets where the log entry originated from.
*
* @return the origin of the log
*/
@Param(1)
@NonNull Origin getOrigin();
/**
* Represents where a log entry is from
*/
enum Origin {
/**
* Marks a log entry which originated from the current server instance
*/
LOCAL,
/**
* Marks a log entry which originated from an API call on the current server instance
*/
LOCAL_API,
/**
* Marks a log entry which was sent to this server via the messaging service
*/
REMOTE
}
}
@@ -0,0 +1,58 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.log;
import net.luckperms.api.actionlog.Action;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
/**
* Called when a log is about to be published to the network via the MessagingService
*/
public interface LogNetworkPublishEvent extends LuckPermsEvent, Cancellable {
/**
* Gets the ID of the log entry being published
*
* @return the id of the log entry being published
*/
@Param(0)
@NonNull UUID getLogId();
/**
* Gets the log entry to be published
*
* @return the log entry to be published
*/
@Param(1)
@NonNull Action getEntry();
}
@@ -0,0 +1,91 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.log;
import net.luckperms.api.actionlog.Action;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.platform.PlatformEntity;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a log entry is about to be sent to specific notifiable object on
* the platform.
*
* <p>This event is not called for players without the notify permission,
* but is called for objects which are ignoring log notifications (called with
* the cancelled flag set to true).</p>
*/
public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
/**
* Gets the log entry to be sent
*
* @return the log entry to be sent
*/
@Param(0)
@NonNull Action getEntry();
/**
* Gets where the log entry originated from.
*
* @return the origin of the log
*/
@Param(1)
@NonNull Origin getOrigin();
/**
* Gets the object to be notified.
*
* @return the object to notify
*/
@Param(2)
@NonNull PlatformEntity getNotifiable();
/**
* Represents where a log entry is from
*/
enum Origin {
/**
* Marks a log entry which originated from the current server instance
*/
LOCAL,
/**
* Marks a log entry which originated from an API call on the current server instance
*/
LOCAL_API,
/**
* Marks a log entry which was sent to this server via the messaging service
*/
REMOTE
}
}
@@ -0,0 +1,48 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.log;
import net.luckperms.api.actionlog.Action;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a log is about to be published to the storage file/table
*/
public interface LogPublishEvent extends LuckPermsEvent, Cancellable {
/**
* Gets the log entry to be published
*
* @return the log entry to be published
*/
@Param(0)
@NonNull Action getEntry();
}
@@ -0,0 +1,57 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.log;
import net.luckperms.api.actionlog.Action;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
/**
* Called when a log entry is received via the MessagingService
*/
public interface LogReceiveEvent extends LuckPermsEvent {
/**
* Gets the ID of the log entry being received
*
* @return the id of the log entry being received
*/
@Param(0)
@NonNull UUID getLogId();
/**
* Gets the log entry being received
*
* @return the log entry being received
*/
@Param(1)
@NonNull Action getEntry();
}
@@ -0,0 +1,46 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.node;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.node.Node;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a node is added to a holder
*/
public interface NodeAddEvent extends NodeMutateEvent {
/**
* Gets the node that was added
*
* @return the node that was added
*/
@Param(4)
@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
@@ -20,11 +23,11 @@
* SOFTWARE.
*/
package me.lucko.luckperms.exceptions;
package net.luckperms.api.event.node;
/**
* Thrown when a permission holding object already has a permission, is already a member of a group, or when a track
* already contains a group.
* Called when a holder has their nodes cleared
*/
public class ObjectAlreadyHasException extends Exception {
public interface NodeClearEvent extends NodeMutateEvent {
}
@@ -0,0 +1,99 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.node;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.PermissionHolder;
import net.luckperms.api.model.data.DataType;
import net.luckperms.api.model.group.Group;
import net.luckperms.api.model.user.User;
import net.luckperms.api.node.Node;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Set;
/**
* Called when a node is added to/removed from a user/group
*/
public interface NodeMutateEvent extends LuckPermsEvent {
/**
* Gets the target of the event
*
* @return the event target
*/
@Param(0)
@NonNull PermissionHolder getTarget();
/**
* Gets the data type that was mutated.
*
* @return the data type
*/
@Param(1)
@NonNull DataType getDataType();
/**
* Gets an immutable copy of the holders data before the change
*
* @return the data before the change
*/
@Param(2)
@NonNull Set<Node> getDataBefore();
/**
* Gets an immutable copy of the holders data after the change
*
* @return the data after the change
*/
@Param(3)
@NonNull Set<Node> getDataAfter();
/**
* Gets whether the target of this event is a {@link User}
*
* <p>This is equivalent to checking if getTarget() instanceof User</p>
*
* @return if the event is targeting a user
*/
default boolean isUser() {
return getTarget() instanceof User;
}
/**
* Gets whether the target of this event is a {@link Group}
*
* <p>This is equivalent to checking if getTarget() instanceof Group</p>
*
* @return if the event is targeting a group
*/
default boolean isGroup() {
return getTarget() instanceof Group;
}
}
@@ -0,0 +1,46 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.node;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.node.Node;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a node is removed from a holder
*/
public interface NodeRemoveEvent extends NodeMutateEvent {
/**
* Gets the node that was removed
*
* @return the node that was removed
*/
@Param(4)
@NonNull Node getNode();
}
@@ -0,0 +1,68 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.player;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.PlayerSaveResult;
import net.luckperms.api.model.user.UserManager;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
/**
* Called when player data is saved to the storage.
*
* <p>Data can be saved using {@link UserManager#savePlayerData(UUID, String)}.</p>
*/
public interface PlayerDataSaveEvent extends LuckPermsEvent {
/**
* Gets the unique ID that was saved.
*
* @return the uuid
*/
@Param(0)
@NonNull UUID getUniqueId();
/**
* Gets the username that was saved.
*
* @return the username
*/
@Param(1)
@NonNull String getUsername();
/**
* Gets the result of the operation.
*
* @return the result
*/
@Param(2)
@NonNull PlayerSaveResult getResult();
}
@@ -0,0 +1,93 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.player;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.user.User;
import net.luckperms.api.util.Result;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
/**
* Called when LuckPerms has finished processing a Player's initial connection.
*
* <p>This event will always execute during the platforms async connection
* event. The LuckPerms platform listener processing the connection will block
* while this event is posted.</p>
*
* <p>This, among other things, allows you to wait until permission data is
* loaded for a User during the BungeeCord 'LoginEvent', as event priorities are
* ignored by the current implementation.</p>
*
* <p>The implementation will make an attempt to ensure this event is called
* for all connections, even if the operation to load User data was not
* successful. Note that LuckPerms will usually cancel the platform connection
* event if data could not be loaded.</p>
*/
public interface PlayerLoginProcessEvent extends LuckPermsEvent, Result {
/**
* Gets the UUID of the connection which was processed
*
* @return the uuid of the connection which was processed
*/
@Param(0)
@NonNull UUID getUniqueId();
/**
* Gets the username of the connection which was processed
*
* @return the username of the connection which was processed
*/
@Param(1)
@NonNull String getUsername();
/**
* Gets if the login was processed successfully.
*
* @return true if the login was successful
*/
@Override
default boolean wasSuccessful() {
return getUser() != null;
}
/**
* Gets the resultant User instance which was loaded.
*
* <p>Returns {@code null} if the login was not processed
* {@link #wasSuccessful() successfully.}</p>
*
* @return the user instance
*/
@Param(2)
@Nullable User getUser();
}
@@ -0,0 +1,44 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.source;
import net.luckperms.api.platform.PlatformEntity;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an {@link PlatformEntity} which was the {@link Source} of something.
*/
public interface EntitySource extends Source {
/**
* Gets the entity.
*
* @return the entity
*/
@NonNull PlatformEntity getEntity();
}
@@ -0,0 +1,64 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.source;
import net.luckperms.api.platform.PlatformEntity;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents the source of an event.
*
* <p>Could also be described as the "thing" that caused an event to occur.</p>
*/
public interface Source {
/**
* Gets the source type
*
* @return the type
*/
@NonNull Type getType();
/**
* Represents a type of source
*/
enum Type {
/**
* Represents an {@link PlatformEntity} source
*
* @see EntitySource
*/
ENTITY,
/**
* Represents an unknown source
*/
UNKNOWN
}
}
@@ -0,0 +1,35 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.sync;
import net.luckperms.api.event.LuckPermsEvent;
/**
* Called when the configuration is reloaded
*/
public interface ConfigReloadEvent extends LuckPermsEvent {
}
@@ -0,0 +1,35 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.sync;
import net.luckperms.api.event.LuckPermsEvent;
/**
* Called when an sync task has been completed
*/
public interface PostSyncEvent extends LuckPermsEvent {
}
@@ -0,0 +1,49 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.sync;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
/**
* Called before a received network sync task runs
*/
public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
/**
* Gets the ID of the sync request
*
* @return the id of the sync request
*/
@Param(0)
@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
@@ -20,18 +23,14 @@
* SOFTWARE.
*/
package me.lucko.luckperms.api;
package net.luckperms.api.event.sync;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
/**
* A wrapper class for platform logger instances.
*
* <p> Bukkit/Bungee both use java.util.logging, and Sponge uses org.slf4j. This class wraps those classes so the commons
* module can access a logger.
* Called before a sync task runs
*/
public interface Logger {
void info(String s);
void warn(String s);
void severe(String s);
public interface PreSyncEvent extends LuckPermsEvent, Cancellable {
}
@@ -0,0 +1,56 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.track;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.cause.CreationCause;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.track.Track;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a track is created
*/
public interface TrackCreateEvent extends LuckPermsEvent {
/**
* Gets the new track
*
* @return the new track
*/
@Param(0)
@NonNull Track getTrack();
/**
* Gets the cause of the creation
*
* @return the cause of the creation
*/
@Param(1)
@NonNull CreationCause getCause();
}
@@ -0,0 +1,65 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.track;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.cause.DeletionCause;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.List;
/**
* Called when a track is deleted
*/
public interface TrackDeleteEvent extends LuckPermsEvent {
/**
* Gets the name of the deleted track
*
* @return the name of the deleted track
*/
@Param(0)
@NonNull String getTrackName();
/**
* Gets an immutable copy of the tracks existing data
*
* @return a copy of the tracks existing data
*/
@Param(1)
@NonNull List<String> getExistingData();
/**
* Gets the cause of the deletion
*
* @return the cause of the deletion
*/
@Param(2)
@NonNull DeletionCause getCause();
}
@@ -0,0 +1,37 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.track;
import net.luckperms.api.event.LuckPermsEvent;
/**
* Called when all tracks have been loaded in from storage.
*
* <p>Usually only called on startup and in sync tasks.</p>
*/
public interface TrackLoadAllEvent extends LuckPermsEvent {
}
@@ -0,0 +1,49 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.track;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.track.Track;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a track is loaded into memory from the storage.
*
* Note that this event is not the same as {@link TrackCreateEvent}
*/
public interface TrackLoadEvent extends LuckPermsEvent {
/**
* Gets the track that was loaded
*
* @return the track that was loaded
*/
@Param(0)
@NonNull Track getTrack();
}
@@ -0,0 +1,45 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.track.mutate;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is added to a track
*/
public interface TrackAddGroupEvent extends TrackMutateEvent {
/**
* Gets the group that was added
*
* @return the group that was added
*/
@Param(3)
@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
@@ -20,11 +23,11 @@
* SOFTWARE.
*/
package me.lucko.luckperms.exceptions;
package net.luckperms.api.event.track.mutate;
/**
* Thrown when a permission holding object does not already have a permission, is not already a member of a group,
* or when a track doesn't contain a group.
* Called when a track is cleared
*/
public class ObjectLacksException extends Exception {
public interface TrackClearEvent extends TrackMutateEvent {
}
@@ -0,0 +1,65 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.track.mutate;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.track.Track;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.List;
/**
* Called when a track is changed
*/
public interface TrackMutateEvent extends LuckPermsEvent {
/**
* Gets the track that was mutated
*
* @return the track that was mutated
*/
@Param(0)
@NonNull Track getTrack();
/**
* Gets an immutable copy of the tracks data before the change
*
* @return the data before the change
*/
@Param(1)
@NonNull List<String> getStateBefore();
/**
* Gets an immutable copy of the tracks data after the change
*
* @return the data after the change
*/
@Param(2)
@NonNull List<String> getStateAfter();
}
@@ -0,0 +1,45 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.track.mutate;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is removed from a track
*/
public interface TrackRemoveGroupEvent extends TrackMutateEvent {
/**
* Gets the group that was removed
*
* @return the group that was removed
*/
@Param(3)
@NonNull String getGroup();
}
@@ -0,0 +1,75 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.type;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Represents an event that can be cancelled
*/
public interface Cancellable {
/**
* Gets an {@link AtomicBoolean} holding the cancellation state of the event
*
* @return the cancellation
*/
@Param(-1)
@NonNull AtomicBoolean cancellationState();
/**
* Returns true if the event is currently cancelled.
*
* @return if the event is cancelled
*/
default boolean isCancelled() {
return cancellationState().get();
}
/**
* Returns true if the event is not currently cancelled.
*
* @return if the event is not cancelled
*/
default boolean isNotCancelled() {
return !isCancelled();
}
/**
* Sets the cancellation state of the event.
*
* @param cancelled the new state
* @return the previous state
*/
default boolean setCancelled(boolean cancelled) {
return cancellationState().getAndSet(cancelled);
}
}
@@ -0,0 +1,48 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.type;
import net.luckperms.api.event.source.Source;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an event with a {@link Source}.
*/
public interface Sourced {
/**
* Gets the events source.
*
* <p>Never returns null. In situations where the source is unknown, a
* {@link Source} with type {@link Source.Type#UNKNOWN} is returned.</p>
*
* @return the source
*/
@NonNull @Param(-1) Source getSource();
}
@@ -0,0 +1,56 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.user;
import net.luckperms.api.cacheddata.CachedDataManager;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.user.User;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a users {@link CachedDataManager} is loaded.
*/
public interface UserCacheLoadEvent extends LuckPermsEvent {
/**
* Gets the user whose data was loaded
*
* @return the user
*/
@Param(0)
@NonNull User getUser();
/**
* Gets the data that was loaded
*
* @return the loaded data
*/
@Param(1)
@NonNull CachedDataManager getLoadedData();
}
@@ -0,0 +1,56 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.user;
import net.luckperms.api.cacheddata.CachedDataManager;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.user.User;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a users cached data is refreshed
*/
public interface UserDataRecalculateEvent extends LuckPermsEvent {
/**
* Gets the user whose data was recalculated
*
* @return the user
*/
@Param(0)
@NonNull User getUser();
/**
* Gets the data that was recalculated
*
* @return the data
*/
@Param(1)
@NonNull CachedDataManager getData();
}
@@ -0,0 +1,64 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.user;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
/**
* Called when the user logs into the network for the first time.
*
* <p>Particularly useful for networks with multiple
* lobbies, who want to welcome a user when they join for the first time.</p>
*
* <p>This event is fired before the player has actually joined the game on the async login / auth event. If you want to
* do something with the user, store the UUID in a set, and then check the set in the PlayerJoinEvent o.e.</p>
*
* <p>The users data will not be loaded when this event is called.</p>
*/
public interface UserFirstLoginEvent extends LuckPermsEvent {
/**
* Gets the UUID of the user
*
* @return the uuid of the user
*/
@Param(0)
@NonNull UUID getUniqueId();
/**
* Gets the username of the user
*
* @return the username of the user
*/
@Param(1)
@NonNull String getUsername();
}
@@ -0,0 +1,47 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.user;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.user.User;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a user is loaded into memory from the storage.
*/
public interface UserLoadEvent extends LuckPermsEvent {
/**
* Gets the user that was loaded
*
* @return the user that was loaded
*/
@Param(0)
@NonNull User getUser();
}
@@ -0,0 +1,43 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.user.track;
/**
* Represents the type of action performed in a {@link UserTrackEvent}
*/
public enum TrackAction {
/**
* The user was promoted up a track
*/
PROMOTION,
/**
* The user was demoted down a track
*/
DEMOTION
}
@@ -0,0 +1,41 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.user.track;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a user is demoted down a track.
*
* <p>{@link #getAction()} is always {@link TrackAction#DEMOTION}</p>
*/
public interface UserDemoteEvent extends UserTrackEvent {
@Override
default @NonNull TrackAction getAction() {
return TrackAction.DEMOTION;
}
}
@@ -0,0 +1,41 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.user.track;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a user is promoted up a track.
*
* <p>{@link #getAction()} is always {@link TrackAction#PROMOTION}</p>
*/
public interface UserPromoteEvent extends UserTrackEvent {
@Override
default @NonNull TrackAction getAction() {
return TrackAction.PROMOTION;
}
}
@@ -0,0 +1,84 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.user.track;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Sourced;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.user.User;
import net.luckperms.api.track.Track;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Optional;
/**
* Called when a user interacts with a track through a promotion or demotion
*/
public interface UserTrackEvent extends LuckPermsEvent, Sourced {
/**
* Gets the track involved in the event
*
* @return the track involved in the event
*/
@Param(0)
@NonNull Track getTrack();
/**
* Gets the user who was promoted or demoted
*
* @return the user involved in the event
*/
@Param(1)
@NonNull User getUser();
/**
* Gets the action performed
*
* @return the action performed
*/
@NonNull TrackAction getAction();
/**
* Gets the group the user was promoted/demoted from.
*
* <p>May be {@link Optional#empty()} if the user wasn't already placed on the track.</p>
*
* @return the group the user was promoted/demoted from
*/
@Param(2)
@NonNull Optional<String> getGroupFrom();
/**
* Gets the group the user was promoted/demoted to
*
* @return the group the user was promoted/demoted to
*/
@Param(3)
@NonNull Optional<String> getGroupTo();
}
@@ -0,0 +1,49 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.event.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Represents the position of a parameter within an event.
*
* <p>This is an implementation detail and should not be relied upon.</p>
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Param {
/**
* Gets the index of the parameter.
*
* @return the index
*/
int value();
}
@@ -0,0 +1,50 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.extension;
import net.luckperms.api.LuckPerms;
/**
* Represents a simple extension "plugin" for LuckPerms.
*
* <p>Yes, that's right. A plugin for a plugin.</p>
*
* <p>Extensions should either declare a no-arg constructor, or a constructor
* that accepts a single {@link LuckPerms} parameter as it's only argument.</p>
*/
public interface Extension {
/**
* Loads the extension.
*/
void load();
/**
* Unloads the extension.
*/
void unload();
}
@@ -0,0 +1,62 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.extension;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collection;
/**
* Manages extensions.
*/
public interface ExtensionManager {
/**
* Loads the given extension.
*
* @param extension the extension to load
*/
void loadExtension(Extension extension);
/**
* Loads the extension at the given path.
*
* @param path the path to the extension
* @return the extension
* @throws IOException if the extension could not be loaded
*/
@NonNull Extension loadExtension(Path path) throws IOException;
/**
* Gets a collection of all loaded extensions.
*
* @return the loaded extensions
*/
@NonNull Collection<Extension> getLoadedExtensions();
}
@@ -0,0 +1,75 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.messaging;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.model.user.User;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A means to push changes to other servers using the platforms networking
*/
public interface MessagingService {
/**
* Gets the name of this messaging service
*
* @return the name of this messaging service
*/
String getName();
/**
* Uses the messaging service to inform other servers about a general
* change.
*
* <p>The standard response by other servers will be to execute a overall
* sync of all live data, equivalent to calling
* {@link LuckPerms#runUpdateTask()}.</p>
*
* <p>This will push the update asynchronously, and this method will return
* immediately. Note that this method will not cause an update to be
* processed on the local server.</p>
*/
void pushUpdate();
/**
* Uses the messaging service to inform other servers about a change to a
* specific user.
*
* <p>The standard response by other servers is undefined, however the
* current implementation will reload the corresponding users data if they
* are online.</p>
*
* <p>This will push the update asynchronously, and this method will return
* immediately. Note that this method will not cause an update to be
* processed on the local server.</p>
*
* @param user the user to push the update for
*/
void pushUserUpdate(@NonNull User user);
}
@@ -0,0 +1,76 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.messenger;
import net.luckperms.api.messenger.message.Message;
import net.luckperms.api.messenger.message.OutgoingMessage;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Encapsulates the LuckPerms system which accepts incoming {@link Message}s
* from implementations of {@link Messenger}.
*/
public interface IncomingMessageConsumer {
/**
* Consumes a message instance.
*
* <p>The boolean returned from this method indicates whether or not the
* platform accepted the message. Some implementations which have multiple
* distribution channels may wish to use this result to dispatch the same
* message back to additional receivers.</p>
*
* <p>The implementation will usually return <code>false</code> if a message
* with the same ping id has already been processed.</p>
*
* @param message the message
* @return true if the message was accepted by the plugin
*/
boolean consumeIncomingMessage(@NonNull Message message);
/**
* Consumes a message in an encoded string format.
*
* <p>This method will decode strings obtained by calling
* {@link OutgoingMessage#asEncodedString()}. This means that basic
* implementations can successfully implement {@link Messenger} without
* providing their own serialisation.</p>
*
* <p>The boolean returned from this method indicates whether or not the
* platform accepted the message. Some implementations which have multiple
* distribution channels may wish to use this result to dispatch the same
* message back to additional receivers.</p>
*
* <p>The implementation will usually return <code>false</code> if a message
* with the same ping id has already been processed.</p>
*
* @param encodedString the encoded string
* @return true if the message was accepted by the plugin
*/
boolean consumeIncomingMessageAsString(@NonNull String encodedString);
}
@@ -0,0 +1,62 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.messenger;
import net.luckperms.api.messenger.message.Message;
import net.luckperms.api.messenger.message.OutgoingMessage;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an object which dispatches {@link OutgoingMessage}s.
*/
public interface Messenger extends AutoCloseable {
/**
* Performs the necessary action to dispatch the message using the means
* of the messenger.
*
* <p>The outgoing message instance is guaranteed to be an instance of one
* of the interfaces extending {@link Message} in the
* 'api.messenger.message.type' package.</p>
*
* <p>3rd party implementations are encouraged to implement this method with consideration
* that new types may be added in the future.</p>
*
* <p>This call is always made async.</p>
*
* @param outgoingMessage the outgoing message
*/
void sendOutgoingMessage(@NonNull OutgoingMessage outgoingMessage);
/**
* Performs the necessary action to gracefully shutdown the messenger.
*/
@Override
default void close() {
}
}
@@ -0,0 +1,62 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.messenger;
import net.luckperms.api.LuckPerms;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents a provider for {@link Messenger} instances.
*
* <p>Users wishing to provide their own implementation for the plugins
* "Messaging Service" should implement and register this interface.</p>
*
* @see LuckPerms#registerMessengerProvider(MessengerProvider)
*/
public interface MessengerProvider {
/**
* Gets the name of this provider.
*
* @return the provider name
*/
@NonNull String getName();
/**
* Creates and returns a new {@link Messenger} instance, which passes
* incoming messages to the provided {@link IncomingMessageConsumer}.
*
* <p>As the agent should pass incoming messages to the given consumer,
* this method should always return a new object.</p>
*
* @param incomingMessageConsumer the consumer the new instance should pass
* incoming messages to
* @return a new messenger agent instance
*/
@NonNull Messenger obtain(@NonNull IncomingMessageConsumer incomingMessageConsumer);
}
@@ -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
@@ -20,29 +23,27 @@
* SOFTWARE.
*/
package me.lucko.luckperms.constants;
package net.luckperms.api.messenger.message;
import lombok.Getter;
import lombok.experimental.UtilityClass;
import net.luckperms.api.messenger.Messenger;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
@UtilityClass
public class Constants {
/**
* Represents a message sent received via a {@link Messenger}.
*/
public interface Message {
@Getter
private static final UUID consoleUUID = UUID.fromString("00000000-0000-0000-0000-000000000000");
@Getter
private static final String consoleName = "Console";
@Getter
private static final UUID importerUUID = UUID.fromString("11111111-1111-1111-1111-111111111111");
@Getter
private static final String importerName = "Import";
@Getter
private static final String logFormat = "&8(&e%s&8) [&a%s&8] (&b%s&8) &7--> &f%s";
/**
* Gets the unique id associated with this message.
*
* <p>This ID is used to ensure a single server instance doesn't process
* the same message twice.</p>
*
* @return the id of the message
*/
@NonNull UUID getId();
}
@@ -0,0 +1,59 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.messenger.message;
import net.luckperms.api.messenger.IncomingMessageConsumer;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an outgoing {@link Message}.
*
* <p>Outgoing messages are ones which have been generated by this instance.
* (in other words, they are implemented by LuckPerms)</p>
*
* <p>Note that all implementations of this interface are guaranteed to be an
* instance of one of the interfaces extending {@link Message} in the
* 'api.messenger.message.type' package.</p>
*/
public interface OutgoingMessage extends Message {
/**
* Gets an encoded string form of this message.
*
* <p>The format of this string is likely to change between versions and
* should not be depended on.</p>
*
* <p>Implementations which want to use a standard method of serialisation
* can send outgoing messages using the string returned by this method, and
* pass on the message on the "other side" using
* {@link IncomingMessageConsumer#consumeIncomingMessageAsString(String)}.</p>
*
* @return an encoded string form of the message
*/
@NonNull String asEncodedString();
}
@@ -0,0 +1,47 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.messenger.message.type;
import net.luckperms.api.actionlog.Action;
import net.luckperms.api.messenger.message.Message;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an "action log" message.
*
* <p>Used to dispatch live action log updates to other servers.</p>
*/
public interface ActionLogMessage extends Message {
/**
* Gets the action being sent
*
* @return the action
*/
@NonNull Action getAction();
}
@@ -0,0 +1,37 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.messenger.message.type;
import net.luckperms.api.messenger.message.Message;
/**
* Represents an "update" message.
*
* <p>Used to notify other servers of general changes.</p>
*/
public interface UpdateMessage extends Message {
}
@@ -0,0 +1,48 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.messenger.message.type;
import net.luckperms.api.messenger.message.Message;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
/**
* Represents an "user update" message.
*
* <p>Used to notify other servers of a change to a specific user.</p>
*/
public interface UserUpdateMessage extends Message {
/**
* Gets the user the message is for.
*
* @return the user
*/
@NonNull UUID getUserUniqueId();
}
@@ -0,0 +1,109 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.metastacking;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.HashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
/**
* Functional interface which removes duplicate entries from a list.
*
* <p>Used by LuckPerms to remove duplicate entries from a MetaStack.</p>
*/
public interface DuplicateRemovalFunction {
/**
* Removes duplicates from the given list, according to the behaviour
* of the function.
*
* @param list the entries
* @param <T> the type of entries
*/
<T> void processDuplicates(@NonNull List<T> list);
/**
* A {@link DuplicateRemovalFunction} that does not remove duplicates.
*/
DuplicateRemovalFunction RETAIN_ALL = new DuplicateRemovalFunction() {
@Override
public <T> void processDuplicates(@NonNull List<T> list) {
}
@Override
public String toString() {
return "DuplicateRemovalFunction#RETAIN_ALL";
}
};
/**
* A {@link DuplicateRemovalFunction} that retains only the first occurrence.
*/
DuplicateRemovalFunction FIRST_ONLY = new DuplicateRemovalFunction() {
@SuppressWarnings("Java8CollectionRemoveIf")
@Override
public <T> void processDuplicates(@NonNull List<T> list) {
Set<T> seen = new HashSet<>(list.size());
for (ListIterator<T> it = list.listIterator(); it.hasNext(); ) {
T next = it.next();
if (!seen.add(next)) {
it.remove();
}
}
}
@Override
public String toString() {
return "DuplicateRemovalFunction#FIRST_ONLY";
}
};
/**
* A {@link DuplicateRemovalFunction} that retains only the last occurrence.
*/
DuplicateRemovalFunction LAST_ONLY = new DuplicateRemovalFunction() {
@Override
public <T> void processDuplicates(@NonNull List<T> list) {
Set<T> seen = new HashSet<>(list.size());
for (ListIterator<T> it = list.listIterator(list.size()); it.hasPrevious(); ) {
T next = it.previous();
if (!seen.add(next)) {
it.remove();
}
}
}
@Override
public String toString() {
return "DuplicateRemovalFunction#LAST_ONLY";
}
};
}
@@ -0,0 +1,91 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.metastacking;
import net.luckperms.api.query.OptionKey;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.List;
/**
* Represents a meta stack model, consisting of a chain of elements, separated by spacers.
*
* <p>The resultant string is constructed as:
* [start spacer] [element] [middle spacer] [element] [middle spacer] [element] [end spacer]</p>
*
* <p>Definitions can be passed to a users UserData instance using MetaContexts, and the result of this stack can be
* retrieved from the returned MetaData instance.</p>
*/
public interface MetaStackDefinition {
/**
* The {@link OptionKey} for the prefix {@link MetaStackDefinition}.
*/
OptionKey<MetaStackDefinition> PREFIX_STACK_KEY = OptionKey.of("prefixstack", MetaStackDefinition.class);
/**
* The {@link OptionKey} for the suffix {@link MetaStackDefinition}.
*/
OptionKey<MetaStackDefinition> SUFFIX_STACK_KEY = OptionKey.of("suffixstack", MetaStackDefinition.class);
/**
* Gets an immutable list of the elements in this stack definition
*
* @return the elements in this stack
*/
@NonNull List<MetaStackElement> getElements();
/**
* Gets the duplicate removal function, applied to the entries before
* formatting takes place.
*
* @return the duplicate removal function
*/
@NonNull DuplicateRemovalFunction getDuplicateRemovalFunction();
/**
* Gets the spacer string added before any stack elements
*
* @return the start spacer
*/
@NonNull String getStartSpacer();
/**
* Gets the spacer added between stack elements
*
* @return the middle spacer
*/
@NonNull String getMiddleSpacer();
/**
* Gets the spacer added after any stack elements
*
* @return the end spacer
*/
@NonNull String getEndSpacer();
}
@@ -0,0 +1,51 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.metastacking;
import net.luckperms.api.node.ChatMetaType;
import net.luckperms.api.node.types.ChatMetaNode;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Represents an element within a {@link MetaStackDefinition}.
*
* <p>The element itself does not contain any mutable state.</p>
*/
public interface MetaStackElement {
/**
* Returns if the given node should be accumulated onto the stack.
*
* @param type the type of entry being accumulated
* @param node the node being considered
* @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(@NonNull ChatMetaType type, @NonNull ChatMetaNode<?, ?> node, @Nullable ChatMetaNode<?, ?> current);
}
@@ -0,0 +1,69 @@
/*
* 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.luckperms.api.metastacking;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.List;
import java.util.Optional;
/**
* Factory to create meta stack elements and definitions.
*/
public interface MetaStackFactory {
/**
* Parses a standard {@link MetaStackElement} from string, using the pre-defined elements in the plugin.
*
* @param definition the definition
* @return the parsed element, if present
*/
@NonNull Optional<MetaStackElement> fromString(@NonNull String definition);
/**
* Parses a list of {@link MetaStackElement}s from string, using the pre-defined elements in the plugin.
*
* <p>If an element cannot be parsed, it will not be included in the resultant list.</p>
*
* @param definitions the definition strings
* @return a list of parsed elements
*/
@NonNull List<MetaStackElement> fromStrings(@NonNull List<String> definitions);
/**
* Creates a new {@link MetaStackDefinition} with the given properties.
*
* @param elements the elements to be included in the stack.
* @param duplicateRemovalFunction the duplicate removal function
* @param startSpacer the spacer to be included at the start of the stacks output
* @param middleSpacer the spacer to be included between stack elements
* @param endSpacer the spacer to be included at the end of the stacks output
* @return the new stack definition instance
*/
@NonNull MetaStackDefinition createDefinition(@NonNull List<MetaStackElement> elements, @NonNull DuplicateRemovalFunction duplicateRemovalFunction, @NonNull String startSpacer, @NonNull String middleSpacer, @NonNull String endSpacer);
}
Loaded 100 of 872 files, more files were not shown because too many files have changed in this diff. Show more