Commit Graph

13645 Commits

Author SHA1 Message Date
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
d39080c45a TranslationContainer: Add support for named translation parameters
this also fixes use cases like:

[1] = something;
[0] = match(...)

It made no sense whatsoever to discard the keys anyway.

Language::translateString() already supported named parameters since
forever anyway.
2021-08-10 14:26:54 +01:00
de61417bb6 Simplify console subprocess require hack 2021-08-08 18:53:13 +01:00
4c10dcaa53 ConsoleReaderThread: fixed UTF-8 paths getting corrupted on the way to the subprocess in some cases
I was never able to reproduce this, but it appears that Windows breaks the character encoding of command parameters (and also unicode environment variables, even though UNICODE_ENVIRONMENT should be set in php-src) when the file path contains Unicode characters (such as Cyrillic).
We workaround this problem using base64, which is an abysmally shitty hack, but not worse than using a subprocess for ConsoleReader in the first place. PHP fucking sucks, and so does Windows.
closes #4353
2021-08-08 16:19:08 +01:00
91cb374220 LevelDB: fixed isPopulated state getting lost after chunk unload/reload 2021-08-08 16:01:45 +01:00
041d314190 HandlerListManager: apply class-string type for getListFor() parameter 2021-08-05 20:11:58 +01:00
b72d81be5e Cleanup PHPStan baselines 2021-08-04 21:24:13 +01:00
b31dce2119 Player: fixed type of loadQueue field 2021-08-04 21:17:44 +01:00
61b7faae08 Simplify BaseInventoryTest 2021-08-04 21:01:01 +01:00
00984c1b9f BaseInventory: Move contents of InventoryHelpersTrait back inline
I moved these to a trait in anticipation of having multiple full Inventory implementations. That's no longer necessary because of the abstraction of SimpleInventory.
2021-08-04 20:57:20 +01:00
bb79797b68 WhitelistCommand: fixed permission checking
closes #4349
2021-08-04 20:34:54 +01:00
71c6f69fd3 Command: standardise permission checking
if subcommands had different permissions, the permissionMessage would not be used.
2021-08-04 20:29:07 +01:00
efb677d5d5 Merge branch 'stable' 2021-08-03 20:22:17 +01:00
748e9705ba Updated build/php submodule to pmmp/php-build-scripts@49971716b0 2021-08-03 20:20:56 +01:00
50b4ec0d20 Override timeout for the subprocess also 2021-08-03 18:50:36 +01:00
16965fa742 ConsoleReaderThread: override default socket timeout for accept
otherwise, people can break the console reader by setting the default timeout to zero or some other small value.
2021-08-03 18:48:18 +01:00
c567ed4b7a fix build error 2021-08-03 15:32:21 +01:00
565cf84e1b MemoryManager: use typed properties 2021-08-03 15:13:28 +01:00
dcd203370b Player: make use of typed properties
readability significantly benefits from use of typed properties here.
2021-08-03 15:02:32 +01:00
8221475ce2 BlockDataSerializer: fix wrong exception type being thrown 2021-08-02 19:20:19 +01:00
bdac98beaf Block: get rid of getNonPersistentStateBitmask(), add writeStateToItemMeta()
this is more flexible and less confusing.
2021-08-02 19:17:24 +01:00
01b48a21d9 Simplify NetworkSession ticking
we need to tick sessions every tick anyway, because other stuff is happening (e.g. sync attributes/entity metadata, batch buffer flush).
2021-08-02 14:32:00 +01:00
eb23d27004 composer: accept ext-leveldb ^0.3.0 2021-07-31 18:11:34 +01:00
1bbf739385 the function stringToLegacy gives already null useless to put a default null (#4338) 2021-07-31 16:54:31 +01:00
22c3736d63 LightUpdate: micro optimisations opcache isn't smart enough for
this removes 6 unnecessary opcodes from computeSpreadLight() and 3 from computeRemoveLight(). Tested with opcache.opt_debug_level=0x20000.
2021-07-30 23:30:28 +01:00
3319fad863 Fix build error 2021-07-26 20:33:44 +01:00
2b5667a56b Move PHP minimum to 8.0 2021-07-26 20:29:39 +01:00
09eac0e129 Merge remote-tracking branch 'origin/stable' 2021-07-26 20:14:33 +01:00
f9863acadc Restart console reader subprocess if it dies
this can happen for a bunch of different reasons, which are all indistinguishable. This also fixes pmmp/PcntlSignalHandler#3.
2021-07-26 15:38:38 +01:00
c2c9132812 ConsoleReaderThread: say what actually happened when we fail to read commands 2021-07-26 15:17:24 +01:00
c7bb77e24a ConsoleReaderChildProcess: die voluntarily if connection to server process is closed
this happens if the parent process is killed via SIGINT, because its stdin will be closed, interrupting a blocking read. This might also happen if the user pressed CTRL+D, so we don't die unless end of socket stream was also detected.

closes #4335
2021-07-26 15:07:47 +01:00
01fe497c49 phpstan: use PHP 8.0 as primary version
I'm using 8.0 for local development now, so having the phpstan configs targeted at 7.4 by default makes things inconvenient.
2021-07-26 14:34:47 +01:00
1afda04620 PrimedTNT: fixed fuse not getting updated client-side, closes #4333 2021-07-25 12:27:25 +01:00
8f01caf335 Merge branch 'stable' 2021-07-24 22:42:06 +01:00
3bbd088a09 Update build/php submodule to pmmp/php-build-scripts@280dd0524a 2021-07-24 22:40:28 +01:00
1246d1b7ef Use a subprocess for reading lines from STDIN (#4332)
this FINALLY provides us with a way to deal with Windows without needing to forcibly terminate the entire server on shutdown.
2021-07-24 22:10:50 +01:00
772935cd7e Updated biome ID constants 2021-07-23 22:39:54 +01:00
58498c2b0b Merge remote-tracking branch 'origin/stable' 2021-07-23 16:40:19 +01:00
f89e10e684 Silence openssl_free_key() deprecation warnings on 8.0
we don't give a shit and these calls are currently needed for 7.4.
2021-07-23 16:30:22 +01:00
85effa5240 Remove junk from php8 baseline 2021-07-23 15:56:06 +01:00
81c5b83bd9 actions: test on 8.0 2021-07-23 15:55:01 +01:00
ef31a9fc66 Update bug_report.md 2021-07-23 13:32:18 +01:00
dc56a99473 3.22.2 is next 2021-07-23 13:03:27 +01:00
9477034a4a Release 3.22.1 3.22.1 2021-07-23 13:03:27 +01:00
5844b59b12 Fixed incorrect encoding of NpcDialoguePacket
this is in fact an ActorUniqueID, but for some reason written as a uint64 instead of a varint.
2021-07-23 12:53:30 +01:00
0eb4231b51 Use OpenSSL for ECDH during client login, drop mdanter/ecc (#4328)
This brings a significant performance improvement to login sequence handling, reducing CPU cost of `PrepareEncryptionTask` by over 90% and `ProcessLoginTask` by over 60%. It also allows us to shed a dependency.
2021-07-22 23:04:00 +01:00
3af18917f0 Player: remove note about bans from getUniqueId()
while it's true that you might be able to skip the CPU waste from verifying a player's login just to find out that they are banned, this is generally a minority case anyway, so it doesn't make a lot of difference overall. This additional note is essentially a recommendation premature optimisation, which will likely lead to people making security mistakes.
2021-07-22 22:14:14 +01:00
61528393c2 Player: rewrite the confusing documentation of getUniqueId() 2021-07-22 21:14:31 +01:00
59b8453228 Player: added extra debug message for XUID mismatches 2021-07-22 21:04:40 +01:00
83016a97bd Added getMushroomBlockType() / setMushroomBlockType() APIs to Red/BrownMushroomBlock 2021-07-22 19:13:26 +01:00