refactor: Remove lz4-stream

LZ4-Java contains a modern version & delegate for lz4-java-stream.
This commit is contained in:
NotMyFault 2021-09-26 00:48:50 +02:00
parent 268244119f
commit ca15e93102
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
4 changed files with 2 additions and 17 deletions

View File

@ -100,13 +100,12 @@ dependencies {
because("This dependency is needed by GriefDefender but not exposed transitively.") because("This dependency is needed by GriefDefender but not exposed transitively.")
isTransitive = false isTransitive = false
} }
implementation(libs.paperlib) { isTransitive = false } implementation(libs.paperlib)
implementation(libs.bstatsBukkit) { isTransitive = false } implementation(libs.bstatsBukkit) { isTransitive = false }
implementation(libs.bstatsBase) { isTransitive = false } implementation(libs.bstatsBase) { isTransitive = false }
implementation(libs.serverlib) implementation(libs.serverlib)
api(libs.paster) { isTransitive = false } api(libs.paster) { isTransitive = false }
api(libs.lz4Java) { isTransitive = false } api(libs.lz4Java) { isTransitive = false }
runtimeOnly(libs.lz4JavaStream) { isTransitive = false }
api(libs.sparsebitset) { isTransitive = false } api(libs.sparsebitset) { isTransitive = false }
api(libs.parallelgzip) { isTransitive = false } api(libs.parallelgzip) { isTransitive = false }
compileOnly(libs.adventure) compileOnly(libs.adventure)
@ -171,9 +170,6 @@ tasks.named<ShadowJar>("shadowJar") {
relocate("com.intellectualsites.paster", "com.fastasyncworldedit.paster") { relocate("com.intellectualsites.paster", "com.fastasyncworldedit.paster") {
include(dependency("com.intellectualsites.paster:Paster:1.1.1")) include(dependency("com.intellectualsites.paster:Paster:1.1.1"))
} }
relocate("net.jpountz", "com.fastasyncworldedit.core.jpountz") {
include(dependency("net.jpountz:lz4-java-stream:1.0.0"))
}
relocate("org.lz4", "com.fastasyncworldedit.core.lz4") { relocate("org.lz4", "com.fastasyncworldedit.core.lz4") {
include(dependency("org.lz4:lz4-java:1.8.0")) include(dependency("org.lz4:lz4-java:1.8.0"))
} }

View File

@ -40,7 +40,6 @@ dependencies {
implementation("commons-cli:commons-cli:1.4") implementation("commons-cli:commons-cli:1.4")
api(libs.parallelgzip) { isTransitive = false } api(libs.parallelgzip) { isTransitive = false }
api(libs.lz4Java) api(libs.lz4Java)
api(libs.lz4JavaStream) { isTransitive = false }
} }
tasks.named<ShadowJar>("shadowJar") { tasks.named<ShadowJar>("shadowJar") {

View File

@ -55,7 +55,6 @@ dependencies {
implementation(libs.zstd) { isTransitive = false } implementation(libs.zstd) { isTransitive = false }
api(libs.paster) api(libs.paster)
compileOnly(libs.lz4Java) { isTransitive = false } compileOnly(libs.lz4Java) { isTransitive = false }
compileOnly(libs.lz4JavaStream) { isTransitive = false }
compileOnly(libs.sparsebitset) compileOnly(libs.sparsebitset)
compileOnly(libs.parallelgzip) { isTransitive = false } compileOnly(libs.parallelgzip) { isTransitive = false }
antlr(libs.antlr4) antlr(libs.antlr4)

View File

@ -31,7 +31,6 @@ import net.jpountz.lz4.LZ4BlockOutputStream;
import net.jpountz.lz4.LZ4Compressor; import net.jpountz.lz4.LZ4Compressor;
import net.jpountz.lz4.LZ4Factory; import net.jpountz.lz4.LZ4Factory;
import net.jpountz.lz4.LZ4FastDecompressor; import net.jpountz.lz4.LZ4FastDecompressor;
import net.jpountz.lz4.LZ4InputStream;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@ -360,12 +359,8 @@ public class MainUtil {
if (mode == 0) { if (mode == 0) {
return new FaweInputStream(is); return new FaweInputStream(is);
} }
boolean legacy;
if (mode >= 10) { if (mode >= 10) {
legacy = false;
mode = -mode + 10; mode = -mode + 10;
} else {
legacy = true;
} }
if (mode == 0) { if (mode == 0) {
return new FaweInputStream(is); return new FaweInputStream(is);
@ -380,12 +375,8 @@ public class MainUtil {
} }
amountAbs = (1 + ((amountAbs - 1) % 3)) + (amountAbs > 3 ? 1 : 0); amountAbs = (1 + ((amountAbs - 1) % 3)) + (amountAbs > 3 ? 1 : 0);
for (int i = 0; i < amountAbs; i++) { for (int i = 0; i < amountAbs; i++) {
if (legacy) {
is = new LZ4InputStream(is);
} else {
is = new LZ4BlockInputStream(is); is = new LZ4BlockInputStream(is);
} }
}
return new FaweInputStream(new FastBufferedInputStream(is)); return new FaweInputStream(new FastBufferedInputStream(is));
} }