234 Commits

Author SHA1 Message Date
Dylan K. Taylor
b4068dfd2f remove unused import 2018-05-02 10:44:05 +01:00
SOFe
3293074cfc Implement @softDepend annotation for event handlers - skip registering if the event class is undefined (#2162)
This allows plugins to soft-depend on other plugins without separating their listeners into a dedicated class for listening to that plugin.

This can be utilized by adding a `@softDepend PluginName` to the event handler's annotations.
If the plugin providing the event does not exist or is not loaded, then the handler will silently not be registered.
If it does exist and the event is not found, the original behaviour applies and an exception will be thrown.

This change should be fully backwards compatible.
2018-05-01 14:33:24 +01:00
Dylan K. Taylor
5f52e00213 Fixed plugin loaders trying to load plugins they aren't able to load
closes #2125

This is an API break for things implementing the PluginLoader interface.
2018-04-09 15:54:20 +01:00
Dylan K. Taylor
eba1ca030c Fix variadic type docs ...again
PhpStorm changed its mind how it wants these documenting in 2018.1, and apparently the correct syntax follows the PHP code.
2018-04-02 12:33:24 +01:00
Johnmacrocraft
b151cb26a5 Fix deprecated event message (#2127) 2018-03-30 11:09:24 +01:00
SOFe
c19cf22ac5
Fixed #2110 2018-03-21 21:52:55 +08:00
Dylan K. Taylor
d2fb32c28a PluginManager: added event call recursion limit, closes #2109
This prevents unexplained segfaults on accidental event call recursion by limiting the max depth of event call stack to 50. If another event attempts to be called, an exception will be thrown.
2018-03-21 10:40:08 +00:00
SOFe
49fbbea7bf Implemented event handler inheritance, allow registering handlers for any valid event (#1792)
* Event handlers always handle subclass events. public static $handlerList no longer required.
* Removed $handlerList declarations
* HandlerList cleanup: Removed HandlerList->handlers and related bake methods
* Removed obsolete Event->getHandlers()
* EventPriority: Added fromString()
* PluginManager: throw exceptions on registering handlers with invalid priorities

This allows specifying a handler of `EntityDamageEvent` which will handle any instanceof it (as per current behaviour), AND also now allows specifying a handler specifically for `EntityDamageByEntityEvent`, which only handles `EntityDamageEvent`.

This was not previously possible due to limitations in the way handlers were registered.

Abstract events may not be handled unless they declare the `@allowHandle` PhpDoc tag.
2018-03-20 17:05:09 +00: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
SOFe
6bf9ae0a18 Expose plugin.yml contents to plugins (#2043)
This allows plugins and libraries to rely on values in plugin.yml without parsing it again
2018-02-19 22:16:45 +00:00
Dylan K. Taylor
7dd834bca0 Fixed API patch version being useless
Plugins will now be able to require a specific minimum patch version, in case they depend on bug fixes or whatever.
2018-02-15 21:45:46 +00:00
Dylan K. Taylor
0bf5ab76fb Remove WeakRef leftovers 2018-01-23 19:04:37 +00:00
SOFe
7f4b5d282e
Fixed plugin name validation
Invalid characters in plugin names are no longer stripped. They always result in a load error.

The behaviour of replacing spaces with underscores is not changed.
2018-01-14 18:28:19 +08:00
Dylan K. Taylor
99c55ac889 Plugin: Fixed return type documentation for getResource() 2017-12-30 12:40:50 +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
Dylan K. Taylor
38ec5da260 Refactored API compatibility checking code into its own method (#1394)
Refactored API compatibility checking code into its own method so plugins can use it
this change was inspired by https://github.com/poggit/devirion/blob/master/src/poggit/virion/devirion/DEVirion.php#L140-L172
2017-09-24 15:00:08 +01:00
Dylan K. Taylor
b14ecc18c4 Remove unused imports 2017-09-20 12:24:44 +01:00
Dylan K. Taylor
d065e76a41 Fixed plugins with unknown dependencies saying they have circular dependencies, close #356 (#1342) 2017-09-04 19:41:21 +01:00
Dylan K. Taylor
c81b76cbf6 Make plugin load errors more descriptive 2017-09-01 18:52:55 +01:00
Dylan K. Taylor
517609dc2e Cleaned up plugin property reading 2017-09-01 18:36:31 +01:00
Dylan K. Taylor
506118e28f Fixed exception thrown when plugins specify API version like 3.0 instead of 3.0.0
This could only be seen in a build with a non-suffixed API version, for example 3.0.0. When attempting to load plugins which specify API like 3.0 the server would raise errors.
2017-09-01 18:13:07 +01:00
Dylan K. Taylor
6e8631347d Added capability to specify compatible protocol versions in plugin.yml (#1247)
Protocol-dependent plugins may specify the `mcpe-protocol` attribute in plugin.yml to disallow plugin loading when the protocol changes.
2017-09-01 17:57:40 +01:00
Dylan K. Taylor
5b4035253b Casting cleanup and removed some 32-bit string-int leftovers 2017-08-17 11:24:49 +01:00
Dylan K. Taylor
cca9cf2c86 Workaround for plugin versions being read as strings from plugin.yml
Config is a real pain in the ass to work with... need to split it up so this can be handled properly
2017-07-16 11:31:21 +01:00
Dylan K. Taylor
dbb92096e4 More typehints, documentation fixes and static analysis cleanup 2017-07-15 12:12:06 +01:00
Dylan K. Taylor
c3b8be3f60 and more typehints 2017-07-14 10:56:51 +01:00
Dylan K. Taylor
8bb0c53797 More typehints for Command stuff 2017-07-14 08:52:27 +01:00
Dylan K. Taylor
46a2e6cbf8 Some breaking changes for plugins >:D 2017-07-14 08:52:27 +01:00
Dylan K. Taylor
2a7b736f18 Heap of bugfixes, cleanup and PHP 7 upgrades 2017-07-13 19:18:56 +01:00
Dylan K. Taylor
a73c6f1861 Fixed some unnecessary FQNs in docs 2017-06-25 12:43:04 +01:00
Dylan K. Taylor
a365c831a8 Fixed some doc problems 2017-06-25 12:07:28 +01:00
Dylan K. Taylor
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
Dylan K. Taylor
3f03d9e683 Fixed DevTools getting disabled when a plugin throws an exception during load (#1025) 2017-06-07 11:12:47 +01:00
SOFe
c7c7a40899 Added "extensions" attribute in plugin.yml with version checking (#903)
* Added "extensions" attribute in plugin.yml with version checking

* Renamed getExtensions() to getRequiredExtensions()

As per recommendation from @dktapps
2017-05-15 10:04:26 +01:00
Dylan K. Taylor
dbb8e8ad0a Improved checks for event registration 2017-05-14 12:07:15 +01:00
Sandertv
1c7773c5f1 Visibility keyword before final or abstract keyword. (#814) 2017-04-13 20:58:53 +08:00
Dylan K. Taylor
27f2aec160 Fixed wrong docs for Plugin->getPluginFilters() 2017-02-12 12:52:02 +00:00
Dylan K. Taylor
0c35c16727 Fix some doc comments 2017-02-06 14:50:05 +00:00
Dylan K. Taylor
26fc21d56c API version suffix is now non case sensitive 2017-01-19 10:57:32 +00:00
Dylan K. Taylor
b28e38ab26 Move some exceptions out of utils into their relevant namespaces, move some Chunk methods to ChunkUtils for I/O, refactor "colour" -> "color" 2017-01-15 11:31:12 +00:00
Dylan K. Taylor
1cb96d24ce Some fixes, thanks PhpStorm 2017-01-04 11:29:24 +00:00
Dylan K. Taylor
3433a931c1 Fix load order (no tolerance for mismatches with suffixes) 2016-12-19 19:30:11 +00:00
Dylan K. Taylor
71704228a9 Added support for API alpha/beta/whatever suffixes 2016-12-19 18:08:45 +00:00
Tim (robske_110)
bb7263beac
Fixed script plugins not using first doccomment only 2016-12-17 23:56:43 +08:00
SOFe
175dd0efa6 PhpStorm inspections
Fixed some minor bugs and dropped some obsolete code

pocketmine\level\generator namespace is ignored in this commit
2016-12-14 21:49:35 +00:00
SOF3
6fc435da0e
Imports rearrangement 2016-10-03 00:43:46 +08:00
PEMapModder
8441169365 Fixed warning messages when parsing @notscript files 2016-03-28 02:27:03 +08:00
PEMapModder
e51c6b4b42 Merge branch 'notscript' 2016-03-28 01:26:29 +08:00