89 Commits

Author SHA1 Message Date
Dylan K. Taylor
52fe2cb97f
PermissionManager: deprecate permission subscription system
this is no longer used by the core, and as far as I can tell no plugin uses it either.
it was used in the past for chat broadcast channels, but not anymore.
2024-11-25 21:29:26 +00:00
Dylan K. Taylor
12ae8dc03b
Merge branch 'stable' into minor-next 2024-11-25 14:32:30 +00:00
Dylan K. Taylor
5325ecee37
Deal with a whole lot of PHPStan suppressed key casting errors
closes #6534
2024-11-25 14:30:58 +00:00
ipad54
a75d4687ce
Implemented vanilla /xp command (#6429) 2024-11-15 16:09:55 +00:00
Dylan K. Taylor
1b082f99e9
DefaultPermissions: fixed typo 2024-05-07 12:34:42 +01:00
Dylan K. Taylor
0093732d49
PermissionManager: fixed non-reentrant-safe permission unsubscribing
during unset(), the destructors for other objects with cyclic references can get triggered, resulting in the functions being reentered before the count() call. This leads to a crash because the offset no longer exists.
Instead, we check if only the given PermissibleInternal is present, and clean everything up with a single unset instead of two.
This could also have been solved by adding extra isset() checks before checking the counts, but this way seemed more elegant.

This is similar to an issue with AsyncTask thread-local storage a few months ago, which was also caused by GC reentrancy.

closes #6119
2023-11-01 16:13:28 +00:00
Dylan K. Taylor
c1638ffaab
Ban foreach by-reference at the PHPStan level 2023-08-08 17:08:13 +01:00
Dylan K. Taylor
2da9b76452
Added translatable descriptions for permissions 2022-12-27 20:29:38 +00:00
Dylan K. Taylor
c89df7eb1c
Merge remote-tracking branch 'origin/next-minor' into next-major 2022-12-25 18:22:13 +00:00
Dylan K. Taylor
6375139d0b
DefaultPermissions: improve readability slightly 2022-12-24 17:47:17 +00:00
Dylan K. Taylor
133884da72
Remove deprecated permissions 2022-12-24 17:41:59 +00:00
Dylan K. Taylor
d37841c214
Merge branch 'next-minor' into next-major 2022-12-24 17:34:37 +00:00
Dylan T
567bd8abb5
Add .self and .other permissions for gameplay-altering commands (#5470)
I'm not quite sure this is the best way to enable such functionality, but it's already used for some other stuff, so I'm not too worried for now.

This allows the following commands to have their usage limited to self or others:
- /effect
- /enchant
- /gamemode
- /give
- /spawnpoint
- /teleport
- /title

I envision this being useful for creative mode servers, and test servers such as test.pmmp.io.
2022-12-24 17:22:18 +00:00
Dylan K. Taylor
f8cc015c51
Merge branch 'next-minor' into next-major 2022-12-23 16:58:59 +00:00
Dylan K. Taylor
51a684c0ea
PermissionParser: remove hardcoded default strings in defaultFromString() 2022-12-23 16:03:01 +00:00
Dylan K. Taylor
43e69041fc
PermissionParser: use constants for keys 2022-12-23 16:00:38 +00:00
Dylan K. Taylor
3b6ff3c42b
Apply union types in some places (BC breaks) 2022-11-23 14:03:35 +00:00
Dylan K. Taylor
1ecb10acba
Merge branch 'next-minor' into next-major 2022-08-21 19:19:07 +01:00
Dylan K. Taylor
dce8bd6d21
CS: Standardize new with braces 2022-08-15 17:16:23 +01:00
Dylan K. Taylor
aa9f8781ff
Merge branch 'next-minor' into next-major 2022-06-07 19:56:26 +01:00
Dylan K. Taylor
083a35f970
Modernize property type declarations 2022-06-04 18:16:32 +01:00
Dylan K. Taylor
38d6284671
Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
Dylan K. Taylor
c0b15de504
Modernize private static property declarations 2022-05-17 21:55:16 +01:00
Dylan K. Taylor
22edca610c
Modernize private property declarations in src/permission 2022-05-17 21:28:42 +01:00
Dylan K. Taylor
15425d01bc
BanEntry: clean up getString() 2022-01-28 21:53:28 +00:00
Dylan K. Taylor
ae03c70dfc
Replace disallowed operators in src/permission/ 2022-01-20 19:20:51 +00:00
Dylan K. Taylor
889d048ca3
Make use of Utils::assumeNotFalse() in a bunch of places
I've stuck to only doing this in the places where I'm sure we should never get false back. Other places I'm less sure of (and I found more bugs along the way).
2021-12-08 19:39:04 +00:00
Dylan K. Taylor
269231c228
Ban foreach(arrayWithStringKeys as k => v)
this is not as good as phpstan/phpstan-src#769 (e.g. array_key_first()/array_key_last() aren't covered by this, nor is array_rand()) but it does eliminate the most infuriating cases where this usually crops up.
2021-11-15 22:52:05 +00:00
Dylan K. Taylor
e34364412b
Replace InvalidStateException usages with InvalidArgument or LogicException 2021-11-02 16:05:54 +00:00
Dylan K. Taylor
aefa0afd7c
DefaultPermissions: Order registrations alphabetically 2021-10-12 22:17:46 +01:00
Dylan K. Taylor
ec2699ffee
DefaultPermissions: fix description of timings command permission 2021-10-12 22:16:20 +01:00
Dylan K. Taylor
7245d15abe
PermissionParser: Throw more specific exceptions 2021-10-05 19:57:26 +01:00
Dylan K. Taylor
ede4d58394
Automatic permission calculation on PermissibleBase construction
thanks to the PermissibleInternal/PermissibleBase architectural change, there's no longer any concern regarding cyclic refs.
2021-06-26 22:15:22 +01:00
Dylan K. Taylor
bf7d69b69e
Stop hardcoding permission names everywhere
using strings for permission names is nearly as shitty, but this is at least cross-referencable and statically analysable.
2021-06-26 19:14:51 +01:00
Dylan K. Taylor
408e29da90
Removed PermissionRemovedExecutor
this interface is just about the most pointless code in all of PM or Bukkit. In over 4 million lines of code on Poggit, a Google search and a GitHub search, I didn't find a single usage of it that wasn't just bukkit internals code copy pasta, a spoon, a port of PM/Bukkit/whatever into a different language, or someone's generated javadoc.
2021-06-12 21:55:59 +01:00
Dylan K. Taylor
b525f45bf8
Fixed CS 2021-06-12 21:51:08 +01:00
Dylan K. Taylor
8e1d27a719
Constrain types to PermissibleInternal on internal permission subscription methods 2021-06-12 21:28:19 +01:00
Dylan K. Taylor
bfcf4a25d4
Automatic cleanup of permission subscriptions on PermissibleBase destructor calls
this has gotten too complex ...
2021-06-12 21:12:39 +01:00
Dylan K. Taylor
666670bc6f
PermissionAttachment may now reference zero or more permissibles
this makes PermissionAttachment more and more like Permission, except that it doesn't have a name.
Right now, the only value of this API change is that it allows breaking references to dead Permissibles, but in the future it should be possible to reuse a single PermissionAttachment on multiple Permissibles.
2021-04-12 15:57:24 +01:00
Dylan K. Taylor
c61f66d973
Removed ext-ds dependency 2021-02-11 15:40:37 +00:00
Dylan K. Taylor
bcc3e87730
Timings: rename core timers to remove 'timer' from the names
this makes them shorter and more consistent.
2020-12-23 17:52:25 +00:00
Dylan K. Taylor
61de84373a PermissionParser: simplify code 2020-12-11 19:09:01 +00:00
Dylan K. Taylor
bee770ebf5 Drop nested permissions support in plugin.yml 2020-12-11 19:03:52 +00:00
Dylan K. Taylor
794bb0a71d PermissionParser: bail on encountering permissions whose names are not strings 2020-12-09 00:32:50 +00:00
Ifera
c4b47c6c06 Implemented /clear command (#3854)
closes #3854
2020-12-06 15:26:12 +00:00
Dylan K. Taylor
0bbceee86d PermissionParser: give permissions default FALSE if they don't specify their own default 2020-12-05 21:06:07 +00:00
Dylan K. Taylor
807474b3fb PermissibleBase: do not assign any permissions by default
there is no longer such a thing as a permission granted to 'everyone', since we're no longer limited to true/false/op/notop, and regular players are now assigned the pocketmine.group.user permission.
It's possible we might want to add more restricted groups than 'user' in the future, in which case it would be behaviour-BC-breaking to change the default assigned permissions when creating a new PermissibleBase. Therefore, it's better to not assign any permissions at all and let the caller decide.
In addition, this solves the problem of implied permission subscriptions and leak on PermissibleBase construction - if base permissions are provided, it should be expected that the permissible will subscribe to those permissions.
2020-12-02 15:56:54 +00:00
Dylan K. Taylor
b51c6e89b3 Introduced pocketmine.group.console
this is only used for /dumpmemory right now, but it's planned to be used for more stuff.
2020-12-02 13:35:48 +00:00
Dylan K. Taylor
c5e12bb11f PermissibleBase: simplify diff calculation 2020-12-02 11:29:45 +00:00
Dylan K. Taylor
506e76917e PermissionAttachmentInfo now includes a reference to the PermissionAttachmentInfo that caused its assignment (if any)
this allows plugins to easily identify which permission group caused a permission to be assigned (particularly if multiple groups might cause it).
2020-12-02 11:23:35 +00:00