159 Commits

Author SHA1 Message Date
Dylan K. Taylor
bfcf4a25d4
Automatic cleanup of permission subscriptions on PermissibleBase destructor calls
this has gotten too complex ...
2021-06-12 21:12:39 +01:00
Dylan K. Taylor
5a14c1cb89
Entity: don't rebuild metadata every tick unless an associated property changed
this should improve performance back to PM3 levels.
2021-05-17 20:05:52 +01:00
Dylan K. Taylor
42e915b902
Player: added locking variable to prevent reentry into respawn() while awaiting spawn terrain generation 2021-05-12 12:10:32 +01:00
Dylan K. Taylor
4a68e0219e
shut 2021-05-11 19:29:30 +01:00
Dylan K. Taylor
ab0500ae4f
Player: Fixed a multitude of bugs with respawning
the following things are changed:
- Player->getSpawn() no longer returns a safe spawn by default. Instead, if the player doesn't have a spawn set, it returns the world's stored spawn directly. This allows consistent behaviour of locating safe respawn positions without double calculation of safe spawn position, and also fixes crash issues during the login sequence if the player's spawn position referred to ungenerated terrain.
- Player->respawn() is now asynchronous, using the promise returned by orderChunkPopulation() to complete respawn after the terrain is generated. This allows consistently selecting a safe respawn position and fixes crashes when respawning if the spawn location was in ungenerated terrain.

There remains a problem that ragequit respawns are still only handled right after PlayerJoinEvent, which leads to the original spawn terrain being sent to the player, which is obviously very wasteful. However, that's a problem for a later commit.
2021-05-11 19:15:31 +01:00
Dylan K. Taylor
1533789f35
Player: fixed not subscribing to own inventory updates
fixes #4211
2021-05-09 19:36:36 +01:00
Dylan K. Taylor
624495f4d3
Added a generic Promise type
I anticipate increasing demand for promises, and since all the libraries I could find suck, we'll stick to our own impl for now.
2021-05-08 15:57:30 +01:00
Dylan K. Taylor
652de2632a
Rough OffHand implementation
this doesn't do stuff like taking arrows from offhand yet.
2021-05-05 14:46:51 +01:00
Dylan K. Taylor
845819123d
Player: drop perm nulling
this is no longer necessary because the PermissibleBase doesn't keep a ref to the Player anymore.
2021-04-27 14:49:26 +01:00
Dylan K. Taylor
09a2402f01
Fixed precondition on double chunk send being useless
this is messy, but necessary for now.
2021-04-19 00:50:43 +01:00
Dylan K. Taylor
6d38922af0
Undo my -100IQ fuckup with chunk sending precondition
the commit I reverted put the preconditions in the completion handler,
which is executed AFTER THE CHUNK IS SENT.

Revert "NetworkSession: allow Player to handle its own business in chunk sending"

