6a7b77fee2
first look at making region writes reuse old space
2020-06-15 18:36:54 +01: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
22f25dfbdb
RegionLocationTableEntry: require sector count to be at least 1
2020-06-15 12:05:48 +01:00
6bf840c72e
RegionLoader: use actual null instead of zeroed entry for non-allocated chunks
...
this forces the code to be properly aware of non-allocated chunks, because it'll crash with NPE if it isn't.
2020-06-15 12:02:03 +01:00
745be19a56
RegionLoader: fixed regions ballooning when writing chunks to the end of file
...
we already have a region growth problem due to the lack of garbage collection, but this bug was making it worse. If the region already contained 1024 allocated chunks, 4MB of file space would get wasted before the next chunk would be appended to the file.
2020-06-14 23:40:33 +01:00
e05bee5ffb
RegionLoader: do a full check for chunk overlaps during initial load
2020-06-14 22:39:01 +01:00
7255065106
LevelDB: stop passing false to places where it's not expected
2020-06-10 10:45:54 +01:00
8766d4050c
Merge branch 'stable' into next-minor
2020-05-13 13:18:55 +01:00
2f47597d75
BaseLevelProvider: stop crashing the server on invalid level.dat
...
broken userdata isn't a core bug, so it shouldn't be flooding our crash archives.
2020-05-11 15:34:53 +01:00
619a9892e5
RCON: properly handle potential errors during socket setup
2020-04-16 01:29:28 +01:00
ec949840b2
Do not crash on failure to decompress region chunks
...
this could happen when a chunk was partially overwritten with one of the same sector size.
2020-04-01 21:30:25 +01:00
167492087f
Chunk: specify expected bounds for Y coordinates
2020-03-10 12:33:53 +00:00
2bb497b716
Chunk: flag hasChanged when changing generated/populated/light-populated flags
2020-02-11 08:26:12 +00:00
e1ddf90695
Chunk: remove useless instanceof checks
...
these are always CompoundTags, and if they aren't we have a bug somewhere else.
2020-02-05 20:44:27 +00:00
fa82cb26d8
added native types to closures (phpstan-strict-rules)
2020-02-05 16:35:10 +00:00
99038c752c
Avoid usage of for-loop vars outside of for-loop context
...
these problems were reported by PHPStan strict rules. They aren't actually bugs, but they could become bugs in the future.
2020-02-05 13:16:09 +00:00
3f7e7352fb
added SplFixedArray generics for phpstan 0.12.9
2020-02-05 11:57:37 +00:00
0a566f8218
LevelProvider::generate() accepts class-string<Generator>, not any
...
string
2020-02-01 20:16:05 +00:00
799183e13e
make use of phpstan class-string in some areas
2020-01-30 22:23:11 +00:00
260ac47588
add some phpstan array types
2020-01-30 22:23:11 +00:00
a5764b3ae9
populate missing array value types in level namespace
2020-01-30 21:01:59 +00:00
64b3d02974
Chunk: remove useless condition from populateSkyLight()
...
this was detected by latest bleeding-edge PHPStan.
2020-01-29 16:42:42 +00:00
f624871b3f
strip extra blank lines (php-cs-fixer)
2020-01-22 14:50:29 +00:00
c4793241f5
Mass removal of useless @param/@return PHPDoc annotations, pass 1
2020-01-21 15:10:18 +00:00
5334099fbf
level/format: populate missing return type information
2020-01-19 19:36:34 +00:00
82e9072223
level/format/io: populate missing return type information
2020-01-19 19:35:45 +00:00
17720041a3
phpdoc: populate missing parameter typeinfo
2020-01-11 21:53:24 +00:00
c329ff7d4f
SubChunk: remove nonsensical reference from internal function
2020-01-11 21:49:33 +00:00
8794292788
remove &$var reference notations in phpdoc
...
this isn't required by the spec and PHPStan chokes on it. I was previously having it ignore these errors, but it turns out that PHPStan is not making use of extended typeinfo provided if it can't parse the tag, which is problematic on level 6 and also a problem for array-of-type. Therefore, we are going to have to take the hit.
2020-01-11 21:20:55 +00:00
1eedac87b2
added missing @var property types (reported by phpstan)
2020-01-09 14:13:54 +00:00
e6a58e2690
format/leveldb: fix crash on truncated level.dat file
2020-01-08 09:55:03 +00:00
494660102e
Replace empty() usages with count()
2019-12-18 11:23:24 +00:00
cf73d74bd0
format/anvil: fixed possible type violation on saving chunk
2019-12-12 18:24:21 +00:00
37a8d95464
world IO: fixed crashes when garbage data found in tile/entity NBT data
2019-12-12 18:21:23 +00:00
b8778cb791
LevelProvider: fix doc comment of ::generate()
...
this raised false positives on phpstan level 4
2019-12-12 11:59:12 +00:00
7e98aa1497
leveldb: remove usage of multi-import statement
...
this doesn't conform to the code style.
2019-12-09 20:28:02 +00:00
17037f5e9c
Chunk: clean up nonsensical code in initChunk()
...
I have no idea why the extra check was there, or why the null assignment was used, because it doesn't make any sense.
2019-12-01 21:14:23 +00:00
447477c5fb
RegionLoader: Write location table changes when deleting chunks
2019-10-20 20:54:46 +01:00
abdbb2bf0e
backport 3f6660027
: RegionLoader: Extract location table validation to separate function
2019-10-20 20:53:47 +01:00
783c13926f
backport f2404804d
: RegionLoader: clean up lastSector handling
2019-10-20 20:48:29 +01:00
45329ddf67
backport 07a9c35ee
: RegionLoader: Use objects instead of arrays
2019-10-20 20:42:55 +01:00
20af789963
backport 3e58708130
: Add some missing @throws annotations
2019-10-20 20:23:51 +01:00
93cb9390e0
RegionLoader: backport 62185d476b
2019-10-20 19:59:02 +01:00