233 Commits

Author SHA1 Message Date
Dylan K. Taylor
0402e7e697
Separate CommandReader impl from CommandReaderThread 2021-05-29 23:41:11 +01:00
Dylan K. Taylor
2bc0f9f7a2
TimingsCommand: do not enable timings if they are already enabled
this causes timings to be reset, which is potentially undesirable (loss of already-collected timing data).
closes #4194
2021-04-27 22:39:13 +01:00
Dylan K. Taylor
e720c001a9
ConsoleCommandSender: ensure that PermissibleBase doesn't leak
if recalculatePermissions() was called, the PermissionManager will reference it, preventing it from being GC'd.
2021-04-11 17:21:29 +01:00
Dylan K. Taylor
ad048f0b7f
Merge remote-tracking branch 'origin/stable' 2021-03-23 15:17:10 +00:00
Dylan K. Taylor
b844c4266d
Added World::Y_MIN
preparation for Y axis expansion in 1.17
2021-03-17 23:19:49 +00:00
Dylan K. Taylor
b3c6c11b20
BulkCurlTask now accepts a closure callback for onCompletion
this requires much less boilerplate code than an anonymous class.
2021-03-16 23:56:14 +00:00
Dylan K. Taylor
bbae02264d
Merge branch 'stable' 2021-01-27 20:04:13 +00:00
Dylan K. Taylor
c5693598aa
BulkCurlTask constructor now accepts BulkCurlTaskOperation[] instead of shaped arrays 2020-12-20 22:18:03 +00:00
Dylan K. Taylor
5282ae3298 TimingsHandler::printTimings() now returns a list of strings instead of requiring a resource 2020-12-09 22:32:32 +00:00
Ifera
c4b47c6c06 Implemented /clear command (#3854)
closes #3854
2020-12-06 15:26:12 +00:00
Dylan K. Taylor
5197707d32 Separated TimingsRecord from TimingsHandler (different lifetimes)
this fixes #3906.
TimingsHandler will now be automatically destroyed when there are no TimingsRecord referencing it and its owner has no references left to it.
TimingsRecord will be automatically destroyed at the end of the timings session (if active).

This fixes records from temporary timers being lost after the timings handlers are removed, while also fixing TimingsHandlers piling up regardless of whether timings are running or not.
This opens the doors to have more volatile timers, such as per-player/per-session timers, which are destroyed on player quit, but which won't result in the timings disappearing from the final timings result.
2020-12-03 15:45:49 +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
880635603c PermissibleBase: allow injecting more dynamic base permissions 2020-12-02 10:12:40 +00:00
Dylan K. Taylor
1905c01c87 PermissibleBase no longer circularly references its parent permissible
this was used for 2 things:
- to notify parent permissibles on recalculate permissions (not needed anymore thanks to callbacks)
- subscription to chat broadcast permissions (now handled separately, again using callbacks)

therefore, it's no longer needed for PermissibleBase to reference its parent, meaning that we can have one less circular dependency in our lives.
2020-12-01 18:46:39 +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
dd200ca8cd Rewrite message broadcasting system to not depend on PermissionManager subscriptions
relying on permission subscriptions for this was unreliable (a permissible is not always subscribed to a permission even when it does have it), and also difficult to control (for example there have been various bugs in the past where a Player ended up subscribed to broadcast permissions when it didn't expect to be, thanks to permission recalculation happening too early).
In addition, we might in the future want to have broadcast receivers which are not permissibles (i.e. a more general interface than CommandSender (why does a broadcast receiver need to also be a command sender, anyway?)), which the permission system wouldn't be suitable for.
2020-11-28 19:28:47 +00:00
Dylan K. Taylor
c7961bfe90 Toss ServerOperator; PermissibleBase now tracks its own op status
as well as being simpler, this also allows some nice features, such as granting memory-only op state that goes away when the player quits the server.
2020-11-28 18:22:59 +00:00
Dylan K. Taylor
5e44d5f75e Do not load playerdata from disk just to op/deop/whitelist/dewhitelist
this is an impressively dumb idea.
the playerdata is not used here in any capacity so it doesn't make sense to load it, especially considering that it takes a significant amount of time.
2020-11-27 18:12:45 +00:00
Dylan K. Taylor
870d237260 BlockFactory::get() second parameter is now mandatory 2020-11-18 00:50:01 +00:00
Dylan K. Taylor
7469f28f24 Server: rename getPlayer() to getPlayerByPrefix()
closes #3910

the existing naming was misleading, and many plugin devs assumed that it returns an exact match. However, this is not guaranteed, and it's possible for two different players to match the same prefix.

- There is no defined behaviour for what happens when multiple players can equally match a prefix (e.g. 'fr' could match 'fred' or 'frog' equally, because the name lengths are the same)
- A prefix might match a different player at a different time (e.g. 'fr' could match 'freddie' before 'fred' joins, after which it will match 'fred' instead)

With these flaws in mind, it's better to break compatibility on this to make the intent more clear, and to make plugin developers reassess their usages of this method. In most non-command use cases, they should likely be using getPlayerExact() instead.
2020-11-14 15:49:41 +00:00
Dylan K. Taylor
2e1239f77a EnchantCommand no longer accepts numeric enchantment IDs 2020-10-24 17:33:17 +01:00
Muqsit Rayyan
3b632a8deb
Handle InvalidArgumentException thrown by VanillaEnchantments::fromString (#3878) 2020-10-24 06:43:14 +01:00
Dylan K. Taylor
a01c086481 Introduced VanillaEnchantments registry 2020-10-23 20:48:19 +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
46c57e4e24 TimingsCommand: fixed crash on result handling
since AsyncTask->getResult() returns mixed, phpstan has no idea what is being returned here, so it doesn't report any errors.
2020-10-11 11:35:03 +01:00
Dylan K. Taylor
75e3a0aa0f Merge branch 'stable' into master
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/command/defaults/StatusCommand.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/level/format/SubChunk.php
2020-09-26 13:27:08 +01:00
Dylan K. Taylor
bc52a38922 Improved network bandwidth data collection 2020-07-21 19:21:27 +01:00
Dylan K. Taylor
977f9ec497 Merge branch 'stable'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/VersionInfo.php
#	src/pocketmine/block/Podzol.php
2020-07-21 11:57:24 +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
7106ff575c End abuse of PluginCommand by making it final
PluginCommand should be better-named CommandExecutorCommand or perhaps CallbackCommand. It's not supposed to be extended by plugins.
2020-07-07 19:42:47 +01:00
Dylan K. Taylor
991abe8864 Merge commit 'fb6491dde'
# Conflicts:
#	resources/vanilla
2020-07-04 22:25:56 +01:00
Dylan K. Taylor
5cf74fc16b Merge commit '3b961d0e5'
# Conflicts:
#	resources/vanilla
2020-07-04 22:25:23 +01:00
Dylan K. Taylor
76cf3b7aa5 Merge commit 'a60fc4cc2'
# Conflicts:
#	resources/vanilla
2020-07-04 22:24:33 +01:00
Dylan K. Taylor
373783d99b Merge commit 'b747899fd'
# Conflicts:
#	resources/vanilla
2020-07-04 22:23:26 +01:00
Dylan K. Taylor
96541763f1 ConsoleCommandSender: inject Language via constructor 2020-07-01 13:38:05 +01:00
Dylan K. Taylor
670ad9eb9d Position: rename getWorldNonNull() to getWorld(), remove original getWorld() 2020-06-29 21:19:46 +01:00
Dylan K. Taylor
52fd1a8c1d CommandSender: export getLanguage()
this currently serves as a proxy to the server main language, but it can be used by third party implementations to choose a non-Server language.
2020-06-22 20:05:23 +01:00
Dylan K. Taylor
1f90aa07aa Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/command/defaults/TeleportCommand.php
#	src/pocketmine/event/entity/EntityDespawnEvent.php
#	src/pocketmine/event/entity/EntityInventoryChangeEvent.php
#	src/pocketmine/event/entity/EntityLevelChangeEvent.php
#	src/pocketmine/event/entity/EntitySpawnEvent.php
#	tests/phpstan/configs/actual-problems.neon
2020-06-21 00:30:45 +01:00
Dylan K. Taylor
5a8633f6c0 Merge commit '409c8c170'
# Conflicts:
#	resources/vanilla
2020-06-13 11:57:58 +01:00
Dylan K. Taylor
da3ba1e2b2 Merge commit 'a27b29897'
# Conflicts:
#	resources/vanilla
2020-06-13 11:28:03 +01:00
Dylan K. Taylor
b2f182b196 Merge commit 'd234d3e45'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/command/defaults/ParticleCommand.php
2020-06-03 12:55:46 +01:00
Dylan K. Taylor
3473254d01 added Timings::INCLUDED_BY_OTHER_TIMINGS constant 2020-05-24 16:09:45 +01:00
Dylan K. Taylor
fe649d8d70 Extract ServerConfigGroup from Server
this API isn't very nice, but it's pretty much the same as the original, and at least this can be _kinda_ unit-tested...
2020-05-24 15:48:03 +01:00
Dylan K. Taylor
5eadb0ac44 ConsoleCommandSender: be honest about Server dependency 2020-05-23 12:31:22 +01:00
Dylan K. Taylor
0025196a81 Merge branch 'next-minor'
# Conflicts:
#	resources/vanilla
#	src/network/upnp/UPnP.php
2020-05-23 11:16:19 +01:00
Dylan K. Taylor
14dd7f306b Merge commit '45c89d084'
# Conflicts:
#	resources/vanilla
#	src/command/defaults/TimeCommand.php
2020-05-23 11:14:12 +01:00
Dylan K. Taylor
81dff6d4c5 Merge branch 'next-minor' 2020-05-19 21:32:44 +01:00
Dylan K. Taylor
232ff838db Merge commit '22b5de09b476a8c1638adfaba56b210c1eb1faf0'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/level/particle/InstantEnchantParticle.php
#	src/world/sound/ExplodeSound.php
2020-05-18 20:30:00 +01:00
Dylan K. Taylor
86db3af896 remove utils\Color, use new pocketmine/color class
we're so close to separating protocol from core !!!
2020-05-14 20:38:08 +01:00
Dylan K. Taylor
11ef9fb0c0 Item-from-string parsing no longer depends on ItemIds
after this is done I'm banning the constant() function.
2020-05-13 00:18:49 +01:00