203 Commits

Author SHA1 Message Date
Dylan K. Taylor
3836a57ba6
Player: add getPlayerInfo(), closes #4450 2021-09-17 22:17:36 +01:00
Dylan K. Taylor
5ddd94b7e8
Remove redundant World->isChunkGenerated() calls
isChunkGenerated() merely checks if the chunk can be loaded from disk, if it's not in the runtime cache already.
This is pointless in all of these cases, because the check is prefaced by an isChunkLoaded() check, which already limits the possibility anyway. If the chunk is not generated, it'll also be considered not loaded.
2021-09-12 15:21:09 +01:00
Dylan T
4111d92b98
Stop hardcoding chunk dimensions everywhere (#4443) 2021-09-10 16:13:25 +01:00
Dylan K. Taylor
cf762d345d
Player: Log debug messages when canInteract() prevents block interaction 2021-09-10 15:58:38 +01:00
Dylan K. Taylor
082f0f2d57
Player: Generate an InventoryTransaction (with event) for crafting grid/cursor evacuation
this fixes the crack in the armour that allows creative players to drop items even when all drops are being cancelled by plugins.

closes #3284
2021-09-09 17:11:59 +01:00
Dylan K. Taylor
34f01a3ce3
World: Track entities separately from chunks
this allows entities to exist outside of generated chunks, with one caveat: they won't be saved in such cases.
Obviously, for player entities, this doesn't matter.

fixes #3947
2021-09-09 01:17:41 +01:00
Dylan K. Taylor
d4d00a9b80
Living: added calculateFallDamage()
to clean up the way that fall damage is handled for flying players; also, onHitGround() isn't only doing fall damage things these days.
2021-09-05 14:36:58 +01:00
Dylan K. Taylor
d329bfb25d
Entity: rename movX/movY/movZ to wantedX/wantedY/wantedZ
this makes the code much easier to understand.
2021-09-05 14:06:53 +01:00
Dylan K. Taylor
8be1f34736
Entity: Rename fall() to onHitGround(), and make it protected
this had no business being exposed to public API in the first place.
2021-09-05 13:36:40 +01:00
Dylan K. Taylor
6ecad153ea
Entity: remove fallDistance parameter from fall() 2021-09-05 13:34:43 +01:00
marshall
6e68e99ec0
Added PlayerEntityInteractEvent (#4374) 2021-08-24 11:56:10 +01:00
SalmonDE
7fd712c1ff
Refactor Block & Tile: getPos() to getPosition() (#4395)
this also changes the name of the class property 'pos' to 'position' as well as Block->getPosOffset() to Block->getPositionOffset()
2021-08-23 14:01:32 +01:00
Dylan K. Taylor
270ee5c085
Simplify registry method generation 2021-08-22 23:02:36 +01:00
alvin0319
34a7405820
Player: fixed player can fly after respawn (#4388) 2021-08-20 22:51:36 +01:00
Dylan K. Taylor
bf8b5905e4
Player: Play ItemBreakSounds when items break due to usage
closes #4381
2021-08-19 15:56:40 +01:00
Dylan K. Taylor
b4b3c21d30
Merge branch 'stable' 2021-08-19 15:39:16 +01:00
Dylan K. Taylor
5da90b9530
Stop auto-translating strings when not asked
fixes #4371
2021-08-15 20:44:27 +01:00
Dylan K. Taylor
a81680c5c6
missed a few more hardcoded translation keys 2021-08-15 20:12:55 +01:00
Dylan K. Taylor
60ac76a3bc
Remove more usages of hardcoded translation keys 2021-08-15 19:22:40 +01:00
Dylan K. Taylor
789a669395
Rename TranslationContainer -> Translatable 2021-08-15 16:17:46 +01:00
Dylan K. Taylor
8b9d7d6390
Support for nested TranslationContainers 2021-08-14 20:57:13 +01:00
Dylan K. Taylor
804d02b086
TranslationContainer: added prefix(), postfix() and format() 2021-08-14 16:08:22 +01:00
Dylan K. Taylor
13d4131d0d
Remove player update warnings
a player ingame is not going to have access to the terminal to update PM, and if they do, they can see the warning on the console themselves anyway.
2021-08-14 13:27:21 +01:00
Dylan K. Taylor
b4c0ddd155
Use native union types for TranslationContainer|string 2021-08-10 15:17:26 +01:00
Dylan K. Taylor
2293bd948d
Added KnownTranslationFactory and use it in as many places as possible
this makes translation usage much more statically analysable.
The only places this isn't used are:
- places that prefix translations with colours (those are still a problem)
- places where server/client translations don't match (e.g. gameMode.changed accepts different parameters in vanilla than in PM)
2021-08-10 14:50:40 +01:00
Dylan K. Taylor
b31dce2119
Player: fixed type of loadQueue field 2021-08-04 21:17:44 +01:00
Dylan K. Taylor
c567ed4b7a
fix build error 2021-08-03 15:32:21 +01:00
Dylan K. Taylor
dcd203370b
Player: make use of typed properties
readability significantly benefits from use of typed properties here.
2021-08-03 15:02:32 +01:00
Dylan K. Taylor
58498c2b0b
Merge remote-tracking branch 'origin/stable' 2021-07-23 16:40:19 +01:00
Dylan K. Taylor
5130a32333
GameMode: removed dead property (leftover from 902ea515f7f83a4785197c0bfe5b813acb684f7d) 2021-07-05 20:00:24 +01:00
Dylan K. Taylor
f3bd48e6cb
Updated some more hardcoded translation key usages missed by 94e16f416de31b79c93bdc2c6cf84b22d25ba63f 2021-06-30 14:02:55 +01:00
Dylan K. Taylor
94e16f416d
Added KnownTranslationKeys (generated) and start using it 2021-06-29 22:46:04 +01:00
Dylan K. Taylor
f02817bcd3
Player: fixed toString() on TranslationContainer exposed by previous commit
this code looks smelly...
2021-06-29 20:14:11 +01:00
Dylan K. Taylor
6fb8ac211e
Make GameMode::fromString() and PluginEnableOrder::fromString() return null, instead of throwing exceptions
since these are always used for handling userdata, it doesn't make sense for them to throw exceptions.
2021-06-27 20:56:51 +01:00
Dylan K. Taylor
3dd33cd35e
Get rid of EnumTrait::fromString()
it's better to just implement this for stuff where there's explicitly designated aliases, otherwise we could end up with unexpected BC breaks (e.g. hardcoding POSTWORLD in plugin.yml would suddenly break if the core enum was changed, even though it remained valid).
2021-06-27 20:52:56 +01:00
Dylan K. Taylor
902ea515f7
Separate ID handling from GameMode
the aliases of 0,1,2,3 remain for user-interface level compatibility.
2021-06-27 20:32:35 +01:00
Dylan K. Taylor
db28358316
Player: Assume that usedChunks was cleared by the previous loop 2021-06-27 17:50:39 +01:00
Dylan K. Taylor
ede4d58394
Automatic permission calculation on PermissibleBase construction
thanks to the PermissibleInternal/PermissibleBase architectural change, there's no longer any concern regarding cyclic refs.
2021-06-26 22:15:22 +01:00
Dylan K. Taylor
bf7d69b69e
Stop hardcoding permission names everywhere
using strings for permission names is nearly as shitty, but this is at least cross-referencable and statically analysable.
2021-06-26 19:14:51 +01:00
Dylan K. Taylor
0910054c41
NetworkSession: Fixed InventoryManager nullability disaster
fixes #4277
fixes #4275
fixes #3139
2021-06-26 17:44:42 +01:00
Dylan K. Taylor
4a5bdefe8b
Player: Explicitly clear permission recalculation callbacks
this is necessary to get rid of the broadcast permission callbacks, which retain references to the Player itself, forming a cycle which would prevent PermissibleBase->__destruct() from cleaning up.
2021-06-26 17:18:17 +01:00
Dylan K. Taylor
85ee628a74
Player: remove sendPosition() from public API
plugins shouldn't be touching this for any reason now.
2021-06-21 20:08:43 +01:00
Dylan K. Taylor
60d80e173b
Fixed player sounds not being broadcasted to the player itself
fixes #4259
fixes #4270
2021-06-21 20:03:32 +01:00
Dylan K. Taylor
981b0285d1
Isolate config casting nastiness in one place
this doesn't solve the underlying problem, but it does reduce the amount of noise made by PHPStan about it, as well as avoiding code litter.
2021-06-19 19:14:02 +01:00
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