1376 Commits

Author SHA1 Message Date
Dylan K. Taylor
3ea8da2dd3 Use EnumTrait->equals() instead of direct comparison
It's not guaranteed that objects provided are the same as those in the enum registry, so they can't be directly compared.

Implementing comparison with === would require some kind of __equals() implementation or an extension to hook into such functionality.
2019-05-24 17:21:44 +01:00
Dylan K. Taylor
9ce1e29a17 Player: fixed bow shooting, closes #2931 2019-05-24 15:58:00 +01:00
Dylan K. Taylor
1c99602a3f Player: give some inventory vars clearer names 2019-05-20 19:38:53 +01:00
Dylan K. Taylor
297ca25123 remove usage of inventory network IDs for marking permanent windows 2019-05-20 16:45:46 +01:00
Dylan K. Taylor
c21a25efb9 move more rollback handling to network handlers, out of Player 2019-05-20 16:13:14 +01:00
Dylan K. Taylor
9e72bc91a2 Separate block break-info to a separate dynamic unit 2019-05-10 16:24:59 +01:00
Dylan K. Taylor
5eb3c52a37 added PunchBlockParticle, encapsulate more network logic 2019-05-09 15:40:58 +01:00
Dylan K. Taylor
51a8c2be9d Player: Move rollback responsibility to network for interact/break block
Custom player implementations might not need rollbacks (f.e. Specter).
2019-05-09 14:54:56 +01:00
Dylan K. Taylor
ca7c23c137 Player: remove dead functions
these functions belong in the network session, and they are currently just proxies for them. In the future we might have players who don't have IPs at all depending on how they connected (for example Specter) so this stuff shouldn't be in here.
2019-05-08 19:47:25 +01:00
Dylan K. Taylor
4634baeb02 Player: don't repeat yourself 2019-05-08 19:38:57 +01:00
Dylan K. Taylor
a51c06116a Merge branch 'stable' 2019-05-08 17:04:37 +01:00
Dylan K. Taylor
f782a478c4 Player: clarify resetTitles() documentation 2019-05-08 17:03:40 +01:00
Dylan K. Taylor
19ac0811f4 Player: remove deprecated title functions 2019-05-08 16:44:18 +01:00
Dylan K. Taylor
a331c5e13f Player: reduce SetTitlePacket creation boilerplate
it's better to encapsulate all this logic in one place so that third party developers can more easily understand this, and also to reduce the amount of crap we have in Player.
2019-05-08 16:43:05 +01:00
Dylan K. Taylor
9fbf41b9a1 Merge branch 'stable' 2019-05-08 15:41:17 +01:00
Dylan K. Taylor
c06b4830d1 Player: don't spawn entities on out-of-sync chunks on join, closes #2911 2019-05-08 15:36:54 +01:00
Dylan K. Taylor
cf0c0e72a9 Assume the player is online when they are, uh, assumed to be online
the checks removed here should never be hit under normal circumstances. If they were hit, they'd just conceal bugs which would cause a crash to happen later anyway.
2019-05-07 19:49:06 +01:00
Dylan K. Taylor
78bb6f4a0c Reduce complexity of chunk sending system 2019-05-07 19:26:01 +01:00
Dylan K. Taylor
c1a483a36d move entity spawning logic back to Player 2019-05-07 18:35:04 +01:00
Dylan K. Taylor
d7a7ab5102 Move Entity despawn logic back to Player
this is not network-session specific, and different implementations will need to do this.
2019-05-07 18:01:23 +01:00
Dylan T
3cd6e12e71
Renaming "Level" -> "World" (#2907)
This has been a pain point for a long time due to the misleading nature of the name "level". It's also confusing when trying to do things like getting the XP level of the player or such, and also does not translate well to other languages.

This transition was already executed on the UI some time ago (language strings) and now it's time for the same change to occur on the API.

This will burn a lot of plugins, but they'll acclimatize. Despite the scary size of this PR, there isn't actually so many changes to make. Most of this came from renaming `Position->getLevel()` to `Position->getWorld()`, or cosmetic changes like changing variable names or doc comments.
2019-05-07 14:47:28 +01:00
Dylan K. Taylor
f6a0f4aa82 Player: fixed immobile interference on PlayerJoinEvent
closes #2894

this should use a cleaner hack that doesn't affect plugins at all, but that's too much work for this one bug fix.
2019-05-02 16:20:28 +01:00
Dylan K. Taylor
de09c8c082 Player: fix crash handling resource pack requests 2019-05-02 16:17:39 +01:00
Dylan K. Taylor
1730415643 Player: remove useless checks from spawnTo(), closes #2897
this was caused by changes on 4.0, but this code is nonetheless useless.
2019-05-01 14:43:11 -04:00
Dylan K. Taylor
293311569d Merge branch 'next-minor' 2019-05-01 18:55:49 +01:00
=?UTF-8?q?Fabian=20Fa=C3=9Fbender?=
932c489de1 Rename addTitle/addSubTitle/addActionBarMessage prefixes to "send", deprecated old variants
closes #2896

these deprecated methods will be removed in 4.0.
2019-05-01 18:54:20 +01:00
Dylan K. Taylor
854a2f5135 Move a giant heap of network garbage out of Entity 2019-04-26 18:52:38 +01:00
Dylan K. Taylor
6aa8276532 Revert "Player: removed useless addActionBarMessage()"
This reverts commit 7d22b2a6d7d372a5020b9a2b44a93cdc821565c8.
2019-04-26 15:41:19 +01:00
Dylan K. Taylor
39360f127a Player: Don't use iusername in cases where it's useless
these calls all do strtolower() anyway, so having iusername here just makes it confusing.
2019-04-26 12:07:47 +01:00
Dylan K. Taylor
25890e76e2 Player: replace redundant usage of Server->broadcast() 2019-04-26 12:04:56 +01:00
Dylan K. Taylor
5913d5038b Cleaned up Entity->close() handling 2019-04-18 17:23:48 +01:00
Dylan K. Taylor
cc01dfe8df Player: protect usedChunks 2019-04-18 16:20:56 +01:00
Dylan K. Taylor
d68501c748 fixed spawn-radius: 0 2019-04-18 16:12:20 +01:00
Dylan K. Taylor
939dfd9269 First look at separating chunk sending from Level 2019-04-17 19:33:37 +01:00
Dylan K. Taylor
0e3e984db9 Player: Disconnects no longer nuke player internals, (mostly) fixes #1239
there are some problems that haven't been accounted for yet, but this fixes all the direct crashes.
2019-04-03 17:44:34 +01:00
Dylan K. Taylor
a0b8d9a64e Merge branch '3.7' 2019-04-03 17:39:45 +01:00
Dylan K. Taylor
2c678dcf0d Player: Fixed memory leak when PlayerLoginEvent is cancelled 2019-04-03 17:37:15 +01:00
Dylan K. Taylor
f901c2a612 Player: move some functions to a more sensible place
let's keep disconnect-related logic grouped together.
2019-04-02 19:57:10 +01:00
Dylan K. Taylor
f332550e52 Player: move toggle* rollback handling to network session
this allows network sessions to react to it how they want, or (in the case of things like Specter) perhaps ignore it.
2019-04-02 19:49:53 +01:00
Dylan K. Taylor
7d22b2a6d7 Player: removed useless addActionBarMessage()
this is exactly the same as sendTip().
2019-04-02 18:43:14 +01:00
Dylan K. Taylor
e5756dbf0b Move a whole bunch of packet crap to NetworkSession 2019-04-02 18:31:16 +01:00
Dylan K. Taylor
6214a9398d Player: remove sendWhisper()
this can be done with a standard translated message, and with more customizability.
2019-03-31 19:25:09 +01:00
Dylan K. Taylor
c59a2d1b93 More hasFiniteResources() usages 2019-03-31 16:51:43 +01:00
Dylan K. Taylor
f8ce7797db Player: add hasFiniteResources() 2019-03-31 16:40:54 +01:00
Dylan K. Taylor
42a263a9df GameMode is now an enum 2019-03-31 16:19:36 +01:00
Dylan K. Taylor
8fcb44de7d Merge branch '3.6' into 3.7 2019-03-29 19:55:36 +00:00
Dylan K. Taylor
f4480c07ee Updated NBT dependency 2019-03-29 19:47:15 +00:00
Dylan K. Taylor
ca22223b62 PlayerDeathEvent: fixed constructor signature, closes #2835
can we ban multi-type parameters already? this is tiresome...
2019-03-25 14:55:25 +00:00
Dylan K. Taylor
2a3e6dcf00 Rename BlockIds -> BlockLegacyIds 2019-03-23 19:46:31 +00:00
Dylan K. Taylor
79ef8e0803 Replace all legacy blockID references with BlockIds:: 2019-03-23 19:44:33 +00:00