1376 Commits

Author SHA1 Message Date
Dylan K. Taylor
034bd716c8 Clean up WritableBook hierarchy 2019-03-23 14:36:03 +00:00
Dylan K. Taylor
1045088668 Move more packet handling logic out of Player
there is now only (1) packet handler remaining in Player. The reason I haven't targeted this is because it needs improvements of its own.
2019-03-23 12:12:30 +00:00
Dylan K. Taylor
1bc37a1a8a Player: Clean up movement processing, now API-ified 2019-03-23 11:33:32 +00:00
Dylan K. Taylor
1d1a416afe Player: Move construction logic to the top 2019-03-23 10:39:19 +00:00
Dylan K. Taylor
f3309d3aec Player: remove some field defaults 2019-03-23 10:29:16 +00:00
Dylan K. Taylor
9ec62643d5 Player construction now happens when we're ready to create the player entity
this fixes a wide range of bugs with the initial spawn sequence, and allows to simplify a whole lot of player setup logic.
2019-03-23 10:13:14 +00:00
Dylan K. Taylor
60225a378f Player: fixed block-picking logic
this now matches vanilla (with some minor intentional differences) and works in survival.
2019-03-22 18:28:36 +00:00
Dylan K. Taylor
b8d1eb20b0 EntityDeathEvent: add XP amount API, closes #2690 2019-03-21 19:53:14 +00:00
Dylan K. Taylor
89c0836047 Fixed paintings dropping multiple times, closes #2774 2019-03-21 19:46:43 +00:00
Dylan K. Taylor
8c536c248d Updating for latest PocketMine-NBT changes 2019-03-21 15:58:22 +00:00
Dylan K. Taylor
cce99b07af 1.10.0 updates 2019-03-20 19:17:41 +00:00
Dylan K. Taylor
41d13b6f06 Player: remove dead condition
this can't be reached because the only place it's called is from Level->actuallyDoTick(), where it won't appear until long after the player is logged in.
2019-03-14 14:47:20 +00:00
Dylan K. Taylor
a1ffaffa7f Don't record player on stats until they actually exist 2019-03-14 14:46:19 +00:00
Dylan K. Taylor
ebfe9caca3 Move too-early-send check to NetworkSession 2019-03-14 14:45:30 +00:00
Dylan K. Taylor
26a5d97499 Some cleanup to player net session handling for connect/disconnect 2019-03-14 14:32:43 +00:00
Dylan K. Taylor
6c8fa8ae28 More nullable and void typehints 2019-03-02 10:29:11 +00:00
Dylan K. Taylor
5cca4b5e31 Revamp Sign API, flatten API into blocks 2019-02-28 17:10:37 +00:00
Dylan K. Taylor
ba616ed8a7 Player: Don't rely on magic numbers for gamemodes 2019-02-27 11:01:26 +00:00
Dylan K. Taylor
9b3230aa9c Merge branch '3.6' 2019-02-27 10:19:58 +00:00
Dylan K. Taylor
20b4723728 Player: fixed held slot being out of sync after dying, closes #2788
it appears this premature optimization dates back to the days when PlayerHotbarPacket was not useless.
2019-02-27 09:26:56 +00:00
Dylan K. Taylor
d1ced0ffc6 Player: fixed XP not dropping on death 2019-02-27 09:22:52 +00:00
Dylan K. Taylor
6124f93cb4 Player: Clean up item frame drop-item hack
This is now re-routed through a newly-created attack-block handler.
Closes #339
2019-02-25 18:40:04 +00:00
Dylan K. Taylor
a3907377f5 Merge branch '3.6' 2019-02-24 12:14:40 +00:00
Dylan K. Taylor
0c3b136a8d Player: fixed removeWindow() sometimes removing GUI / crashing clients 2019-02-24 12:14:19 +00:00
Dylan K. Taylor
998dcb421e Flatten Item Frame implementation into its block (mostly)
This exposes nice API on the ItemFrame class, while keeping the tile bullshit out of sight so that we can remove it later on.
2019-02-23 18:19:31 +00:00
Dylan K. Taylor
eadb1d310e Level->sendBlocks() now syncs tiles 2019-02-23 16:53:29 +00:00
Dylan K. Taylor
c26544475e More PHP 7.1 nullables 2019-02-22 12:55:34 +00:00
Dylan K. Taylor
73a565355b Make some forced-optional nullable parameters non-optional, PHP 7.1 style
these parameters did not make any sense to be optional, but were forced to be this way because of the way nullable types worked before 7.1.
2019-02-22 12:54:00 +00:00
Dylan K. Taylor
646fea5a4e Effect: Introduce a bunch of static getters, change a bunch of API to use objects
This introduces static getters for every currently-known effect type. At some point in the near future, the magic number constants (which are really network IDs, by the way) will disappear.

