Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
9a745ffc09
Do not enforce suffix checks for API versions
2021-09-07 12:06:36 +01:00
Dylan K. Taylor
270ee5c085
Simplify registry method generation
2021-08-22 23:02:36 +01:00
Dylan K. Taylor
4748b0db37
PluginManager: remove unused import
2021-08-14 21:28:38 +01:00
Dylan K. Taylor
8b9d7d6390
Support for nested TranslationContainers
2021-08-14 20:57:13 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
94e16f416d
Added KnownTranslationKeys (generated) and start using it
2021-06-29 22:46:04 +01:00
Dylan T
32d7b1e6af
Start using webmozart/pathutil for joining paths ( #4287 )
2021-06-29 19:40:43 +01:00
Dylan K. Taylor
6fb8ac211e
Make GameMode::fromString() and PluginEnableOrder::fromString() return null, instead of throwing exceptions
...
since these are always used for handling userdata, it doesn't make sense for them to throw exceptions.
2021-06-27 20:56:51 +01:00
Dylan K. Taylor
3dd33cd35e
Get rid of EnumTrait::fromString()
...
it's better to just implement this for stuff where there's explicitly designated aliases, otherwise we could end up with unexpected BC breaks (e.g. hardcoding POSTWORLD in plugin.yml would suddenly break if the core enum was changed, even though it remained valid).
2021-06-27 20:52:56 +01:00
Dylan K. Taylor
5cdf0b169f
PluginManager: Separate listener method filtering to its own method
...
this makes registerEvents() easier to read.
2021-06-27 20:25:28 +01:00
Dylan K. Taylor
6cb285d4a9
Added constants for the handler tag types
2021-05-06 18:40:14 +01:00
Dylan T
127b57048c
Allow plugins to use PSR-4 namespace mapping ( #4188 )
...
* Allow plugins to use PSR-4 namespace mapping
this is a reduced implementation which serves the 99% use case without being horribly breakable.
Plugins may now specify a `src-namespace-prefix`, which should be set to the namespace of the classes in `src`.
If the old system is used, `src-namespace-prefix` can be omitted, or set to an empty string.
Examples:
- If `src-namespace-prefix` is `dktapps\test`, `dktapps\test\Main` will be searched for in `src/Main.php`, instead of `src/dktapps/test/Main.php`.
* Migrate TesterPlugin to PSR-4
2021-04-23 19:34:46 +01:00
Dylan K. Taylor
52ce8ad8ae
Plugin: removed useless shit
...
Plugin is the interface by which the server core interacts with plugins, so it should be limited only to the stuff that the server actually uses.
These methods are still provided by PluginBase, so in 99.9% of cases there will be no BC break.
2021-03-25 19:17:16 +00:00
Dylan K. Taylor
49438d360d
RegistryUtils: generate ordered doc comments
...
this makes things easier to find, especially in the large ones like VanillaBlocks.
2021-03-22 16:16:28 +00:00
Dylan K. Taylor
90161f24e3
Added script to update registry/enum docblocks
2021-03-22 16:00:09 +00:00
Dylan K. Taylor
21bafd9f07
PluginBase: add void return typehints to onLoad(), onEnable() and onDisable()
2021-02-06 20:20:36 +00:00
Dylan K. Taylor
bbae02264d
Merge branch 'stable'
2021-01-27 20:04:13 +00:00
Dylan K. Taylor
487b5dd11d
Merge branch 'stable'
2021-01-16 19:44:15 +00:00
Dylan K. Taylor
05a1f45111
PluginGraylist: all fields are mandatory
2020-12-08 13:38:44 +00:00
Dylan K. Taylor
d48af3f4ca
Merge branch 'stable'
...
# Conflicts:
# composer.lock
# resources/vanilla
# src/permission/BanEntry.php
# src/permission/PermissionAttachmentInfo.php
2020-12-01 17:35:30 +00:00
Dylan T
6d8833ccd3
Removal of permission defaults (in favour of permission cascading) ( #3937 )
2020-12-01 17:13:54 +00:00
Dylan K. Taylor
463bc044df
Rename PluginLoadOrder -> PluginEnableOrder
...
this more accurately describes its real purpose.
2020-11-09 20:28:08 +00:00
Dylan K. Taylor
23e5ade77e
Merge branch 'stable' into master
...
# Conflicts:
# build/make-release.php
# composer.lock
# resources/vanilla
# src/plugin/PluginDescription.php
# src/pocketmine/entity/Human.php
2020-10-21 16:55:52 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
44e446b621
Merge remote-tracking branch 'origin/stable' into master
...
# Conflicts:
# build/php
# composer.lock
# phpstan.neon.dist
# resources/vanilla
# src/pocketmine/Server.php
# src/pocketmine/VersionInfo.php
# src/pocketmine/entity/Entity.php
# src/pocketmine/lang/locale
# src/utils/Timezone.php
# tests/phpstan/bootstrap.php
# tests/phpstan/configs/custom-leveldb.neon
2020-10-13 17:51:49 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
49bd58a86a
DiskResourceProvider: do not trim backslashes from path when we're not on Windows
2020-05-24 14:26:12 +01:00
Dylan K. Taylor
2170f81cdd
PluginManager: remove dead function isCompatibleApi()
...
moved to ApiVersion static class
2020-05-24 14:14:47 +01:00
Dylan K. Taylor
5b7a55660f
Merge commit '786f416f2ef31726b9e6fa0a5edde36aecddf085'
...
# Conflicts:
# resources/vanilla
# src/plugin/PluginBase.php
# src/utils/Utils.php
2020-05-19 21:19:44 +01:00
Dylan K. Taylor
3fb34ad18e
remove particle/validator dependency, require respect/validation, close #3228
...
this fixes a few crashes that could appear from invalid plugin_list.yml setups, which was the reason #3228 was opened to begin with. Respect also has nicer error messages, as long as you don't use the static API :)
2020-05-15 22:57:38 +01:00
Dylan K. Taylor
3238b4ff33
Remove PluginIdentifiableCommand in favour of a more generic PluginOwned interface
2020-05-11 19:25:52 +01:00
Dylan K. Taylor
f9a587d40e
imports cleanup
2020-04-28 17:27:38 +01:00
Muqsit Rayyan
a5441e009d
remove "resource/" suffixed to DiskResourceProvider::$file ( #3433 )
2020-04-24 00:21:00 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
ca909ebc1d
Merge branch 'next-minor'
2020-03-10 13:05:37 +00:00
Dylan K. Taylor
b4b1877ce5
Merge branch 'next-minor'
2020-03-09 14:38:15 +00:00
Dylan K. Taylor
d2aca6023b
add native return types to closures (for phpstan)
2020-02-07 22:05:15 +00:00
Dylan K. Taylor
aac7da6c96
eliminate remaining empty() usages
2020-02-07 21:51:50 +00:00
Dylan K. Taylor
347b94b284
Merge branch 'stable'
2020-02-07 20:18:17 +00:00
Dylan K. Taylor
fb1126797a
Merge branch 'stable'
2020-02-07 18:13:55 +00:00
Dylan K. Taylor
e1eb9186fe
Merge branch 'stable'
2020-02-03 19:57:21 +00:00
Dylan K. Taylor
9c33ea8dd1
EnumTrait: use a better method to initialize enums
...
this method is simpler, and is also safe at the native type level.
Coincidentally, it also eliminates 30 PHPStan false-positives.
2020-02-01 20:33:30 +00:00
Dylan K. Taylor
ff63f6d055
fill in more iterable types (master)
2020-02-01 20:19:57 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
cb16f5c142
Merge commit '260ac47588c76a2e6814cfba46773a990fb8c5da'
...
# Conflicts:
# resources/vanilla
# src/Server.php
# src/lang/Language.php
# src/network/mcpe/protocol/AddItemActorPacket.php
# src/network/mcpe/protocol/AddPlayerPacket.php
# src/network/mcpe/protocol/SetActorDataPacket.php
# src/network/mcpe/serializer/NetworkBinaryStream.php
# src/permission/Permission.php
# src/pocketmine/block/Leaves.php
# src/pocketmine/entity/DataPropertyManager.php
# src/pocketmine/entity/Entity.php
# src/pocketmine/item/Banner.php
# src/pocketmine/item/Item.php
# src/pocketmine/level/format/io/LevelProvider.php
# src/pocketmine/level/format/io/LevelProviderManager.php
# src/pocketmine/network/mcpe/protocol/AddActorPacket.php
# src/pocketmine/network/mcpe/protocol/LoginPacket.php
# src/pocketmine/tile/Banner.php
# src/scheduler/BulkCurlTask.php
# src/updater/AutoUpdater.php
# src/utils/Config.php
# src/utils/Utils.php
# src/world/generator/Flat.php
# src/world/generator/Generator.php
2020-01-31 21:07:34 +00:00
Dylan K. Taylor
19a6fb35e7
Merge commit 'd94995e161d71659e2fe6ec1df47621f2de4b494'
...
# Conflicts:
# resources/vanilla
2020-01-31 19:46:28 +00:00
Dylan K. Taylor
5c4487c980
added some callable prototypes for phpstan
2020-01-29 19:56:16 +00:00