Dylan K. Taylor
a59ac522ee
Terminal: do not assume that an array given to toANSI() is actually a tokenized string
...
this is a far stretch, since the documentation doesn't mention that the string needs to be tokenized. Anyone passing an array in here is most likely doing so by mistake.
2021-08-12 23:35:45 +01:00
Dylan K. Taylor
ab232ee759
Merge branch 'master' of github.com:pmmp/PocketMine-MP
2021-08-12 23:32:05 +01:00
Dylan K. Taylor
d30371be11
Command: Assume that TranslationContainer->getText() returns a valid translation key
...
there's no reason for it not to be.
2021-08-12 23:31:37 +01:00
Rush2929
58bc9332cd
Workaround for offhand sync ( #4359 )
...
fixes #4231
2021-08-12 23:27:53 +01:00
Dylan T
27e0ecf7ee
Implemented Blast Furnace and Smoker ( #4362 )
2021-08-12 23:27:05 +01:00
Dylan K. Taylor
fd41a0f510
Remove colors from VersionCommand
...
these will have to stay gone for now, until we have some way to terminate formatting codes without breaking logger output. (we need &p!! #4364 )
2021-08-12 20:35:34 +01:00
Dylan K. Taylor
6a2a4cca4d
Terminal: use match instead of switch in toANSI()
...
phpstan seems to have some trouble with large match statements (phpstan/phpstan#5454 )
2021-08-12 20:13:44 +01:00
Dylan K. Taylor
2782af7e22
Terminal: use typed properties
2021-08-12 19:41:16 +01:00
Dylan K. Taylor
4d683c63d8
TextFormat: remove toJSON()
...
this is not used in the PM core, and is only used by 1 plugin in the whole public ecosystem: BigBrother. It makes more sense to make BigBrother maintainers shoulder the responsibility of maintaining this code, since they are the only ones that need it - besides, if this changed in any MCJE update in the last 5y, nobody has updated it, and nobody has maintained it either due to not having a fucking clue what the thing is for (the documentation is basically nonexistent).
2021-08-12 13:43:58 +01:00
Dylan K. Taylor
eb24e040f3
TextFormat: add COLORS and FORMATS constants
2021-08-12 13:13:33 +01:00
Dylan K. Taylor
28bfe9fbb4
emit_performance_warnings(): Log a warning when using a PHP debug build
2021-08-11 20:14:03 +01:00
Dylan K. Taylor
99e68fb5d3
Merge branch 'master' of github.com:pmmp/PocketMine-MP
2021-08-10 19:48:39 +01:00
Dylan K. Taylor
f42c9bb6d6
Removed unused translation
2021-08-10 19:48:30 +01:00
Rush2929
cf77b33c3b
Bows can now use offhand arrows ( #4356 )
2021-08-10 19:36:57 +01:00
Dylan K. Taylor
2cdd6e634f
New /version format
2021-08-10 19:32:28 +01:00
Dylan K. Taylor
2ad5de379f
HandlerListManager::unregisterAll() accepts RegisteredListener
...
since all this function is doing is passing the object on to the HandlerList, it should accept RegisteredListener, like HandlerList::unregister().
2021-08-10 15:28:11 +01:00
Dylan K. Taylor
b4c0ddd155
Use native union types for TranslationContainer|string
2021-08-10 15:17:26 +01:00
Dylan K. Taylor
27a2d06083
Fix CS
2021-08-10 14:53:03 +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
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
Dylan K. Taylor
de61417bb6
Simplify console subprocess require hack
2021-08-08 18:53:13 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
91cb374220
LevelDB: fixed isPopulated state getting lost after chunk unload/reload
2021-08-08 16:01:45 +01:00
Dylan K. Taylor
041d314190
HandlerListManager: apply class-string type for getListFor() parameter
2021-08-05 20:11:58 +01:00
Dylan K. Taylor
b31dce2119
Player: fixed type of loadQueue field
2021-08-04 21:17:44 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
bb79797b68
WhitelistCommand: fixed permission checking
...
closes #4349
2021-08-04 20:34:54 +01:00
Dylan K. Taylor
71c6f69fd3
Command: standardise permission checking
...
if subcommands had different permissions, the permissionMessage would not be used.
2021-08-04 20:29:07 +01:00
Dylan K. Taylor
50b4ec0d20
Override timeout for the subprocess also
2021-08-03 18:50:36 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
c567ed4b7a
fix build error
2021-08-03 15:32:21 +01:00
Dylan K. Taylor
565cf84e1b
MemoryManager: use typed properties
2021-08-03 15:13:28 +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
Leo Lee
219ed81389
Player: Fixed items on the crafting grid disappearing when the player disconnects ( #4344 )
2021-08-02 19:48:36 +01:00
Dylan K. Taylor
8221475ce2
BlockDataSerializer: fix wrong exception type being thrown
2021-08-02 19:20:19 +01:00
Dylan K. Taylor
bdac98beaf
Block: get rid of getNonPersistentStateBitmask(), add writeStateToItemMeta()
...
this is more flexible and less confusing.
2021-08-02 19:17:24 +01:00
Dylan K. Taylor
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
Sensei Tarzan
1bbf739385
the function stringToLegacy gives already null useless to put a default null ( #4338 )
2021-07-31 16:54:31 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
2b5667a56b
Move PHP minimum to 8.0
2021-07-26 20:29:39 +01:00
Dylan K. Taylor
09eac0e129
Merge remote-tracking branch 'origin/stable'
2021-07-26 20:14:33 +01:00
Dylan K. Taylor
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
Dylan T
c2c9132812
ConsoleReaderThread: say what actually happened when we fail to read commands
2021-07-26 15:17:24 +01:00
Dylan T
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
Dylan K. Taylor
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
Dylan T
1afda04620
PrimedTNT: fixed fuse not getting updated client-side, closes #4333
2021-07-25 12:27:25 +01:00
Dylan T
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
Dylan K. Taylor
772935cd7e
Updated biome ID constants
2021-07-23 22:39:54 +01:00
Dylan K. Taylor
58498c2b0b
Merge remote-tracking branch 'origin/stable'
2021-07-23 16:40:19 +01:00
Dylan K. Taylor
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