Migrating:
- If you used constants (like any sensible person would): for the most part it's just a case of adding a () anywhere you used an Effect constant.
- If you hardcoded magic numbers: ... well, have fun fixing your code, and I reserve the right to say "I told you so" :)

This achieves multiple goals:
1) creating an EffectInstance for application is much less verbose (see diff for examples, especially the Potion class)
2) plugin devs cannot use magic numbers to apply effects anymore and are forced to use type-safe objects. :)

This is a warning shot for plugin devs who use magic numbers. More changes like this are coming in the not-too-distant future.
2019-02-20 12:05:17 +00:00
Dylan K. Taylor
2c8a065b94 Standardise SNAKE_CASE for surrogate enums 2019-02-20 11:14:07 +00:00
Dylan K. Taylor
dce08b4e88 Introduce Item use results - can be success, fail or none
closes #2693, closes #2705, closes #2734
2019-02-14 19:21:29 +00:00
Dylan K. Taylor
d8a25020f1 Merge branch '3.6' 2019-02-14 16:17:39 +00:00
Dylan K. Taylor
8e73842a93 Player: work around 1.9 command casing crash bug, closes #2761 2019-02-14 16:17:17 +00:00
Dylan K. Taylor
923b1ad9a6 Split up ChunkLoader and ChunkListener 2019-02-04 19:53:03 +00:00
Dylan K. Taylor
2c0f91ce50 Player: clean up chunk selection code 2019-02-04 19:52:36 +00:00
Dylan K. Taylor
ce8d9fa9f4 Player: load chunks when registering as a loader, closes #2726
populateChunk() _sometimes_ does this, but not if the chunk is locked. This means that the empty chunk needed to prevent the shit hitting the fan isn't created when chunks are locked. This change resolves the problem because registerChunkLoader() calls loadChunk() with the create parameter as true when autoload is used. This is a shitty fix but it's the simplest one we have right now, and it works well.
2019-02-04 19:52:03 +00:00
Dylan K. Taylor
ad6ae20d6b Server: fixed getOfflinePlayerData() trying to load terrain (?!?!?!?), closes #2725
getOfflinePlayerData() will now return NULL if there is no stored data for a given player. The responsibility of checking the spawn point is now delegated to the Player, after it registers a chunk loader on its spawn chunk.
2019-02-04 19:51:11 +00:00
Dylan K. Taylor
c5f0665853 Merge branch '3.5' 2019-01-29 14:05:00 +00:00
Dylan K. Taylor
fbe8485696 Player: fixed falling causing starvation, closes #2708 2019-01-29 13:36:24 +00:00
Dylan K. Taylor
a150f39b02 Fixed fall handling when flying, closes #2709 2019-01-29 13:28:43 +00:00
Dylan K. Taylor
ceddf6f5d8 Merge branch '3.5' 2019-01-28 17:52:11 +00:00
Dylan K. Taylor
3a18bdd6a0 Prevent block-picking unknown blocks 2019-01-28 17:45:48 +00:00
Dylan K. Taylor
78dfcc5f2d Move Effect and EffectInstance to entity\effect namespace 2019-01-28 15:41:07 +00:00
Dylan K. Taylor
6f9c4eb8e8 Merge branch '3.5' 2019-01-27 15:08:26 +00:00
Dylan K. Taylor
96857c65b6 Player: Fixed subscribing to broadcast permissions too early
Plugins would indirectly trigger permissible recalculation too early in the login sequence, which then caused their permissions to be recalculated and subscribing them to the broadcast permission far too early.
2019-01-27 15:08:08 +00:00
Dylan K. Taylor
d378371cc8 Transition to spl_object_id() 2019-01-26 15:06:38 +00:00
Dylan K. Taylor
6ee484e401 ChunkLoader: remove getLoaderId() (take 2) 2019-01-25 18:58:01 +00:00
Dylan K. Taylor
469b24b0a5 Remove built-in spawn protection
Users should use the new BasicSpawnProtection plugin instead.
2019-01-24 16:56:15 +00:00
Dylan K. Taylor
842eb0200e Merge branch '3.5' 2019-01-19 19:14:39 +00:00
Dylan K. Taylor
9003b38be3 Fixed a wtf in Player->removeWindow() 2019-01-19 19:14:21 +00:00