212c94ce98
PluginManager: Log an error message when a plugin disables itself during enabling
2022-05-11 13:07:45 +01:00
e388cb1643
Merge branch 'stable' into next-minor
2022-04-10 21:23:04 +01:00
2efce35331
PluginManager: fixed updating disabled scheduler when plugins cause other plugins to be disabled from within scheduled tasks
2022-04-10 21:00:16 +01:00
ac3a6033b9
PluginManager: account for possible abstract main classes
...
idk why anyone does this, but it shouldn't cause a core crash ...
2022-04-01 23:42:37 +01:00
9963fcf849
PluginManager: return the created RegisteredListener from registerEvent()
...
this allows the handler to be later unregistered when used with a plain closure instead of a magic `Listener`.
2022-03-22 16:20:37 +00:00
c9c50e16ec
PluginManager: fixed mishandling of self-disabling plugins in enablePlugins()
...
this caused a leak of the plugin context, PluginEnableEvent to be called with a disabled plugin, and the plugin's scheduler to get ticked.
2022-03-03 18:48:52 +00:00
03f47d0a78
Replace disallowed operators in src/plugin/
2022-01-20 19:19:20 +00:00
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
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
6b316dc29a
PluginManager: Make declaration of duplicate permissions a load error
2021-11-06 17:05:37 +00:00
4cb6c7dc1e
PluginManager: fixed plugins being able to alter groups of other plugins' permissions
...
this could happen if a plugin declared a permission already declared by another plugin, and then declared a different default for it (e.g. true instead of op).
2021-11-06 16:32:19 +00:00
bb05af103d
PluginManager: fixed crash when using a plugin-loader plugin (read: devtools)
...
closes #4518
2021-10-28 15:55:05 +01:00
e2275cc8ec
PluginManager: Prevent infinite recursion in loadPlugins()
...
if a plugin calls loadPlugins(server->getPluginPath()) during its onLoad(), and it itself is in that plugin path, an infinite recursion will occur.
2021-10-20 23:10:18 +01:00
620874d902
PluginManager: Extract checkPluginLoadability() to a PluginLoadabilityChecker unit
...
this can be more easily unit-tested.
2021-10-20 22:31:56 +01:00
44508a138f
Moved plugin extension requirement checks to PluginManager::checkPluginLoadability()
...
these don't really belong in PluginDescription.
2021-10-20 22:13:30 +01:00
6d78a0b435
CS
2021-10-20 21:52:42 +01:00
76b4b23d98
PluginManager: remove loadPlugin()
...
loadPlugins() is now the preferred option, since it does all the proper checks.
In addition, the server now acknowledges that loading a single plugin may cause multiple plugins to be loaded, so returning only a single Plugin is not representative of what's actually happening.
2021-10-20 21:52:19 +01:00
03fcd844eb
PluginManager::loadPlugins() now accepts files as well as directories
...
loadPlugins() is now a superior option to loadPlugin(), since it enforces dependency checks and also supports automatic loading of plugins when new loaders are installed.
2021-10-20 21:36:14 +01:00
a788954551
Fixed dependency handling across plugin loaders ( #3971 )
2021-10-20 20:22:00 +01:00
500c298aaf
Disallow the use of @handleCancelled on non-cancellable events
...
closes #3464
2021-10-11 15:12:16 +01:00
6d728e8d98
PluginManager: Improved startup performance when loading many plugins
...
for some reason we were reading and parsing the plugin.yml at least twice for every plugin loaded.
We were repeating work already done by the initial loadPlugins() triage (discovering correct loader, loading plugin.yml from disk, parsing plugin.yml, validating plugin.yml) every time loadPlugin() was called with that plugin.
2021-10-11 01:11:59 +01:00
e1ee320c8d
PluginManager: Localize plugin loading error messages
2021-10-11 00:58:33 +01:00
965a16d19d
PluginManager: Extract deterministic plugin loadability checks into a separate method
2021-10-11 00:49:32 +01:00
a101d1cdf9
Drop pocketmine.plugin.fileError in favour of pocketmine.plugin.loadError
...
fileError was unnecessarily noisy, putting the directory path on the console twice. This conveys just as much information but with less wasted space.
2021-10-05 23:31:00 +01:00
e25c03eec1
Gracefully handle errors loading plugin manifest
...
this isn't perfect, but it covers the common cases.
Now, the server won't spam crashdumps just because some plugin declared nested permissions.
2021-10-05 20:28:43 +01:00
7d06b76aaf
PluginManager: account for possible invalid format of API version
...
we're seeing a lot of crashes because of this.
2021-10-05 18:36:00 +01:00
4748b0db37
PluginManager: remove unused import
2021-08-14 21:28:38 +01:00
8b9d7d6390
Support for nested TranslationContainers
2021-08-14 20:57:13 +01:00
2293bd948d
Added KnownTranslationFactory and use it in as many places as possible
...
this makes translation usage much more statically analysable.
The only places this isn't used are:
- places that prefix translations with colours (those are still a problem)
- places where server/client translations don't match (e.g. gameMode.changed accepts different parameters in vanilla than in PM)
2021-08-10 14:50:40 +01:00
94e16f416d
Added KnownTranslationKeys (generated) and start using it
2021-06-29 22:46:04 +01:00
32d7b1e6af
Start using webmozart/pathutil for joining paths ( #4287 )
2021-06-29 19:40:43 +01:00
5cdf0b169f
PluginManager: Separate listener method filtering to its own method
...
this makes registerEvents() easier to read.
2021-06-27 20:25:28 +01:00
6cb285d4a9
Added constants for the handler tag types
2021-05-06 18:40:14 +01:00
bbae02264d
Merge branch 'stable'
2021-01-27 20:04:13 +00:00
487b5dd11d
Merge branch 'stable'
2021-01-16 19:44:15 +00:00
6d8833ccd3
Removal of permission defaults (in favour of permission cascading) ( #3937 )
2020-12-01 17:13:54 +00:00
d38791e27d
Listener: Drop support for @softDepend annotation
...
literally nobody uses this. I don't think anyone even knows it exists.
It's also an obstacle to separating event handler registration from PluginManager.
2020-10-16 21:10:57 +01:00
92f6967665
Command: validate permissions, require permission registration in advance of commands using them
...
this fixes #3200 .
This causes permissions to be registered before plugin load, which changes some behaviour, but after discussions on #internals-dev we couldn't see any reason to keep the behaviour the way it was, and several reasons to change it to be something like this.
2020-07-08 13:50:38 +01:00
2170f81cdd
PluginManager: remove dead function isCompatibleApi()
...
moved to ApiVersion static class
2020-05-24 14:14:47 +01:00
f9a587d40e
imports cleanup
2020-04-28 17:27:38 +01:00
163c3855eb
Merge branch 'next-minor'
...
# Conflicts:
# resources/vanilla
# src/plugin/PluginBase.php
# src/plugin/PluginDescription.php
# src/pocketmine/Player.php
# src/pocketmine/network/rcon/RCON.php
# src/pocketmine/network/rcon/RCONInstance.php
# src/pocketmine/scheduler/AsyncTask.php
# src/pocketmine/tile/Spawnable.php
# src/scheduler/AsyncPool.php
# src/utils/Config.php
# src/utils/Timezone.php
# src/utils/UUID.php
# src/utils/Utils.php
# src/world/format/io/region/RegionLoader.php
2020-04-19 11:13:41 +01:00
ca909ebc1d
Merge branch 'next-minor'
2020-03-10 13:05:37 +00:00
aac7da6c96
eliminate remaining empty() usages
2020-02-07 21:51:50 +00:00
347b94b284
Merge branch 'stable'
2020-02-07 20:18:17 +00:00
fb1126797a
Merge branch 'stable'
2020-02-07 18:13:55 +00:00
f65bf76fd8
Merge commit '799183e13e61e89cc6820ad3132a4147454017c6'
...
# Conflicts:
# resources/vanilla
# src/Server.php
# src/pocketmine/entity/Entity.php
# src/pocketmine/level/format/io/LevelProviderManager.php
# src/pocketmine/tile/Tile.php
# src/world/generator/GeneratorManager.php
2020-01-31 21:26:40 +00:00
19a6fb35e7
Merge commit 'd94995e161d71659e2fe6ec1df47621f2de4b494'
...
# Conflicts:
# resources/vanilla
2020-01-31 19:46:28 +00:00
5c4487c980
added some callable prototypes for phpstan
2020-01-29 19:56:16 +00:00
055b13a6cf
strip extra blank lines (php-cs-fixer)
2020-01-22 15:14:10 +00:00
cd55cdf5c6
Merge commit '9cd6b3e1c7cd81d0a4b0da68d9b3ff026c9f6495'
2020-01-22 15:04:06 +00:00