3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Updated Upstream (Spigot)

This brings in Spigots Oversized Chunks fix so that servers migrating from
Spigot 1.12 to Paper 1.12 can safely transition the save formats.

Spigot Changes:
79a30d7d Allow Saving Large Chunks
Dieser Commit ist enthalten in:
Aikar 2019-02-23 15:59:20 -05:00
Ursprung 64efe67de3
Commit 5719e128fa
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE
6 geänderte Dateien mit 75 neuen und 57 gelöschten Zeilen

Datei anzeigen

@ -1,4 +1,4 @@
From 6ceadeb266a7fc9a4a41c7819ce49ec3e034b39c Mon Sep 17 00:00:00 2001 From 1f25a64e8de47c04bf521861d9b57662227ac759 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io> From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 03:15:41 -0600 Date: Thu, 3 Mar 2016 03:15:41 -0600
Subject: [PATCH] Add exception reporting event Subject: [PATCH] Add exception reporting event
@ -6,7 +6,7 @@ Subject: [PATCH] Add exception reporting event
diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
new file mode 100644 new file mode 100644
index 000000000..93397188b index 00000000..93397188
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java +++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
@@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
@ -50,7 +50,7 @@ index 000000000..93397188b
+} +}
\ No newline at end of file \ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 08d6ef09a..d5ef4ed0e 100644 index c79d3a93..65952ea9 100644
--- a/src/main/java/net/minecraft/server/Chunk.java --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -89,7 +89,7 @@ index 08d6ef09a..d5ef4ed0e 100644
} }
} }
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 2b320cbd1..4e7e8e5fd 100644 index 2b320cbd..4e7e8e5f 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -12,6 +12,7 @@ import java.util.Iterator; @@ -12,6 +12,7 @@ import java.util.Iterator;
@ -144,7 +144,7 @@ index 2b320cbd1..4e7e8e5fd 100644
} }
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
index 83322b85b..b943a9b20 100644 index 83322b85..b943a9b2 100644
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
@ -172,7 +172,7 @@ index 83322b85b..b943a9b20 100644
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java
index 936d6c640..50056f49a 100644 index 936d6c64..50056f49 100644
--- a/src/main/java/net/minecraft/server/PersistentCollection.java --- a/src/main/java/net/minecraft/server/PersistentCollection.java
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java +++ b/src/main/java/net/minecraft/server/PersistentCollection.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -199,7 +199,7 @@ index 936d6c640..50056f49a 100644
} }
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 1ba26de5c..6a92b5af8 100644 index c13e1eef..d2f08802 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java --- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -209,7 +209,7 @@ index 1ba26de5c..6a92b5af8 100644
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
@@ -82,6 +83,7 @@ public class RegionFile { @@ -103,6 +104,7 @@ public class RegionFile {
} }
} catch (IOException ioexception) { } catch (IOException ioexception) {
ioexception.printStackTrace(); ioexception.printStackTrace();
@ -217,7 +217,7 @@ index 1ba26de5c..6a92b5af8 100644
} }
} }
@@ -209,6 +211,7 @@ public class RegionFile { @@ -247,6 +249,7 @@ public class RegionFile {
this.b(i, j, (int) (MinecraftServer.aw() / 1000L)); this.b(i, j, (int) (MinecraftServer.aw() / 1000L));
} catch (IOException ioexception) { } catch (IOException ioexception) {
ioexception.printStackTrace(); ioexception.printStackTrace();
@ -226,7 +226,7 @@ index 1ba26de5c..6a92b5af8 100644
} }
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index c15a0d1f8..5f9e9ddef 100644 index c15a0d1f..5f9e9dde 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java --- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -245,7 +245,7 @@ index c15a0d1f8..5f9e9ddef 100644
} }
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 1c7c187c7..68a045323 100644 index 1c7c187c..68a04532 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java --- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -7,6 +7,7 @@ import java.util.Random; @@ -7,6 +7,7 @@ import java.util.Random;
@ -273,7 +273,7 @@ index 1c7c187c7..68a045323 100644
} }
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 9ff4f23ab..6fce3015f 100644 index 9ff4f23a..6fce3015 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java --- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java +++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
@ -293,7 +293,7 @@ index 9ff4f23ab..6fce3015f 100644
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 89197281e..6be9c1815 100644 index 89197281..6be9c181 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
@ -329,7 +329,7 @@ index 89197281e..6be9c1815 100644
this.tileEntityListTick.remove(tileTickPosition--); this.tileEntityListTick.remove(tileTickPosition--);
continue; continue;
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 93b9134d6..26753fac5 100644 index 93b9134d..26753fac 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -15,6 +15,9 @@ import java.util.concurrent.atomic.AtomicReference; @@ -15,6 +15,9 @@ import java.util.concurrent.atomic.AtomicReference;
@ -375,5 +375,5 @@ index 93b9134d6..26753fac5 100644
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code) // (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
} }
-- --
2.18.0 2.20.1

