Skip to content

Commit be87515

Browse files
committed
Fix chunk corruption
Thx @Samsuik!
1 parent a6dd126 commit be87515

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ It is available for Bukkit, Forge, Sponge and Nukkit.
1313
## Additions
1414
* [Java 17 compatibility](https://github.com/DawningW/FastAsyncWorldedit-Legacy/commit/41c4ef8c245b4a8cf212606a00e6d093a47a9b6d)
1515
* [Ytnoos security patch](https://github.com/ytnoos/FastAsyncWorldedit-Legacy/commit/12a01983c9650e4b1a4dbd067344d88cd89be1b1)
16+
* [Samsuik chunk corruption fix](https://github.com/Samsuik/FastAsyncWorldedit-Legacy/commit/68539824759d51ef5896f0168363bf47a0768d6b)
1617

1718
## Installation
1819
Drop the FAWE jar in your `/plugins` folder and install [WorldEdit 6.1.7.2](https://dev.bukkit.org/projects/worldedit/files/2431372). \
@@ -38,9 +39,9 @@ These builds **can now be found** at `/bukkit/build/libs/` as Gradle standard.
3839
## TODO
3940
Not likely to be added anytime soon:
4041
1. ~~Either bundle `WorldEdit` or just change the download link.~~
41-
2. Use a slightly more updated `WorldEdit` version like 6.1.9 🕒
42-
3. Fix [chunk duplication](https://www.youtube.com/watch?v=hdEVYZ8DWEs) error 🕒
43-
4. Drop ProtocolLib in favor of packetevents
42+
2. Use a slightly more updated `WorldEdit` version like 6.1.9 🕒 (Probably not going to do this)
43+
3. ~~Fix [chunk duplication](https://www.youtube.com/watch?v=hdEVYZ8DWEs) error 🕒~~ (This can be fixed natively in 1.8 forks in ChunkSection, which doesn't make a copy of the array before using)
44+
4. ~~Drop ProtocolLib in favor of packetevents~~
4445

4546
## Links
4647

bukkit/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitChunk_1_8.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,11 @@ public FaweChunk call() {
185185
if (count == 0) {
186186
continue;
187187
}
188-
char[] newArray = this.getIdArray(j);
189-
if (newArray == null) {
188+
char[] internalIdArray = this.getIdArray(j);
189+
if (internalIdArray == null) {
190190
continue;
191191
}
192+
char[] newArray = Arrays.copyOf(internalIdArray, internalIdArray.length);
192193
int countAir = this.getAir(j);
193194
ChunkSection section = sections[j];
194195
if (section != null && BukkitQueue18R3.isDirty != null) {
@@ -200,9 +201,8 @@ public FaweChunk call() {
200201
}
201202
sections[j] = section = new ChunkSection(j << 4, flag, newArray);
202203
continue;
203-
}
204-
if (count >= 4096) {
205-
if (count == countAir) {
204+
} else if (count >= 4096) {
205+
if (countAir >= 4096) {
206206
sections[j] = null;
207207
continue;
208208
}

0 commit comments

Comments
 (0)