94 Commits

Author SHA1 Message Date
Dylan K. Taylor
d85a27c5b2 BanList: remove useless Server dependency 2019-06-25 15:54:26 +01:00
Dylan K. Taylor
3c677bd3ec added PermissibleDelegateTrait to cut down boilerplate in Player and ConsoleCommandSender 2019-06-17 16:10:13 +01:00
Dylan K. Taylor
b71bb867f4 DefaultPermissions: remove pocketmine.command.reload 2019-06-16 16:52:47 +01:00
Dylan K. Taylor
9ea684581f Merge remote-tracking branch 'origin/stable' 2019-05-13 18:17:42 +01:00
Johnmacro
66818e178a DefaultPermissions: Fix typos in permission descriptions (#2918) 2019-05-12 09:20:45 +01:00
Dylan K. Taylor
c49ead1a4c Merge branch '3.7' 2019-04-05 18:49:02 +01:00
Dylan K. Taylor
fdc3faadc9 Register two missing default permissions
this fixes the pocketmine.command node not having the expected effect in some cases.
2019-04-05 18:48:37 +01:00
Dylan K. Taylor
9cddfdf8ec Revert "Move core permissions to default_permissions.yml"
This reverts commit 5fac5c72816c6e1b137ca59b14e567a9116c2baa.
2019-03-23 10:41:50 +00:00
Dylan K. Taylor
6c8fa8ae28 More nullable and void typehints 2019-03-02 10:29:11 +00:00
Dylan K. Taylor
9c085799e6 Removed leftover import from 3d1502c9ad2b98f9e38f7a0d61e8148fb8ef660a 2019-02-22 12:56:14 +00:00
Dylan K. Taylor
c26544475e More PHP 7.1 nullables 2019-02-22 12:55:34 +00:00
Dylan K. Taylor
73a565355b Make some forced-optional nullable parameters non-optional, PHP 7.1 style
these parameters did not make any sense to be optional, but were forced to be this way because of the way nullable types worked before 7.1.
2019-02-22 12:54:00 +00:00
Dylan K. Taylor
3d1502c9ad Apparently yaml_parse_file() doesn't respect access protocol 2019-02-20 17:11:26 -05:00
Dylan K. Taylor
5fac5c7281 Move core permissions to default_permissions.yml
this is one of the few things that is actually better suited to a YAML file than code
closes #2594
2019-02-20 16:22:45 +00:00
Dylan K. Taylor
7aa263d320 PermissionParser: add emitPermissions() 2019-02-20 16:21:25 +00:00
Dylan K. Taylor
efc2d72d5f Move permission parsing to dedicated PermissionParser class 2019-02-20 16:20:48 +00:00
Dylan K. Taylor
d378371cc8 Transition to spl_object_id() 2019-01-26 15:06:38 +00:00
Dylan K. Taylor
469b24b0a5 Remove built-in spawn protection
Users should use the new BasicSpawnProtection plugin instead.
2019-01-24 16:56:15 +00:00
Dylan K. Taylor
c5df2f6f0d Remove another Throwable abuse 2019-01-17 22:43:52 +00:00
Dylan K. Taylor
f80eeee20f Merge branch '3.5' 2019-01-05 18:59:13 +00:00
Dylan K. Taylor
93969197f7 Enable status,gc,dumpmemory OOB
dumpmemory has been confined to console by default due to the hazards it poses to a running server.

closes #2528
2019-01-05 18:56:57 +00:00
Dylan K. Taylor
226db35cf9 Merge branch '3.5' 2019-01-04 23:56:53 +00:00
Dylan K. Taylor
5dfceeea98 Fix typo in command.op.take permission description 2019-01-04 23:56:29 +00:00
Dylan K. Taylor
adc1069ed2 Merge branch '3.5' 2019-01-04 23:28:44 +00:00
Dylan K. Taylor
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
Dylan K. Taylor
5936205760 Merge branch 'release/3.4' 2018-12-01 16:51:32 +00:00
Dylan K. Taylor
acd7c9b336 Permission: Throw exception on unknown values in getByName()
Previously, writing wrong values into plugin.yml for permission defaults would cause the permission to be silently denied to everyone.
2018-12-01 15:56:44 +00:00
Dylan K. Taylor
67a5f3f557 Register MainLogger as SPL global, remove hard MainLogger dependency from many areas, break a bunch of cyclic dependencies 2018-11-05 19:01:59 +00:00
Dylan K. Taylor
45c9caa38c Fixup some formatting issues 2018-10-21 18:15:25 +01:00
Dylan K. Taylor
c83d12790e Merge branch 'release/3.1' into release/3.2 2018-09-14 17:09:41 +01:00
Dylan K. Taylor
5863d4c066 Fixed PermissibleBase->clearPermissions() not unsubscribing from permissions that aren't explicitly assigned
This came to light after observing cfb6856634f91930f6e013e7b98edb638dea15d9 in a fresh light. I noticed that this fix should not have been necessary because clearPermissions() should have dealt with it. Unfortunately, permissions can be set without being set in PermissibleBase->permissions, so this misses things.
2018-09-14 17:06:32 +01:00
Dylan K. Taylor
fe6d546190 Merge branch 'release/3.1' into release/3.2 2018-08-25 17:49:21 +01:00
Dylan K. Taylor
7dd53f2397 Replace unnecessary strlen > 0 calls with !== "" checks 2018-08-25 16:07:49 +01:00
Dylan K. Taylor
08be51dc23 Clear permissions on server reload 2018-07-26 10:40:28 +01:00
Dylan K. Taylor
9a2845640b
Permissions management cleanup (#2332)
* Added a new PermissionManager, remove ridiculous cyclic dependencies of Permissions on Server

Aside from all the other ridiculous design problems with the permission system, the biggest problems are its API. This is, once again, a result of poor API design copied from Bukkit.

This pull request removes all permission-related functionality from `PluginManager` and moves it to the `pocketmine\permission\PermissionManager` class.

As can be observed from the removed code in the diff, the permissions system was previously entirely dependent on the Server, because it needed to get the PluginManager for registering permissions. This is utterly ridiculous. This refactor isolates _most_ permission-related functionality within the `permission` namespace.

As mentioned above, this stupid API is a direct result of copying from Bukkit. If you look at the API documentation for Bukkit for `PluginManager` you will see that the methods I'm deprecating here are also in there.

## Changes
- Added a new `PermissionManager` class. This can be accessed via its singleton `getInstance()` static method.
- Deprecated the following `PluginManager` methods - these will be removed no later than 4.0.0:
  - `getPermission()`
  - `addPermission()`
  - `removePermission()`
  - `getDefaultPermissions()`
  - `recalculatePermissionDefaults()`
  - `subscribeToPermission()`
  - `unsubscribeFromPermission()`
  - `getPermissionSubscriptions()`
  - `subscribeToDefaultPerms()`
  - `unsubscribeFromDefaultPerms()`
  - `getDefaultPermSubscriptions()`
  - `getPermissions()`
2018-07-26 10:21:41 +01:00
Dylan K. Taylor
580f71d496 Permission: cosmetic reorg 2018-07-25 20:56:23 +01:00
Dylan K. Taylor
23829952c3 PermissibleBase: removed nonsensical code
it's not possible for this to be null, unless a child class doesn't call the constructor, and anything could break in that case anyway.
2018-07-08 13:04:51 +01:00
Dylan K. Taylor
05af87e1d4 Strip empty lines at the end of classes 2018-06-11 13:19:23 +01:00
Dylan K. Taylor
c4c6c58615 Added some missing typehints 2018-06-10 17:18:55 +01:00
Dylan K. Taylor
2b5e6b790f BanList: rename poorly-named parameter 2018-06-06 18:18:06 +01:00
Dylan K. Taylor
e081b7dffa PermissibleBase: fix typehints of calculateChildPermissions() 2018-06-05 11:14:36 +01:00
SOFe
ae0c1c185f
Fixed wrong doccomment for Permission::$children 2018-05-04 15:31:00 +08:00
Dylan K. Taylor
73e09392b6 Timings: Clean up some terrible code, move namespaces 2018-03-19 19:05:51 +00:00
Dylan K. Taylor
ac5a91b67e Cleaned up bool comparison mess 2018-03-19 14:10:55 +00:00
Dylan K. Taylor
0ad8ea6e92 Remove unused imports 2018-02-24 19:01:09 +00:00
Dylan K. Taylor
37e8c8d324 BanEntry: work around stupid bug in ext/date
https://bugs.php.net/bug.php?id=75992

When plugins do time-limited bans and users enter stupid time values, a shitty bug in ext/date gets triggered, but only when reading the ban entries from disk. DateTime->format() is able to produce formatted strings which have more than 4 digits in the year, which are then considered invalid. This works around it by trying to parse a formatted version on the fly to ensure that it is valid.

This also cleans up and improves ban list loading and handling.
2018-02-22 14:48:53 +00:00
Dylan K. Taylor
687886e70b PermissibleBase: remove useless destructor 2018-02-06 21:10:42 +00:00
Oreo Oreoniv
1b4b832c8c Added a getEntry() to BanList (#1830) 2017-12-21 10:08:56 +00:00
Dylan K. Taylor
4f8e4f0522
Add EOF newlines where missing (bulk) (#1836)
This should solve issues with people making GitHub PRs and having the web editor messing things up. GitHub Web Editor sucks :(
2017-12-20 11:56:36 +00:00
Dylan K. Taylor
74b074753f Bulk addition of constant visibilities
thanks PhpStorm inspections plugin for annoying the shit out of me until
I did this.
2017-11-21 14:44:10 +00:00