This reverts commit a223d1cbf3e8a9143383b6497f4d2d5d7ab3202a.
2021-04-19 00:36:13 +01:00
Dylan K. Taylor
35a3522b4e
Player: fixed chunks getting spammed like crazy during generation
because of the shitty way that the chunk resending is handled, it causes all kinds of problems with the async system because of potential reversions of the state during the process.
2021-04-19 00:30:34 +01:00
Dylan K. Taylor
b4afa46fad
Player: don't re-request chunks unless they've already been sent
if they've been requested, the ChunkCache will take care of rebuilding the chunk packet before sending it.
2021-04-18 23:53:34 +01:00
Dylan K. Taylor
adbc58f326
TickingChunkLoader: use native return types 2021-03-26 22:55:48 +00:00
Dylan K. Taylor
cdeedbad8b
Player: extract some entity spawning logic into a separate function 2021-03-26 22:51:56 +00:00
Dylan K. Taylor
de49a361c0
NetworkSession: Remove parameters from startUsingChunk() callback
these can easily be use()d into the closure (which also has slightly better performance, because no type checks - not that anyone will notice).
2021-03-26 22:45:36 +00:00
Dylan K. Taylor
a223d1cbf3
NetworkSession: allow Player to handle its own business in chunk sending
these checks should appear consistently in all of these async callbacks.
2021-03-26 22:00:42 +00:00
Dylan T
f047ecfd2d
Fixed player spawning in ungenerated terrain (#4087)
fixes #4044
fixes #2724

this is significantly more complex than I hoped for, but it's a start... and it works.
2021-03-26 21:36:27 +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
c092a2e836
Separate TickingChunkLoader from ChunkLoader
this makes it possible to keep chunks loaded without ticking them.
2021-03-18 23:19:27 +00:00
Dylan K. Taylor
72de45f0e9
Drop pocketmine/uuid for ramsey/uuid 2021-03-16 23:03:00 +00:00
Dylan K. Taylor
c1e5dd2a4e
Merge branch 'stable' 2021-03-07 20:15:11 +00:00
Dylan K. Taylor
8d5cc9adc3
Merge branch 'stable' 2021-02-07 20:57:19 +00:00
Dylan K. Taylor
2064b411f2
fix build 2021-01-20 22:53:51 +00:00
Dylan K. Taylor
c70c0b55df
Separate held item index change listener logic from PlayerInventory 2021-01-12 16:44:25 +00:00
Dylan K. Taylor
c4845ab6b1
Use Player->getNetworkSession() in places where it's assumed the player will be connected 2021-01-10 19:51:41 +00:00
Dylan K. Taylor
5e73417fa9
Player::getNetworkSession() now explicitly handles disconnected state by throwing an exception
instead of just allowing return of possibly-null networkSession
2021-01-10 19:50:13 +00:00
Dylan K. Taylor
3ef2a19527
Player: don't kick for attacking non-attackable entities
this is quite out-of-character for PM - it usually handles bad network requests by ignoring them, not by kicking the player off the server.
2021-01-08 20:58:15 +00:00
Dylan K. Taylor
e53b57732b
Entity: replace separate height/width/eyeHeight fields with an EntitySizeInfo structure
this will make it easier to implement stuff like sleeping (properly), swimming and gliding without needing to duplicate all the fields.
2021-01-08 00:11:01 +00:00
Dylan K. Taylor
574b615b4c
Player: fixed attack sounds being added at the wrong position 2021-01-08 00:04:05 +00:00
Dylan K. Taylor
a3597e195a
Player: extract getSaveData() from save()
this allows plugins to request this data whenever they want it (e.g. to save offline any time they want, instead of being confined to the server autosave interval).
2021-01-07 23:37:47 +00:00
Dylan K. Taylor
eaaed79b93
Player: remove useless check from save()
this exception is only thrown if the player is closed, which is already unexpected in the first place and will actually crash if it's not kosher. This prevents doing stuff like saving players during onDispose(), which crashes the server if a player is disconnected due to flagForDespawn().
2021-01-07 23:33:10 +00:00
Dylan K. Taylor
7b806e74b8
Player: use own logger for movement debug 2021-01-07 22:06:55 +00:00
Dylan K. Taylor
82c8fa696a
Relocate teleport ACK checks to InGamePacketHandler 2021-01-07 20:43:31 +00:00
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
e762b79aae
Player: fixed setPosition() resending all the chunks
closes #3977
2020-12-21 00:09:49 +00:00
Dylan K. Taylor
1e737644de
World: split populateChunk() into two functions
requestChunkPopulation() respects the queue size, orderChunkPopulation() does not.
requestChunkPopulation() should be used for non-essential generation (which mainly includes generation for player use).
orderChunkPopulation() should probably be used by plugins.
2020-12-17 23:49:37 +00:00
Dylan K. Taylor
e925423749 Entity: fix chunk tracking consistency issues, fixed attempted chunk loading in origin world when teleporting to a different position in a different world 2020-12-10 18:13:18 +00:00
Dylan K. Taylor
e056456dd1 Player: fixed crash when stopping using a chunk before it's finished being generated 2020-12-04 15:36:43 +00:00
Dylan K. Taylor
c808095978 Chunks no longer contain their own coordinates 2020-12-03 21:59:30 +00:00
Dylan K. Taylor
1775fb669b SurvivalBlockBreakHandler: fixed block break effects stopping beyond 4 blocks distance
this was actually intended to be 16 blocks ...
2020-12-02 18:56:39 +00:00
Dylan K. Taylor
bc2fafca27 Fixed players losing all permissions when being de-opped after joining as op 2020-12-02 17:04:37 +00:00
Dylan K. Taylor
880635603c PermissibleBase: allow injecting more dynamic base permissions 2020-12-02 10:12:40 +00:00
Dylan K. Taylor
0634426c26 PermissibleBase: compute permission diff, do not fire callbacks when diff is empty
this fixes AvailableCommandsPacket getting sent twice when adding a PermissionAttachment.
2020-12-02 01:09:29 +00:00
Dylan K. Taylor
cc473184ac Player: added API method getUsedChunks() 2020-12-01 19:40:22 +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 K. Taylor
8fb74258f4 Implemented a better method for detecting permission recalculation
this allows anyone to listen to permissions being recalculated, which is useful for stuff like broadcast channel subscriptions.
2020-12-01 18:23:42 +00:00
Dylan K. Taylor
c20893aa4b PermissibleBase: more robust cycle destruction 2020-12-01 17:57:55 +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