diff --git a/README.md b/README.md index 87d51ec..28590e7 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Plugin developers need to manually update their plugins to support Linear. ## Compiling 1. #### Clone LinearPaper ```sh -git clone https://github.com/StupidCraft/LinearPaper.git +git clone https://github.com/RealTriassic/LinearPaper.git ``` 2. #### Change directory to LinearPaper ```sh diff --git a/build.gradle.kts b/build.gradle.kts index b0d8a41..9191b06 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { java `maven-publish` - id("io.papermc.paperweight.patcher") version "1.7.2" + id("io.papermc.paperweight.patcher") version "1.7.3" } allprojects { @@ -86,7 +86,7 @@ paperweight { } tasks.generateDevelopmentBundle { - apiCoordinates = "org.stupidcraft.linearpaper:linearpaper-api" + apiCoordinates = "com.triassic.linearpaper:linearpaper-api" libraryRepositories = listOf( "https://repo.maven.apache.org/maven2/", paperMavenPublicUrl, diff --git a/gradle.properties b/gradle.properties index 9bc6cb8..c2e6fef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -group = org.stupidcraft.linearpaper +group = com.triassic.linearpaper version = 1.21.1-R0.1-SNAPSHOT mcVersion = 1.21.1 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e644113..2c35211 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 09523c0..df97d72 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index b740cf1..f5feea6 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 25da30d..9d21a21 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## diff --git a/patches/server/0001-Rebrand.patch b/patches/server/0001-Rebrand.patch index 56a4f93..9c177e1 100644 --- a/patches/server/0001-Rebrand.patch +++ b/patches/server/0001-Rebrand.patch @@ -31,8 +31,8 @@ index 421f6b3dc8890d63d2e7aa774d0bf8f7e15890ab..da156e89cc7f325d267ad5b47c77e065 - "Specification-Vendor" to "Paper Team", - "Brand-Id" to "papermc:paper", - "Brand-Name" to "Paper", -+ "Specification-Vendor" to "StupidCraft Team", // LinearPaper -+ "Brand-Id" to "stupidcraft:linearpaper", // LinearPaper ++ "Specification-Vendor" to "Triassic", // LinearPaper ++ "Brand-Id" to "triassic:linearpaper", // LinearPaper + "Brand-Name" to "LinearPaper", // LinearPaper "Build-Number" to (build ?: ""), "Build-Time" to Instant.now().toString(), @@ -46,7 +46,7 @@ index 532306cacd52579cdf37e4aca25887b1ed3ba6a1..c6514ebc545a051e7090e600ab62dbed private static final int DISTANCE_ERROR = -1; private static final int DISTANCE_UNKNOWN = -2; - private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads/paper"; -+ private static final String DOWNLOAD_PAGE = "https://github.com/StupidCraft/LinearPaper"; // LinearPaper ++ private static final String DOWNLOAD_PAGE = "https://github.com/RealTriassic/LinearPaper"; // LinearPaper @Override public long getCacheTime() { @@ -55,7 +55,7 @@ index 532306cacd52579cdf37e4aca25887b1ed3ba6a1..c6514ebc545a051e7090e600ab62dbed updateMessage = text("You are running a development version without access to version information", color(0xFF5300)); } else { - updateMessage = getUpdateStatusMessage("PaperMC/Paper", build); -+ updateMessage = getUpdateStatusMessage("StupidCraft/LinearPaper", build); // LinearPaper ++ updateMessage = getUpdateStatusMessage("RealTriassic/LinearPaper", build); // LinearPaper } final @Nullable Component history = this.getHistory(); @@ -68,7 +68,7 @@ index 774556a62eb240da42e84db4502e2ed43495be17..de4febc4bc24230f5bd051293030eb41 String result = "Unknown-Version"; - InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties"); -+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.stupidcraft.linearpaper/linearpaper-api/pom.properties"); // LinearPaper ++ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.triassic.linearpaper/linearpaper-api/pom.properties"); // LinearPaper Properties properties = new Properties(); if (stream != null) { diff --git a/patches/server/0002-Empty-configuration.patch b/patches/server/0002-Empty-configuration.patch index 2194896..5911196 100644 --- a/patches/server/0002-Empty-configuration.patch +++ b/patches/server/0002-Empty-configuration.patch @@ -12,7 +12,7 @@ index dd56c8e041116ef3602a9f89c998c8208ab89b51..d0dbad852d4ea26a023ae6b94d41f61c this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Paper end - initialize global and world-defaults configuration this.server.spark.enableEarlyIfRequested(); // Paper - spark -+ org.stupidcraft.linearpaper.LinearConfig.init((java.io.File) this.options.valueOf("linear-settings")); // LinearPaper ++ com.triassic.linearpaper.LinearConfig.init((java.io.File) this.options.valueOf("linear-settings")); // LinearPaper // Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save if (this.convertOldUsers()) { this.getProfileCache().save(false); // Paper @@ -24,7 +24,7 @@ index e2a0487089eb5a7bdc1433e4c75f69d8e9f9d5f9..5661d122a105223e2e40a89f04eb26be return this.paperConfig; } // Paper end - add paper world config -+ public final org.stupidcraft.linearpaper.LinearWorldConfig linearConfig; // LinearPaper ++ public final com.triassic.linearpaper.LinearWorldConfig linearConfig; // LinearPaper public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray public final co.aikar.timings.WorldTimingsHandler timings; // Paper @@ -32,7 +32,7 @@ index e2a0487089eb5a7bdc1433e4c75f69d8e9f9d5f9..5661d122a105223e2e40a89f04eb26be protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, RegistryAccess iregistrycustom, Holder holder, Supplier supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config & Anti-Xray this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config -+ this.linearConfig = new org.stupidcraft.linearpaper.LinearWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // LinearPaper ++ this.linearConfig = new com.triassic.linearpaper.LinearWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // LinearPaper this.generator = gen; this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); @@ -44,7 +44,7 @@ index b7af2d4300facf41a025c8ca322bf6541949b3ab..aa6e819cdb7bfb219764def341dc14d1 org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot this.console.paperConfigurations.reloadConfigs(this.console); -+ org.stupidcraft.linearpaper.LinearConfig.init((File) console.options.valueOf("linear-settings")); // LinearPaper ++ com.triassic.linearpaper.LinearConfig.init((File) console.options.valueOf("linear-settings")); // LinearPaper for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) @@ -63,7 +63,7 @@ index b7af2d4300facf41a025c8ca322bf6541949b3ab..aa6e819cdb7bfb219764def341dc14d1 + @Override + public YamlConfiguration getLinearConfig() + { -+ return org.stupidcraft.linearpaper.LinearConfig.config; ++ return com.triassic.linearpaper.LinearConfig.config; + } + @Override @@ -88,13 +88,13 @@ index c1e88c31910e96ef07cece05046c0b55e708b52d..c2cd67260a0c954fe59e3c330e6efce3 } }; -diff --git a/src/main/java/org/stupidcraft/linearpaper/LinearConfig.java b/src/main/java/org/stupidcraft/linearpaper/LinearConfig.java +diff --git a/src/main/java/com/triassic/linearpaper/LinearConfig.java b/src/main/java/com/triassic/linearpaper/LinearConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..0c58b470a16f0705c17d1fb7d8108e2f73e5f9bd --- /dev/null -+++ b/src/main/java/org/stupidcraft/linearpaper/LinearConfig.java ++++ b/src/main/java/com/triassic/linearpaper/LinearConfig.java @@ -0,0 +1,173 @@ -+package org.stupidcraft.linearpaper; ++package com.triassic.linearpaper; + +import com.google.common.collect.ImmutableMap; +import java.io.File; @@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..0c58b470a16f0705c17d1fb7d8108e2f + "to always keep and create backups, even if not using Linear.", + "", + "Report any issues on our GitHub repository:", -+ "https://github.com/StupidCraft/LinearPaper" ++ "https://github.com/RealTriassic/LinearPaper" + ); + + public static YamlConfiguration config; @@ -267,13 +267,13 @@ index 0000000000000000000000000000000000000000..0c58b470a16f0705c17d1fb7d8108e2f + return builder.build(); + } +} -diff --git a/src/main/java/org/stupidcraft/linearpaper/LinearWorldConfig.java b/src/main/java/org/stupidcraft/linearpaper/LinearWorldConfig.java +diff --git a/src/main/java/com/triassic/linearpaper/LinearWorldConfig.java b/src/main/java/com/triassic/linearpaper/LinearWorldConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..4e4bafaec9b8d40ba9252d53167e34e8f684c5b8 --- /dev/null -+++ b/src/main/java/org/stupidcraft/linearpaper/LinearWorldConfig.java ++++ b/src/main/java/com/triassic/linearpaper/LinearWorldConfig.java @@ -0,0 +1,113 @@ -+package org.stupidcraft.linearpaper; ++package com.triassic.linearpaper; + +import java.util.List; +import java.util.Map; @@ -281,7 +281,7 @@ index 0000000000000000000000000000000000000000..4e4bafaec9b8d40ba9252d53167e34e8 +import org.apache.commons.lang.BooleanUtils; +import org.bukkit.configuration.ConfigurationSection; + -+import static org.stupidcraft.linearpaper.LinearConfig.log; ++import static com.triassic.linearpaper.LinearConfig.log; + +@SuppressWarnings("unused") +public class LinearWorldConfig { diff --git a/patches/server/0003-Region-format-configuration.patch b/patches/server/0003-Region-format-configuration.patch index d2df604..c2658f0 100644 --- a/patches/server/0003-Region-format-configuration.patch +++ b/patches/server/0003-Region-format-configuration.patch @@ -21,10 +21,10 @@ index 696d075ca2883f3c37e35f983c4d020e5db89d16..f75e1e6e3d68e4156fd9723aa96dba4e } return flag3; -diff --git a/src/main/java/org/stupidcraft/linearpaper/LinearConfig.java b/src/main/java/org/stupidcraft/linearpaper/LinearConfig.java +diff --git a/src/main/java/com/triassic/linearpaper/LinearConfig.java b/src/main/java/com/triassic/linearpaper/LinearConfig.java index 0c58b470a16f0705c17d1fb7d8108e2f73e5f9bd..65b823390d0a8ee79c2b8e576c670b195a70827e 100644 ---- a/src/main/java/org/stupidcraft/linearpaper/LinearConfig.java -+++ b/src/main/java/org/stupidcraft/linearpaper/LinearConfig.java +--- a/src/main/java/com/triassic/linearpaper/LinearConfig.java ++++ b/src/main/java/com/triassic/linearpaper/LinearConfig.java @@ -170,4 +170,17 @@ public class LinearConfig { } return builder.build(); @@ -43,20 +43,20 @@ index 0c58b470a16f0705c17d1fb7d8108e2f73e5f9bd..65b823390d0a8ee79c2b8e576c670b19 + linearFlushThreads = Math.max(linearFlushThreads, 1); + } } -diff --git a/src/main/java/org/stupidcraft/linearpaper/LinearWorldConfig.java b/src/main/java/org/stupidcraft/linearpaper/LinearWorldConfig.java +diff --git a/src/main/java/com/triassic/linearpaper/LinearWorldConfig.java b/src/main/java/com/triassic/linearpaper/LinearWorldConfig.java index 4e4bafaec9b8d40ba9252d53167e34e8f684c5b8..267474bdf5969b8028a3b4573828ebd47e60d378 100644 ---- a/src/main/java/org/stupidcraft/linearpaper/LinearWorldConfig.java -+++ b/src/main/java/org/stupidcraft/linearpaper/LinearWorldConfig.java -@@ -3,8 +3,10 @@ package org.stupidcraft.linearpaper; +--- a/src/main/java/com/triassic/linearpaper/LinearWorldConfig.java ++++ b/src/main/java/com/triassic/linearpaper/LinearWorldConfig.java +@@ -3,8 +3,10 @@ package com.triassic.linearpaper; import java.util.List; import java.util.Map; import java.util.function.Predicate; +import java.util.logging.Level; import org.apache.commons.lang.BooleanUtils; import org.bukkit.configuration.ConfigurationSection; -+import org.stupidcraft.linearpaper.region.RegionFileFormat; ++import com.triassic.linearpaper.region.RegionFileFormat; - import static org.stupidcraft.linearpaper.LinearConfig.log; + import static com.triassic.linearpaper.LinearConfig.log; @@ -110,4 +112,23 @@ public class LinearWorldConfig { final Map value = getMap("world-settings." + worldName + "." + path, null); @@ -82,13 +82,13 @@ index 4e4bafaec9b8d40ba9252d53167e34e8f684c5b8..267474bdf5969b8028a3b4573828ebd4 + } + } } -diff --git a/src/main/java/org/stupidcraft/linearpaper/region/RegionFileFormat.java b/src/main/java/org/stupidcraft/linearpaper/region/RegionFileFormat.java +diff --git a/src/main/java/com/triassic/linearpaper/region/RegionFileFormat.java b/src/main/java/com/triassic/linearpaper/region/RegionFileFormat.java new file mode 100644 index 0000000000000000000000000000000000000000..64831ea14eef5cd7a9c3bcf87517ea8dd7d26795 --- /dev/null -+++ b/src/main/java/org/stupidcraft/linearpaper/region/RegionFileFormat.java ++++ b/src/main/java/com/triassic/linearpaper/region/RegionFileFormat.java @@ -0,0 +1,16 @@ -+package org.stupidcraft.linearpaper.region; ++package com.triassic.linearpaper.region; + +public enum RegionFileFormat { + ANVIL, diff --git a/patches/server/0004-Abstract-regionfile.patch b/patches/server/0004-Abstract-regionfile.patch index 768d4b7..f4838ab 100644 --- a/patches/server/0004-Abstract-regionfile.patch +++ b/patches/server/0004-Abstract-regionfile.patch @@ -13,10 +13,10 @@ index 73df26b27146bbad2106d57b22dd3c792ed3dd1d..62680e5c23483ee20b730a91fbace9b9 public boolean moonrise$doesRegionFileNotExistNoIO(final int chunkX, final int chunkZ); - public RegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ); -+ public org.stupidcraft.linearpaper.region.AbstractRegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ); // LinearPaper ++ public com.triassic.linearpaper.region.AbstractRegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ); // LinearPaper - public RegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException; -+ public org.stupidcraft.linearpaper.region.AbstractRegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException; // LinearPaper ++ public com.triassic.linearpaper.region.AbstractRegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException; // LinearPaper } diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/RegionFileIOThread.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/RegionFileIOThread.java @@ -28,10 +28,10 @@ index 3218cbf84f54daf06e84442d5eb1a36d8da6b215..cb0ced73599398ba9a9ec0bc6e708e7c } - public T computeForRegionFile(final int chunkX, final int chunkZ, final boolean existingOnly, final Function function) { -+ public T computeForRegionFile(final int chunkX, final int chunkZ, final boolean existingOnly, final Function function) { // LinearPaper ++ public T computeForRegionFile(final int chunkX, final int chunkZ, final boolean existingOnly, final Function function) { // LinearPaper final RegionFileStorage cache = this.getCache(); - final RegionFile regionFile; -+ final org.stupidcraft.linearpaper.region.AbstractRegionFile regionFile; // LinearPaper ++ final com.triassic.linearpaper.region.AbstractRegionFile regionFile; // LinearPaper synchronized (cache) { try { if (existingOnly) { @@ -40,10 +40,10 @@ index 3218cbf84f54daf06e84442d5eb1a36d8da6b215..cb0ced73599398ba9a9ec0bc6e708e7c } - public T computeForRegionFileIfLoaded(final int chunkX, final int chunkZ, final Function function) { -+ public T computeForRegionFileIfLoaded(final int chunkX, final int chunkZ, final Function function) { // LinearPaper ++ public T computeForRegionFileIfLoaded(final int chunkX, final int chunkZ, final Function function) { // LinearPaper final RegionFileStorage cache = this.getCache(); - final RegionFile regionFile; -+ final org.stupidcraft.linearpaper.region.AbstractRegionFile regionFile; // LinearPaper ++ final com.triassic.linearpaper.region.AbstractRegionFile regionFile; // LinearPaper synchronized (cache) { regionFile = ((ChunkSystemRegionFileStorage)(Object)cache).moonrise$getRegionFileIfLoaded(chunkX, chunkZ); @@ -56,7 +56,7 @@ index cb39c629af1827078f35904a373d35a63fea17ff..cf6f3fd4268c55547c1834d91a5967dd try { - RegionFile regionfile = new RegionFile(key, file.toPath(), regionDirectory, true); -+ org.stupidcraft.linearpaper.region.AbstractRegionFile regionfile = org.stupidcraft.linearpaper.region.AbstractRegionFileFactory.getAbstractRegionFile(key, file.toPath(), regionDirectory, true); // LinearPaper ++ com.triassic.linearpaper.region.AbstractRegionFile regionfile = com.triassic.linearpaper.region.AbstractRegionFileFactory.getAbstractRegionFile(key, file.toPath(), regionDirectory, true); // LinearPaper try { for (int i1 = 0; i1 < 32; ++i1) { @@ -65,7 +65,7 @@ index cb39c629af1827078f35904a373d35a63fea17ff..cf6f3fd4268c55547c1834d91a5967dd protected abstract boolean tryProcessOnePosition(T storage, ChunkPos chunkPos, ResourceKey worldKey); - private void onFileFinished(RegionFile regionFile) { -+ private void onFileFinished(org.stupidcraft.linearpaper.region.AbstractRegionFile regionFile) { // LinearPaper ++ private void onFileFinished(com.triassic.linearpaper.region.AbstractRegionFile regionFile) { // LinearPaper if (WorldUpgrader.this.recreateRegionFiles) { if (this.previousWriteFuture != null) { this.previousWriteFuture.join(); @@ -74,7 +74,7 @@ index cb39c629af1827078f35904a373d35a63fea17ff..cf6f3fd4268c55547c1834d91a5967dd } - static record FileToUpgrade(RegionFile file, List chunksToUpgrade) { -+ static record FileToUpgrade(org.stupidcraft.linearpaper.region.AbstractRegionFile file, List chunksToUpgrade) { // LinearPaper ++ static record FileToUpgrade(com.triassic.linearpaper.region.AbstractRegionFile file, List chunksToUpgrade) { // LinearPaper } @@ -87,7 +87,7 @@ index eb0389ad86300665b6e057bcfa1d7c068dc6c6ab..62a8742b2e36b5fd7cc2bf316d37583d import org.slf4j.Logger; -public class RegionFile implements AutoCloseable { -+public class RegionFile implements AutoCloseable, org.stupidcraft.linearpaper.region.AbstractRegionFile { // LinearPaper ++public class RegionFile implements AutoCloseable, com.triassic.linearpaper.region.AbstractRegionFile { // LinearPaper private static final Logger LOGGER = LogUtils.getLogger(); private static final int SECTOR_BYTES = 4096; @@ -131,7 +131,7 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 public static final String ANVIL_EXTENSION = ".mca"; private static final int MAX_CACHE_SIZE = 256; - public final Long2ObjectLinkedOpenHashMap regionCache = new Long2ObjectLinkedOpenHashMap(); -+ public final Long2ObjectLinkedOpenHashMap regionCache = new Long2ObjectLinkedOpenHashMap(); // LinearPaper ++ public final Long2ObjectLinkedOpenHashMap regionCache = new Long2ObjectLinkedOpenHashMap(); // LinearPaper private final RegionStorageInfo info; private final Path folder; private final boolean sync; @@ -140,17 +140,17 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 @Override - public synchronized final RegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ) { -+ public synchronized final org.stupidcraft.linearpaper.region.AbstractRegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ) { // LinearPaper ++ public synchronized final com.triassic.linearpaper.region.AbstractRegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ) { // LinearPaper return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkX >> REGION_SHIFT, chunkZ >> REGION_SHIFT)); } @Override - public synchronized final RegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException { -+ public synchronized final org.stupidcraft.linearpaper.region.AbstractRegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException { // LinearPaper ++ public synchronized final com.triassic.linearpaper.region.AbstractRegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException { // LinearPaper final long key = ChunkPos.asLong(chunkX >> REGION_SHIFT, chunkZ >> REGION_SHIFT); - RegionFile ret = this.regionCache.getAndMoveToFirst(key); -+ org.stupidcraft.linearpaper.region.AbstractRegionFile ret = this.regionCache.getAndMoveToFirst(key); // LinearPaper ++ com.triassic.linearpaper.region.AbstractRegionFile ret = this.regionCache.getAndMoveToFirst(key); // LinearPaper if (ret != null) { return ret; } @@ -159,7 +159,7 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 FileUtil.createDirectoriesSafe(this.folder); - ret = new RegionFile(this.info, regionPath, this.folder, this.sync); -+ ret = org.stupidcraft.linearpaper.region.AbstractRegionFileFactory.getAbstractRegionFile(this.info, regionPath, this.folder, this.sync); // LinearPaper ++ ret = com.triassic.linearpaper.region.AbstractRegionFileFactory.getAbstractRegionFile(this.info, regionPath, this.folder, this.sync); // LinearPaper this.regionCache.putAndMoveToFirst(key, ret); @@ -168,7 +168,7 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 } - public RegionFile getRegionFile(ChunkPos chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit // Paper - public -+ public org.stupidcraft.linearpaper.region.AbstractRegionFile getRegionFile(ChunkPos chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit // Paper - public // LinearPaper ++ public com.triassic.linearpaper.region.AbstractRegionFile getRegionFile(ChunkPos chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit // Paper - public // LinearPaper // Paper start - rewrite chunk system if (existingOnly) { return this.moonrise$getRegionFileIfExists(chunkcoordintpair.x, chunkcoordintpair.z); @@ -177,7 +177,7 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 final long key = ChunkPos.asLong(chunkcoordintpair.x >> REGION_SHIFT, chunkcoordintpair.z >> REGION_SHIFT); - RegionFile ret = this.regionCache.getAndMoveToFirst(key); -+ org.stupidcraft.linearpaper.region.AbstractRegionFile ret = this.regionCache.getAndMoveToFirst(key); // LinearPaper ++ com.triassic.linearpaper.region.AbstractRegionFile ret = this.regionCache.getAndMoveToFirst(key); // LinearPaper if (ret != null) { return ret; } @@ -186,7 +186,7 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 FileUtil.createDirectoriesSafe(this.folder); - ret = new RegionFile(this.info, regionPath, this.folder, this.sync); -+ ret = org.stupidcraft.linearpaper.region.AbstractRegionFileFactory.getAbstractRegionFile(this.info, regionPath, this.folder, this.sync); // LinearPaper ++ ret = com.triassic.linearpaper.region.AbstractRegionFileFactory.getAbstractRegionFile(this.info, regionPath, this.folder, this.sync); // LinearPaper this.regionCache.putAndMoveToFirst(key, ret); @@ -195,7 +195,7 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 } - private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException { -+ private static CompoundTag readOversizedChunk(org.stupidcraft.linearpaper.region.AbstractRegionFile regionfile, ChunkPos chunkCoordinate) throws IOException { // LinearPaper ++ private static CompoundTag readOversizedChunk(com.triassic.linearpaper.region.AbstractRegionFile regionfile, ChunkPos chunkCoordinate) throws IOException { // LinearPaper synchronized (regionfile) { try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) { CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z); @@ -204,7 +204,7 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 public CompoundTag read(ChunkPos pos) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing - RegionFile regionfile = this.getRegionFile(pos, true); -+ org.stupidcraft.linearpaper.region.AbstractRegionFile regionfile = this.getRegionFile(pos, true); // LinearPaper ++ com.triassic.linearpaper.region.AbstractRegionFile regionfile = this.getRegionFile(pos, true); // LinearPaper if (regionfile == null) { return null; } @@ -213,7 +213,7 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 public void scanChunk(ChunkPos chunkPos, StreamTagVisitor scanner) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing - RegionFile regionfile = this.getRegionFile(chunkPos, true); -+ org.stupidcraft.linearpaper.region.AbstractRegionFile regionfile = this.getRegionFile(chunkPos, true); // LinearPaper ++ com.triassic.linearpaper.region.AbstractRegionFile regionfile = this.getRegionFile(chunkPos, true); // LinearPaper if (regionfile == null) { return; } @@ -222,7 +222,7 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 public void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException { // Paper - public - RegionFile regionfile = this.getRegionFile(pos, nbt == null); // CraftBukkit // Paper - rewrite chunk system -+ org.stupidcraft.linearpaper.region.AbstractRegionFile regionfile = this.getRegionFile(pos, nbt == null); // CraftBukkit // Paper - rewrite chunk system // LinearPaper ++ com.triassic.linearpaper.region.AbstractRegionFile regionfile = this.getRegionFile(pos, nbt == null); // CraftBukkit // Paper - rewrite chunk system // LinearPaper // Paper start - rewrite chunk system if (regionfile == null) { // if the RegionFile doesn't exist, no point in deleting from it @@ -231,7 +231,7 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); - for (final RegionFile regionFile : this.regionCache.values()) { -+ for (final org.stupidcraft.linearpaper.region.AbstractRegionFile regionFile : this.regionCache.values()) { // LinearPaper ++ for (final com.triassic.linearpaper.region.AbstractRegionFile regionFile : this.regionCache.values()) { // LinearPaper try { regionFile.close(); } catch (final IOException ex) { @@ -240,17 +240,17 @@ index 40689256711cc94a806ca1da346f4f62eda31526..23917b903a978a3ac25c397080e92642 synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); - for (final RegionFile regionFile : this.regionCache.values()) { -+ for (final org.stupidcraft.linearpaper.region.AbstractRegionFile regionFile : this.regionCache.values()) { // LinearPaper ++ for (final com.triassic.linearpaper.region.AbstractRegionFile regionFile : this.regionCache.values()) { // LinearPaper try { regionFile.flush(); } catch (final IOException ex) { -diff --git a/src/main/java/org/stupidcraft/linearpaper/region/AbstractRegionFile.java b/src/main/java/org/stupidcraft/linearpaper/region/AbstractRegionFile.java +diff --git a/src/main/java/com/triassic/linearpaper/region/AbstractRegionFile.java b/src/main/java/com/triassic/linearpaper/region/AbstractRegionFile.java new file mode 100644 index 0000000000000000000000000000000000000000..432e12a19f2141f167c8d22248eb67bc05ee2e19 --- /dev/null -+++ b/src/main/java/org/stupidcraft/linearpaper/region/AbstractRegionFile.java ++++ b/src/main/java/com/triassic/linearpaper/region/AbstractRegionFile.java @@ -0,0 +1,26 @@ -+package org.stupidcraft.linearpaper.region; ++package com.triassic.linearpaper.region; + +import java.io.DataInputStream; +import java.io.DataOutputStream; @@ -276,13 +276,13 @@ index 0000000000000000000000000000000000000000..432e12a19f2141f167c8d22248eb67bc + void clear(ChunkPos pos) throws IOException; + void setOversized(int x, int z, boolean oversized) throws IOException; +} -diff --git a/src/main/java/org/stupidcraft/linearpaper/region/AbstractRegionFileFactory.java b/src/main/java/org/stupidcraft/linearpaper/region/AbstractRegionFileFactory.java +diff --git a/src/main/java/com/triassic/linearpaper/region/AbstractRegionFileFactory.java b/src/main/java/com/triassic/linearpaper/region/AbstractRegionFileFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..fb05d7b09fde10e42de42987df64152d7a8099d6 --- /dev/null -+++ b/src/main/java/org/stupidcraft/linearpaper/region/AbstractRegionFileFactory.java ++++ b/src/main/java/com/triassic/linearpaper/region/AbstractRegionFileFactory.java @@ -0,0 +1,18 @@ -+package org.stupidcraft.linearpaper.region; ++package com.triassic.linearpaper.region; + +import java.io.IOException; +import java.nio.file.Path; diff --git a/patches/server/0005-Add-Linear-region-format.patch b/patches/server/0005-Add-Linear-region-format.patch index 7939408..12d484e 100644 --- a/patches/server/0005-Add-Linear-region-format.patch +++ b/patches/server/0005-Add-Linear-region-format.patch @@ -52,7 +52,7 @@ index 23917b903a978a3ac25c397080e92642f1674107..aa3a8f43f110ad493b1de26b6e9193c8 - private static String getRegionFileName(final int chunkX, final int chunkZ) { + // LinearPaper start - Linear region format + private static String getRegionFileName(final RegionStorageInfo info, final int chunkX, final int chunkZ) { -+ if (info.regionFormat().equals(org.stupidcraft.linearpaper.region.RegionFileFormat.LINEAR)) ++ if (info.regionFormat().equals(com.triassic.linearpaper.region.RegionFileFormat.LINEAR)) + return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + ".linear"; return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + ".mca"; } @@ -85,7 +85,7 @@ index 6111631c6673948b266286894603cc5e30451b02..a17428f1fb14adf865f3a8edd24bd5d5 } + + // LinearPaper start -+ public org.stupidcraft.linearpaper.region.RegionFileFormat regionFormat() { ++ public com.triassic.linearpaper.region.RegionFileFormat regionFormat() { + return ((org.bukkit.craftbukkit.CraftWorld) org.bukkit.Bukkit.getWorld(level)) + .getHandle() + .linearConfig @@ -100,10 +100,10 @@ index 6111631c6673948b266286894603cc5e30451b02..a17428f1fb14adf865f3a8edd24bd5d5 + } + // LinearPaper end } -diff --git a/src/main/java/org/stupidcraft/linearpaper/region/AbstractRegionFileFactory.java b/src/main/java/org/stupidcraft/linearpaper/region/AbstractRegionFileFactory.java +diff --git a/src/main/java/com/triassic/linearpaper/region/AbstractRegionFileFactory.java b/src/main/java/com/triassic/linearpaper/region/AbstractRegionFileFactory.java index fb05d7b09fde10e42de42987df64152d7a8099d6..3cf9093fd657a68ad3b99714472d8140445515ce 100644 ---- a/src/main/java/org/stupidcraft/linearpaper/region/AbstractRegionFileFactory.java -+++ b/src/main/java/org/stupidcraft/linearpaper/region/AbstractRegionFileFactory.java +--- a/src/main/java/com/triassic/linearpaper/region/AbstractRegionFileFactory.java ++++ b/src/main/java/com/triassic/linearpaper/region/AbstractRegionFileFactory.java @@ -13,6 +13,10 @@ public class AbstractRegionFileFactory { } @@ -116,13 +116,13 @@ index fb05d7b09fde10e42de42987df64152d7a8099d6..3cf9093fd657a68ad3b99714472d8140 + } } } -diff --git a/src/main/java/org/stupidcraft/linearpaper/region/LinearRegionFile.java b/src/main/java/org/stupidcraft/linearpaper/region/LinearRegionFile.java +diff --git a/src/main/java/com/triassic/linearpaper/region/LinearRegionFile.java b/src/main/java/com/triassic/linearpaper/region/LinearRegionFile.java new file mode 100644 index 0000000000000000000000000000000000000000..6c954ff634512b95e947bcbab80b41cb66f3ef70 --- /dev/null -+++ b/src/main/java/org/stupidcraft/linearpaper/region/LinearRegionFile.java ++++ b/src/main/java/com/triassic/linearpaper/region/LinearRegionFile.java @@ -0,0 +1,304 @@ -+package org.stupidcraft.linearpaper.region; ++package com.triassic.linearpaper.region; + +import com.github.luben.zstd.ZstdInputStream; +import com.github.luben.zstd.ZstdOutputStream; @@ -426,13 +426,13 @@ index 0000000000000000000000000000000000000000..6c954ff634512b95e947bcbab80b41cb + } + } +} -diff --git a/src/main/java/org/stupidcraft/linearpaper/region/LinearRegionFileFlusher.java b/src/main/java/org/stupidcraft/linearpaper/region/LinearRegionFileFlusher.java +diff --git a/src/main/java/com/triassic/linearpaper/region/LinearRegionFileFlusher.java b/src/main/java/com/triassic/linearpaper/region/LinearRegionFileFlusher.java new file mode 100644 index 0000000000000000000000000000000000000000..ea22ee01532df5f03c7a6abcd3c6b15823ce7a6b --- /dev/null -+++ b/src/main/java/org/stupidcraft/linearpaper/region/LinearRegionFileFlusher.java ++++ b/src/main/java/com/triassic/linearpaper/region/LinearRegionFileFlusher.java @@ -0,0 +1,50 @@ -+package org.stupidcraft.linearpaper.region; ++package com.triassic.linearpaper.region; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import java.util.Queue; @@ -442,7 +442,7 @@ index 0000000000000000000000000000000000000000..ea22ee01532df5f03c7a6abcd3c6b158 +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import org.bukkit.Bukkit; -+import org.stupidcraft.linearpaper.LinearConfig; ++import com.triassic.linearpaper.LinearConfig; + +public class LinearRegionFileFlusher { +