Datei anzeigen

@ -1,4 +1,4 @@
From bc3a702f71fbd98ac83d02992c8df88a9207e765 Mon Sep 17 00:00:00 2001 From 98431cfef4644e54f94e1379dce74e6648c497b9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 4 Mar 2013 23:46:10 -0500 Date: Mon, 4 Mar 2013 23:46:10 -0500
Subject: [PATCH] Chunk Save Reattempt Subject: [PATCH] Chunk Save Reattempt
@ -6,7 +6,7 @@ Subject: [PATCH] Chunk Save Reattempt
We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks. We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks.
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 4c3faa201..12bd558a7 100644 index 4c3faa20..12bd558a 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -194,11 +194,16 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { @@ -194,11 +194,16 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@ -28,10 +28,10 @@ index 4c3faa201..12bd558a7 100644
synchronized (lock) { if (this.b.get(chunkcoordintpair) == chunk.compoundSupplier) { this.b.remove(chunkcoordintpair); } }// Paper - This will not equal if a newer version is still pending synchronized (lock) { if (this.b.get(chunkcoordintpair) == chunk.compoundSupplier) { this.b.remove(chunkcoordintpair); } }// Paper - This will not equal if a newer version is still pending
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 6a92b5af8..5bcbd718f 100644 index d2f08802..c3424a35 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java --- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -210,8 +210,7 @@ public class RegionFile { @@ -248,8 +248,7 @@ public class RegionFile {
this.b(i, j, (int) (MinecraftServer.aw() / 1000L)); this.b(i, j, (int) (MinecraftServer.aw() / 1000L));
} catch (IOException ioexception) { } catch (IOException ioexception) {
@ -42,5 +42,5 @@ index 6a92b5af8..5bcbd718f 100644
} }
-- --
2.18.0 2.20.1

Datei anzeigen

@ -1,11 +1,11 @@
From b4237ef0e075d98a14b87bfd673d34b96cb1d966 Mon Sep 17 00:00:00 2001 From 65277bb5c79ac221f24ca1bded6e71b69f559815 Mon Sep 17 00:00:00 2001
From: Antony Riley <antony@cyberiantiger.org> From: Antony Riley <antony@cyberiantiger.org>
Date: Tue, 29 Mar 2016 06:56:23 +0300 Date: Tue, 29 Mar 2016 06:56:23 +0300
Subject: [PATCH] Reduce IO ops opening a new region file. Subject: [PATCH] Reduce IO ops opening a new region file.
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 5bcbd718f..2bd85e2d1 100644 index c3424a35..eac8b22b 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java --- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -8,9 +8,12 @@ import java.io.ByteArrayInputStream; @@ -8,9 +8,12 @@ import java.io.ByteArrayInputStream;
@ -21,7 +21,7 @@ index 5bcbd718f..2bd85e2d1 100644
import java.util.List; import java.util.List;
import java.util.zip.DeflaterOutputStream; import java.util.zip.DeflaterOutputStream;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
@@ -67,8 +70,16 @@ public class RegionFile { @@ -72,8 +75,16 @@ public class RegionFile {
int k; int k;
@ -37,9 +37,9 @@ index 5bcbd718f..2bd85e2d1 100644
- k = this.c.readInt(); - k = this.c.readInt();
+ k = headerAsInts.get(); // Paper + k = headerAsInts.get(); // Paper
this.d[j] = k; this.d[j] = k;
if (k != 0 && (k >> 8) + (k & 255) <= this.f.size()) { // Spigot start
for (int l = 0; l < (k & 255); ++l) { int length = k & 255;
@@ -78,7 +89,7 @@ public class RegionFile { @@ -99,7 +110,7 @@ public class RegionFile {
} }
for (j = 0; j < 1024; ++j) { for (j = 0; j < 1024; ++j) {
@ -49,5 +49,5 @@ index 5bcbd718f..2bd85e2d1 100644
} }
} catch (IOException ioexception) { } catch (IOException ioexception) {
-- --
2.18.0 2.20.1

Datei anzeigen

@ -1,4 +1,4 @@
From ec510b0b41b7924da4737613c9c10441498eb46f Mon Sep 17 00:00:00 2001 From 25f06715b685a629d93544f7a05d99c243b6d56e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 11 Aug 2018 00:49:20 -0400 Date: Sat, 11 Aug 2018 00:49:20 -0400
Subject: [PATCH] Detect and repair corrupt Region Files Subject: [PATCH] Detect and repair corrupt Region Files
@ -11,12 +11,12 @@ I don't know why mojang only checks for 4096, when anything less than 8192 is a
But to be safe, it will attempt to back up the file. But to be safe, it will attempt to back up the file.
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 2bd85e2d..d334d634 100644 index eac8b22b..d58cda9a 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java --- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -23,10 +23,10 @@ import javax.annotation.Nullable; @@ -28,10 +28,10 @@ public class RegionFile {
public class RegionFile { private static final boolean ENABLE_EXTENDED_SAVE = Boolean.parseBoolean(System.getProperty("net.minecraft.server.RegionFile.enableExtendedSave", "true"));
// Spigot end
private static final byte[] a = new byte[4096]; private static final byte[] a = new byte[4096];
- private final File b; - private final File b;
- private RandomAccessFile c; - private RandomAccessFile c;
@ -29,7 +29,7 @@ index 2bd85e2d..d334d634 100644
private List<Boolean> f; private List<Boolean> f;
private int g; private int g;
private long h; private long h;
@@ -40,10 +40,11 @@ public class RegionFile { @@ -45,10 +45,11 @@ public class RegionFile {
this.h = file.lastModified(); this.h = file.lastModified();
} }
@ -44,17 +44,24 @@ index 2bd85e2d..d334d634 100644
this.g += 8192; this.g += 8192;
} }
@@ -81,16 +82,16 @@ public class RegionFile { @@ -96,22 +97,23 @@ public class RegionFile {
for (j = 0; j < 1024; ++j) { this.c.seek(j * 4 + 4); // Go back to where we were
k = headerAsInts.get(); // Paper }
this.d[j] = k; }
- if (k != 0 && (k >> 8) + (k & 255) <= this.f.size()) { - if (k != 0 && (k >> 8) + (length) <= this.f.size()) {
+ if (k > 0 && (k >> 8) > 1 && (k >> 8) + (k & 255) <= this.f.size()) { // Paper >= 1 as 0/1 are the headers, and negative isnt valid + if (k > 0 && (k >> 8) > 1 && (k >> 8) + (length) <= this.f.size()) { // Paper >= 1 as 0/1 are the headers, and negative isnt valid
for (int l = 0; l < (k & 255); ++l) { for (int l = 0; l < (length); ++l) {
// Spigot end
this.f.set((k >> 8) + l, Boolean.valueOf(false)); this.f.set((k >> 8) + l, Boolean.valueOf(false));
} }
- } }
+ } else if (k != 0) deleteChunk(j); // Paper // Spigot start
- else if (length > 0) {
+ else if (k != 0) { // Paper
org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Invalid chunk: ({0}, {1}) Offset: {2} Length: {3} runs off end file. {4}", new Object[]{j % 32, (int) (j / 32), k >> 8, length, file});
+ deleteChunk(j); // Paper
}
// Spigot end
} }
for (j = 0; j < 1024; ++j) { for (j = 0; j < 1024; ++j) {
@ -64,7 +71,7 @@ index 2bd85e2d..d334d634 100644
} }
} catch (IOException ioexception) { } catch (IOException ioexception) {
ioexception.printStackTrace(); ioexception.printStackTrace();
@@ -264,6 +265,55 @@ public class RegionFile { @@ -302,6 +304,55 @@ public class RegionFile {
} }
@ -121,5 +128,5 @@ index 2bd85e2d..d334d634 100644
private final int b; private final int b;
-- --
2.19.1 2.20.1

Datei anzeigen

@ -1,4 +1,4 @@
From 026320c912a5ce008130be4a5089eceea3a24da2 Mon Sep 17 00:00:00 2001 From 0c66385b2ab612b92641c37518e15ba12530b3ff Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 15 Feb 2019 01:08:19 -0500 Date: Fri, 15 Feb 2019 01:08:19 -0500
Subject: [PATCH] Allow Saving of Oversized Chunks Subject: [PATCH] Allow Saving of Oversized Chunks
@ -51,10 +51,10 @@ index 2162d3ad..8b5aeb1b 100644
a((NBTBase) nbttagcompound, dataoutput); a((NBTBase) nbttagcompound, dataoutput);
} }
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index d334d634..34f72c3d 100644 index d58cda9a..56783ab5 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java --- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -78,6 +78,7 @@ public class RegionFile { @@ -83,6 +83,7 @@ public class RegionFile {
} }
header.clear(); header.clear();
IntBuffer headerAsInts = header.asIntBuffer(); IntBuffer headerAsInts = header.asIntBuffer();
@ -62,7 +62,7 @@ index d334d634..34f72c3d 100644
// Paper End // Paper End
for (j = 0; j < 1024; ++j) { for (j = 0; j < 1024; ++j) {
k = headerAsInts.get(); // Paper k = headerAsInts.get(); // Paper
@@ -101,7 +102,7 @@ public class RegionFile { @@ -123,7 +124,7 @@ public class RegionFile {
} }
@Nullable @Nullable
@ -71,7 +71,7 @@ index d334d634..34f72c3d 100644
if (this.d(i, j)) { if (this.d(i, j)) {
return null; return null;
} else { } else {
@@ -149,8 +150,8 @@ public class RegionFile { @@ -179,8 +180,8 @@ public class RegionFile {
} }
@Nullable @Nullable
@ -82,16 +82,18 @@ index d334d634..34f72c3d 100644
} }
protected synchronized void a(int i, int j, byte[] abyte, int k) { protected synchronized void a(int i, int j, byte[] abyte, int k) {
@@ -161,7 +162,7 @@ public class RegionFile { @@ -198,8 +199,9 @@ public class RegionFile {
int k1 = (k + 5) / 4096 + 1;
if (k1 >= 256) { if (k1 >= 256) {
- return; // Spigot start
+ throw new ChunkTooLargeException(i, j, k1); // Paper - throw error instead - if (!ENABLE_EXTENDED_SAVE) return;
+ if (!USE_SPIGOT_OVERSIZED_METHOD) throw new ChunkTooLargeException(i, j, k1); // Paper - throw error instead
org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING,"Large Chunk Detected: ({0}, {1}) Size: {2} {3}", new Object[]{i, j, k1, this.b});
+ if (!ENABLE_EXTENDED_SAVE) return;
// Spigot end
} }
if (i1 != 0 && j1 == k1) { @@ -351,6 +353,110 @@ public class RegionFile {
@@ -312,6 +313,101 @@ public class RegionFile {
logger.error("Error backing up corrupt file" + file.getAbsolutePath(), e); logger.error("Error backing up corrupt file" + file.getAbsolutePath(), e);
} }
} }
@ -172,6 +174,15 @@ index d334d634..34f72c3d 100644
+ +
+ } + }
+ +
+ private static final boolean USE_SPIGOT_OVERSIZED_METHOD = Boolean.getBoolean("Paper.useSpigotExtendedSaveMethod"); // Paper
+ static {
+ if (USE_SPIGOT_OVERSIZED_METHOD) {
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "====================================");
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "Using Spigot Oversized Chunk save method. Warning this will result in extremely fragmented chunks, as well as making the entire region file unable to be to used in any other software but Forge or Spigot (not usable in Vanilla or CraftBukkit). Paper's method is highly recommended.");
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "====================================");
+ }
+ }
+
+ public class ChunkTooLargeException extends RuntimeException { + public class ChunkTooLargeException extends RuntimeException {
+ public ChunkTooLargeException(int x, int z, int sectors) { + public ChunkTooLargeException(int x, int z, int sectors) {
+ super("Chunk " + x + "," + z + " of " + getFile().toString() + " is too large (" + sectors + "/256)"); + super("Chunk " + x + "," + z + " of " + getFile().toString() + " is too large (" + sectors + "/256)");
@ -193,7 +204,7 @@ index d334d634..34f72c3d 100644
// Paper end // Paper end
class ChunkBuffer extends ByteArrayOutputStream { class ChunkBuffer extends ByteArrayOutputStream {
@@ -325,8 +421,40 @@ public class RegionFile { @@ -364,8 +470,40 @@ public class RegionFile {
this.c = j; this.c = j;
} }

@ -1 +1 @@
Subproject commit e8ded36bc9c1661fc04f83762e3e0e94a273787b Subproject commit 79a30d7d26b9078dbf6071cbbfa060673bf117b2