Commit Graph

9676 Commits

Author SHA1 Message Date
3ecae0db19 WindowTypes: fill in a couple of blanks 2020-06-26 12:04:11 +01:00
c5bbb2bcbc Move crafting action detection from InventoryTransactionPacket to Player 2020-06-26 11:59:30 +01:00
24a2889758 NetworkInventoryAction does not require an InventoryTransactionPacket 2020-06-26 11:51:06 +01:00
60b26a7ea8 NetworkBinaryStream: unknown byte preceding NBT is a version, not a count 2020-06-26 11:47:08 +01:00
22b52f03d1 Player: fixed formatting error in InteractPacket debug message 2020-06-26 11:44:41 +01:00
df76c02e7a Explicitly release server.lock file when shutdown the server. (#3619)
Previously, this relied on PHP itself to release locks during the resource destructor phase during process exit, but sometimes it doesn't for god knows what reason. This change makes the lock file get explicitly released before the process dies.
2020-06-26 11:41:39 +01:00
d343187e58 phpstan: drop 2 obsolete level 8 error patterns fixed by 763c8ebfe3 2020-06-23 12:57:25 +01:00
c5ad127854 BaseInventory: mark eventProcessor as nullable, fixes a phpstan level 8 error 2020-06-23 12:55:06 +01:00
0f6dc9082a lock phpstan at 0.12.29
0.12.30 starts reporting non-ignorable errors for overriding Thread::start() due to outdated stubs for pthreads that I can't replace
2020-06-22 20:57:12 +01:00
2b6dcbc2e2 BaseLang: fixed passing onlyPrefix to str_replace()'s count reference parameter 2020-06-22 20:34:23 +01:00
763c8ebfe3 Thread/Worker: drop nullability flag from start() (fixed in pthreads 3.2.0, which we require as a minimum) 2020-06-21 19:07:01 +01:00
c572e9bb6a phpstan: regenerate l7 baseline 2020-06-21 18:58:41 +01:00
89521f166d Explosion: account for multi-block structures, fixes #2767 2020-06-21 17:28:38 +01:00
49d3a42120 phpstan: make EntityEvent generic, fix a bunch of 'actual-problems' ignored errors 2020-06-21 00:27:32 +01:00
c523595e85 Rewrite TeleportCommand (sadly I can't make this commit any smaller)
this pile of shit was overdue a rewrite. The new version is much easier to understand.
2020-06-21 00:04:18 +01:00
7c7e4f2093 WhitelistCommand: fixed silence on unknown subcommand 2020-06-20 23:05:39 +01:00
88c1014f03 TimingsCommand: fixed silence when using a nonexisting subcommand 2020-06-20 23:04:08 +01:00
e32180ce93 phpstan: drop an obsolete phpstan-bugs ignoreError 2020-06-19 10:41:41 +01:00
e105578be0 LegacySkinAdapter: an extra check for resourcePatch (fixes 3 phpstan explicitMixed errors) 2020-06-18 20:08:38 +01:00
a9d98bdf73 phpstan: baseline our way into checkExplicitMixed territory 2020-06-18 18:07:21 +01:00
c601352777 Fixed wrong meta value when pick cake block. (#3593) 2020-06-18 11:14:57 +01:00
77c71e22b2 SkinAdapter::fromSkinData() may now throw InvalidSkinException
fixes a rogue TODO in LegacySkinAdapter and invalid skins maybe showing up as Steve instead of getting kicked off the server
2020-06-17 21:44:22 +01:00
1c13ba5656 Avoid parameter ordering bugs during packet decoding
A PhpStorm refactor could have side effects on code that directly reads stuff from the packet input stream in the arguments block, because those calls will get moved into a different order if the constructor gets refactored. This would, obviously, break packet decoding, so that's something we should avoid and really should not encourage.
2020-06-17 21:01:01 +01:00
f970be0e4d SkinImage: 128x64 is not a valid classic skin size
MC itself doesn't accept classic skins of this size.
2020-06-17 20:31:28 +01:00
11a3f9f1b9 VerifyLoginTask: fast-fail by checking header x5u before verifying signature
this is less costly, although it doesn't make any difference except in invalid cases.
2020-06-17 17:52:19 +01:00
09771849ae VerifyLoginTask optimisation: do not copy the entire LoginPacket into the worker thread
this is especially bad considering the fact that the cached buffer is copied. That said, it's only a few kilobytes so it's not a huge problem, but nonetheless...
2020-06-17 17:46:22 +01:00
57a310230a ScoreboardIdentityPacketEntry: added missing field default 2020-06-15 23:59:53 +01:00
130c55d9f1 EntityLink: remove rogue default ctor parameters 2020-06-15 23:58:11 +01:00
2712befa82 SkinData: fixed capeImage type violation (doesn't accept null) 2020-06-15 23:51:48 +01:00
a4e250a3e6 TextFormat: improved exception messages for PCRE failures 2020-06-15 23:43:01 +01:00
23b97d8e2d TextFormat: wrap all preg_replace() usages in a type-safe exception-throwing version
fixes 3 phpstan level 8 errors
2020-06-15 23:31:46 +01:00
1fb5043eb1 build/server-phar: fixed a phpstan level 8 error 2020-06-15 23:16:40 +01:00
b0b1b29de4 Chunk: specify list<int> for heightMap 2020-06-15 23:07:35 +01:00
1c3b641e37 ChunkUtils: be more specific in extension stub too 2020-06-15 23:07:05 +01:00
f3063e797f ChunkUtils: provide a more explicit parameter type 2020-06-15 23:05:52 +01:00
8dcc88712c ChunkUtils: fixed phpstan level 7 type inference error 2020-06-15 23:04:12 +01:00
04191ec44a Rail: specify type for local static variable
fixes a phpstan level 7 error
phpstan doesn't make any assumptions about local static variable types because analysing them would require too much work, apparently.
2020-06-15 22:47:20 +01:00
62ea7c93a9 added a dedicated InvalidSkinException 2020-06-15 21:48:24 +01:00
cf06b5b8cf Player: explicitly check for false return of dataPacket()
fixes a phpstan error on l7
this won't ever actually be a problem, but this isn't obvious from the type system.
2020-06-15 21:24:19 +01:00
a8ec51daac Player: do not assign maybe-false result of json_encode() to ModalFormRequestPacket
fixes a phpstan error on l7
2020-06-15 21:22:33 +01:00
6a7b77fee2 first look at making region writes reuse old space 2020-06-15 18:36:54 +01:00
da42c8d020 Bump phpunit/phpunit from 9.2.2 to 9.2.3 (#3588) 2020-06-15 16:30:50 +00:00
b902f9ded0 RegionLoader: fixed 2 phpstan level 7 errors (eof reading region header) 2020-06-15 15:09:37 +01:00
9bb8a8f761 RegionLoader: added utility function getProportionUnusedSpace() 2020-06-15 13:49:03 +01:00
63b14a083c RegionLoader: added utility function generateSectorMap()
this proved very useful while debugging some internal issues.
2020-06-15 13:48:17 +01:00
627a7c951a RegionLoader: added missing const import 2020-06-15 13:46:03 +01:00
bb2685ca65 RegionLocationTableEntry: cap firstSector at 16777216
this is the biggest sector start that the location table can represent, due to the binary format. Larger values than this will overflow and cause corruption.
This provides an effective limit of 64 GB on region files.
2020-06-15 13:23:08 +01:00
d38709a7ae RegionLoader: remove unused variable 2020-06-15 12:26:20 +01:00
b559a65346 RegionLoader: account for possible corrupted header pointing to itself 2020-06-15 12:13:42 +01:00
b92a2ded8a RegionLoader: check for zero sector count when loading location table
implementations shouldn't be writing location entries that have an offset but zero sectors, but just in case they do, we need to be aware of it.
2020-06-15 12:08:55 +01:00