239 Commits

Author SHA1 Message Date
Dylan K. Taylor
bcc3e87730
Timings: rename core timers to remove 'timer' from the names
this makes them shorter and more consistent.
2020-12-23 17:52:25 +00:00
Dylan K. Taylor
9228f006d4
Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	composer.json
#	composer.lock
#	resources/vanilla
#	src/CrashDump.php
#	src/PocketMine.php
#	src/pocketmine/Server.php
#	src/pocketmine/item/Bucket.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/Chunk.php
#	src/pocketmine/level/format/io/leveldb/LevelDB.php
#	src/pocketmine/level/format/io/region/McRegion.php
#	src/pocketmine/network/mcpe/protocol/BatchPacket.php
#	src/pocketmine/tile/Furnace.php
#	src/pocketmine/utils/UUID.php
#	src/utils/ServerKiller.php
2020-12-20 20:54:13 +00:00
Dylan K. Taylor
9e11cc03de
Server: get rid of matchPlayer()
the functionality of this API method is too specialized to be of any practical use.
In addition, a search on Poggit reveals that the only uses of this API method are abuses or incorrect uses anyway.
2020-12-13 21:38:11 +00:00
Dylan K. Taylor
c0438f1ddb
Move player creation out of NetworkSession 2020-12-13 21:20:37 +00:00
Dylan K. Taylor
5f4ef84d52
Clean up imports 2020-12-12 19:48:00 +00:00
Dylan T
03b1ea766a
Added a DedicatedQueryNetworkInterface to ensure Query functionality when RakLibInterface is disabled (#3942) 2020-12-04 21:21:25 +00:00
Dylan K. Taylor
29f6ed3f68 Use Snooze to improve AsyncTask collection times
regardless of how long an async task takes to run, it will take a multiple of 50ms to get the result processed. This delay causes issues in some cases for stuff like generation, which causes locking of adjacent chunks, and async packet compression, which experiences elevated latency because of this problem.
This is not an ideal solution for packet compression since it will cause the sleeper handler to get hammered, but since it's already getting hammered by every packet from RakLib, I don't think that's a big problem.
2020-12-02 19:34:34 +00:00
Dylan K. Taylor
687ad28fa6 Added a PacketBroadcaster interface
this gives a bit more control over how packets are broadcasted, which might be useful if the batch format changes (e.g. adding a length prefix) for multi version.
This really ought to be unique to a protocol context instead of a network interface, but for now this is the best we can do.
2020-12-02 16:34:14 +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
d56cf35385 Permissions are now always false when permission calculation hasn't been done yet
lack of permission calculation means that child permissions might not have been set correctly, so this might lead to users being able to access things they aren't supposed to.
2020-11-28 21:55:26 +00:00
Dylan K. Taylor
97a4d80854 PlayerDataSaveEvent: provide online player if possible, otherwise don't load offline data from disk for no reason (we already have it, that's the whole point of the event ...) 2020-11-28 21:43:23 +00:00
Dylan K. Taylor
614891f8a2 OfflinePlayer no longer depends on Server
it also doesn't provide stuff like isOnline() (you had to have a Server reference to get an OfflinePlayer anyway, just ask the Server if the player is online ...) and getPlayer().
2020-11-28 21:29:41 +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
70b0d83258 Removed Server->broadcast()
this method has an explicit dependency on permission subscriptions, which I plan to eradicate.
The method's functionality can be replaced using Server->broadcastMessage() with a custom recipients array.
2020-11-28 13:01:10 +00:00
Dylan K. Taylor
5142281cfa [ci skip] Server: remove misleading comment 2020-11-27 17:57:52 +00:00
Dylan K. Taylor
4d42f0c3db Timings: added timers for player data I/O 2020-11-27 00:02:34 +00:00
Dylan K. Taylor
0be60fe1eb NetworkSession: Force use of async compression during the login sequence when latency doesn't matter
closes #3907
this reduces the impact of compression on the login sequence by about 90%; however, since compression only accounted for about 30% of said overhead at most, it's not really a massive difference.
2020-11-26 23:39:19 +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
31089ce3b2 Timings: added broadcastPackets timer
the body of this function is potentially very expensive and isn't currently recorded by any timer.
2020-11-12 17:53:07 +00:00
Dylan K. Taylor
5efd0eba13 Imports cleanup 2020-11-12 17:11:34 +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
b176f4c12f Switch to BiomeRegistry
I accidentally committed this in c869a7f099237ca189dc574fe3df6e7630eeec51 and didn't notice. I intended to use it and never noticed.
2020-11-01 16:47:13 +00:00
Dylan K. Taylor
d6ed542fcd Merge remote-tracking branch 'origin/stable' into master
# Conflicts:
#	composer.json
#	composer.lock
#	src/CrashDump.php
#	src/pocketmine/Server.php
#	src/pocketmine/level/format/io/region/McRegion.php
#	tests/phpstan/configs/check-explicit-mixed-baseline.neon
#	tests/phpstan/configs/l7-baseline.neon
#	tests/phpstan/configs/l8-baseline.neon
#	tests/travis/setup-php.yml
2020-10-26 16:18:53 +00: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
40fca0936f Internet: make getURL() and postURL() return InternetRequestResult objects
this reduces the amount of reference parameters, and generally reduces the number of parameters, while guaranteeing consistency of the APIs.
2020-10-09 18:03:20 +01:00
Dylan K. Taylor
7b02cc3efd Implemented #3836: Replace setCancelled() in events with cancel() and uncancel()
The motivation for this is to prevent passing a dynamic argument to cancellation, which in almost all cases is a bug in user code. This same mistake also appears in a few places in the PM core (as seen in this commit), but in those cases the mistakes were mostly harmless since they were taking place before the event was actually called.
closes #3836
2020-09-26 14:31:56 +01:00
Dylan K. Taylor
2c29634d03 Remove VERSION and GIT_COMMIT constants
these are now lazily computed in VersionInfo as needed.
2020-07-25 19:17:33 +01:00
Dylan K. Taylor
2645b19617 Convert VersionInfo into a final class
this allows it to be loaded by the autoloader without additional changes.
2020-07-25 19:00:48 +01:00
Dylan K. Taylor
bc52a38922 Improved network bandwidth data collection 2020-07-21 19:21:27 +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
96541763f1 ConsoleCommandSender: inject Language via constructor 2020-07-01 13:38:05 +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
11eb1f1c5e imports cleanup 2020-06-18 20:01:19 +01:00
Dylan K. Taylor
edc3156bea Rename NetworkCipher -> EncryptionContext 2020-06-18 11:37:53 +01:00
Dylan K. Taylor
506f98efc4 Eliminate usages of BaseNbtSerializer->readCompressed() and BaseNbtSerializer->writeCompressed() 2020-06-17 14:31:56 +01:00
Dylan K. Taylor
13031967f4 Merge commit '0029efa37'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Server.php
2020-06-14 19:36:50 +01:00
Dylan K. Taylor
c29ed34b54 Merge commit 'f4ee2912db89c6629d4fa191e993f0798035ef20'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Server.php
2020-06-04 14:13:23 +01:00
Dylan K. Taylor
c93038f574 Inject WorldProviderManager to WorldManager's constructor, no longer singleton 2020-05-24 19:22:04 +01:00
Dylan K. Taylor
41566e8077 Server: remove unused BOOTUP_RANDOM constant
this used to be used for /dumpmemory filenames, but those were confusing and stupid, and it's not used anymore since March 2018.
2020-05-24 18:33:04 +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
5f2e65d608 QueryHandler: be honest about dependency on Server 2020-05-23 12:28:12 +01:00
Dylan K. Taylor
23ab6a283b Separate QueryInfo from QueryRegenerateEvent
this removes some useless and confusing APIs from query info.
2020-05-23 11:55:29 +01:00
Dylan K. Taylor
c9af5ce7a9 Convert GeneratorManager to singleton 2020-05-23 10:13:03 +01:00
Dylan K. Taylor
640428c415 Convert WorldProviderManager to singleton 2020-05-23 10:02:09 +01:00
Dylan K. Taylor
8d9759288c WorldManager: don't hard-depend on server configuration for autosave settings 2020-05-23 09:43:59 +01:00
Dylan K. Taylor
fcea7da183 WorldManager: allow dataPath to be injected via constructor 2020-05-23 09:37:37 +01:00
Dylan K. Taylor
3795a13683 Merge commit '2eb62c85f69ebd22b36f29cfb513a579ea570b0c'
# Conflicts:
#	resources/vanilla
#	src/Server.php
2020-05-18 10:29:06 +01:00