Skip to content

Bump minimum Java version to 11 and use HiveGamesOSS's LevelDB #2206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Requires Docker v17.05

# Use OpenJDK JDK image for intermiediate build
FROM eclipse-temurin:8-jdk-jammy AS build
FROM eclipse-temurin:11-jdk-jammy AS build

# Build from source and create artifact
WORKDIR /src
Expand All @@ -16,7 +16,7 @@ COPY gradle /src/gradle
RUN ./gradlew shadowJar

# Use OpenJDK JRE image for runtime
FROM eclipse-temurin:8-jdk-jammy AS run
FROM eclipse-temurin:11-jdk-jammy AS run

# Copy artifact from build image
COPY --from=build /src/target/nukkit-1.0-SNAPSHOT.jar /app/nukkit.jar
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Requires Docker v17.05

# Use OpenJDK JDK image for intermiediate build
FROM --platform=linux/arm64 eclipse-temurin:8-jdk-jammy AS build
FROM --platform=linux/arm64 eclipse-temurin:11-jdk-jammy AS build

# Build from source and create artifact
WORKDIR /src
Expand All @@ -16,7 +16,7 @@ COPY gradle /src/gradle
RUN ./gradlew shadowJar

# Use OpenJDK JRE image for runtime
FROM --platform=linux/arm64 eclipse-temurin:8-jdk-jammy AS run
FROM --platform=linux/arm64 eclipse-temurin:11-jdk-jammy AS run

# Copy artifact from build image
COPY --from=build /src/target/nukkit-1.0-SNAPSHOT.jar /app/nukkit.jar
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pipeline {
agent any
tools {
maven 'Maven 3'
jdk 'Java 8'
jdk 'Java 11'
}
options {
buildDiscarder(logRotator(artifactNumToKeepStr: '5'))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Note: You don't need to compile Nukkit yourself if you don't intend to modify th

Running
-------------
Simply run `java -jar nukkit-1.0-SNAPSHOT.jar`.
Simply run `java -jar nukkit-1.0-SNAPSHOT.jar`. Make sure you have Java 11 or newer installed on your system.

Plugin API
-------------
Expand Down
15 changes: 3 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@ dependencies {
api(libs.guava)
api(libs.gson)
api(libs.snakeyaml)
api(libs.leveldb)
api(libs.leveldbjni) {
exclude(group = "com.google.guava", module = "guava")
exclude(group = "io.netty", module = "netty-buffer")
exclude(group = "org.iq80.snappy", module = "snappy")
exclude(group = "org.iq80.leveldb", module = "leveldb")
}
api(libs.bundles.leveldb)
api(libs.snappy)
api(libs.jwt)
api(libs.bundles.terminal)
Expand All @@ -46,10 +40,7 @@ dependencies {
api(libs.lmbda) {
exclude(group = "org.checkerframework", module = "checker-qual")
}
api(libs.noise) {
exclude(group = "net.daporkchop.lib", module = "common")
exclude(group = "net.daporkchop.lib", module = "math")
}
api(libs.noise)
compileOnly(libs.lombok)
annotationProcessor(libs.lombok)

Expand All @@ -60,7 +51,7 @@ dependencies {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(11))
}
}

Expand Down
6 changes: 4 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ junit = "5.9.2"
log4j = "2.20.0"
jline = "3.22.0"
fastutilmaps = "8.5.15-SNAPSHOT"
leveldb = "1.0.1"

[libraries]
network = { group = "org.cloudburstmc.netty", name = "netty-transport-raknet", version = "1.0.0.CR3-SNAPSHOT" }
Expand All @@ -13,8 +14,8 @@ fastutil-long-byte-maps = { group = "org.cloudburstmc.fastutil.maps", name = "lo
guava = { group = "com.google.guava", name = "guava", version = "33.2.1-jre" }
gson = { group = "com.google.code.gson", name = "gson", version = "2.10.1" }
snakeyaml = { group = "org.yaml", name = "snakeyaml", version = "1.33" }
leveldb = { group = "org.iq80.leveldb", name = "leveldb", version = "0.11.1-SNAPSHOT" }
leveldbjni = { group = "net.daporkchop", name = "leveldb-mcpe-jni", version = "0.0.10-SNAPSHOT" }
leveldb-api = { group = "com.hivemc.leveldb", name = "leveldb-api", version.ref = "leveldb" }
leveldb-impl = { group = "com.hivemc.leveldb", name = "leveldb", version.ref = "leveldb" }
snappy = { group = "org.xerial.snappy", name = "snappy-java", version = "1.1.10.7" }
jwt = { group = "com.nimbusds", name = "nimbus-jose-jwt", version = "9.23" }
jopt-simple = { group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.4" }
Expand Down Expand Up @@ -42,6 +43,7 @@ log4j = [ "log4j-api", "log4j-core" ]
terminal = [ "jline-terminal", "jline-terminal-jna", "jline-reader", "terminal-console" ]
junit = [ "junit-jupiter-api", "junit-jupiter-engine" ]
fastutilmaps = [ "fastutil-int-short-maps", "fastutil-long-byte-maps" ]
leveldb = [ "leveldb-api", "leveldb-impl" ]

[plugins]
shadow = { id = "com.github.johnrengelman.shadow", version = "8.0.0" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import net.daporkchop.ldbjni.DBProvider;
import net.daporkchop.ldbjni.LevelDB;
import net.daporkchop.lib.natives.FeatureBuilder;
import org.cloudburstmc.nbt.NbtMap;
import org.cloudburstmc.nbt.NbtMapBuilder;
import org.cloudburstmc.nbt.NbtType;
Expand All @@ -44,6 +41,7 @@
import org.iq80.leveldb.DB;
import org.iq80.leveldb.Options;
import org.iq80.leveldb.WriteBatch;
import org.iq80.leveldb.impl.Iq80DBFactory;

import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
Expand Down Expand Up @@ -77,8 +75,6 @@ public class LevelDBProvider implements LevelProvider {

private volatile boolean closed;

private static final DBProvider JAVA_LDB_PROVIDER = (DBProvider) FeatureBuilder.create(LevelDBProvider.class).addJava("net.daporkchop.ldbjni.java.JavaDBProvider").build();

public LevelDBProvider(Level level, String path) throws IOException {
this.level = level;
this.path = Paths.get(path);
Expand All @@ -93,8 +89,7 @@ public LevelDBProvider(Level level, String path) throws IOException {
.cacheSize(1024L * 1024L * level.getServer().getConfig("leveldb.cache-size-mb", 80))
.blockSize(64 * 1024);

this.db = level.getServer().getConfig("leveldb.use-native", false) ?
LevelDB.PROVIDER.open(dbPath.toFile(), options) : JAVA_LDB_PROVIDER.open(dbPath.toFile(), options);
this.db = Iq80DBFactory.factory.open(dbPath.toFile(), options);

this.levelData = loadLevelData(this.path);

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/ara/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/bra/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/chs/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/cht/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/cze/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/deu/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/eng/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/fin/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/idn/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/jpn/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/kor/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/ltu/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/pol/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/rus/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/spa/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/tur/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/lang/ukr/nukkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ chunk-generation:
population-queue-size: 8

leveldb:
#Use native LevelDB implementation for better performance
use-native: false
#Set LevelDB memory cache size
cache-size-mb: 80

Expand Down
Loading