Skip to content

Commit

Permalink
LevelDB support & other updates (#2175)
Browse files Browse the repository at this point in the history
  • Loading branch information
PetteriM1 authored Nov 7, 2024
1 parent 2172e54 commit bfb30cd
Show file tree
Hide file tree
Showing 2,160 changed files with 75,907 additions and 26,160 deletions.
107 changes: 0 additions & 107 deletions .github/CONTRIBUTING.md

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ rebel-remote.xml
# Nukkit generated files
banned-ips.json
banned-players.json
nukkit.yml
/nukkit.yml
ops.txt
server.log
server.properties
Expand All @@ -265,6 +265,9 @@ creativeitems.json
recipes.json
data/
data/*
material_tags.txt
item_types.txt
block_types.txt

run/

Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "src/main/resources/lang"]
path = src/main/resources/lang
url = https://github.com/NukkitX/Languages.git
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,24 @@
Introduction
-------------

Nukkit is nuclear-powered server software for Minecraft: Pocket Edition.
Nukkit is nuclear-powered server software for Minecraft Bedrock Edition.
It has a few key advantages over other server software:

* Written in Java, Nukkit is faster and more stable.
* Having a friendly structure, it's easy to contribute to Nukkit's development and rewrite plugins from other platforms into Nukkit plugins.

Nukkit is **under improvement** yet, we welcome contributions.
Nukkit is under improvement yet, we welcome contributions.

Links
--------------------

* __[News](https://nukkitx.com)__
* __[Forums](https://nukkitx.com/forums)__
* __[Forums](https://cloudburstmc.org/forums/)__
* __[Discord](https://discord.gg/5PzMkyK)__
* __[Download](https://ci.nukkitx.com/job/NukkitX/job/Nukkit/job/master)__
* __[Plugins](https://nukkitx.com/resources/categories/nukkit-plugins.1)__
* __[Wiki](https://nukkitx.com/wiki/nukkit)__
* __[Wiki](https://cloudburstmc.org/wiki/nukkit)__
* __[Download Nukkit](https://ci.opencollab.dev/job/NukkitX/job/Nukkit/job/master/)__
* __[Download Plugins](https://cloudburstmc.org/resources/categories/nukkit-plugins.1/)__

Contributing
-------------
Please read the [CONTRIBUTING](.github/CONTRIBUTING.md) guide before submitting any issue. Issues with insufficient information or in the wrong format will be closed and will not be reviewed.

Build JAR file
Compile Nukkit
-------------
- `git clone https://github.com/CloudburstMC/Nukkit`
- `cd Nukkit`
Expand All @@ -38,6 +33,8 @@ Build JAR file

The compiled JAR can be found in the `target/` directory.

Note: You don't need to compile Nukkit yourself if you don't intend to modify the code. You can find precompiled JARs on Jenkins.

Running
-------------
Simply run `java -jar nukkit-1.0-SNAPSHOT.jar`.
Expand Down Expand Up @@ -114,3 +111,8 @@ Testing after deployment:
Completely remove the chart:

`helm uninstall nukkit`

Pterodactyl Panel
-------------

[Download the official egg](https://raw.githubusercontent.com/parkervcp/eggs/master/game_eggs/minecraft/bedrock/nukkit/egg-nukkit.json)
21 changes: 19 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
import org.gradle.internal.impldep.org.junit.experimental.categories.Categories.CategoryFilter.exclude

@Suppress("DSL_SCOPE_VIOLATION") // https://youtrack.jetbrains.com/issue/IDEA-262280

Expand All @@ -12,7 +13,7 @@ plugins {

group = "cn.nukkit"
version = "1.0-SNAPSHOT"
description = "Nuclear powered server software for Minecraft: Bedrock Edition"
description = "Nuclear powered server software for Minecraft Bedrock Edition"

repositories {
mavenLocal()
Expand All @@ -23,16 +24,32 @@ repositories {

dependencies {
api(libs.network)
api(libs.natives)
api(libs.epoll)
api(libs.fastutil)
api(libs.bundles.fastutilmaps)
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.snappy)
api(libs.jwt)
api(libs.bundles.terminal)
api(libs.bundles.log4j)
api(libs.jopt.simple)
api(libs.blockstateupdater)
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")
}
compileOnly(libs.lombok)
annotationProcessor(libs.lombok)

Expand Down
23 changes: 17 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,28 @@
junit = "5.9.2"
log4j = "2.20.0"
jline = "3.22.0"
fastutilmaps = "8.5.13-SNAPSHOT"

[libraries]
network = { group = "com.nukkitx.network", name = "raknet", version = "1.6.28-SNAPSHOT" }
natives = { group = "com.nukkitx", name = "natives", version = "1.0.3" }
network = { group = "org.cloudburstmc.netty", name = "netty-transport-raknet", version = "1.0.0.CR3-SNAPSHOT" }
epoll = { group = "io.netty", name = "netty-transport-native-epoll", version = "4.1.101.Final" }
fastutil = { group = "com.nukkitx", name = "fastutil-lite", version = "8.1.1" }
guava = { group = "com.google.guava", name = "guava", version = "30.1.1-jre" }
fastutil-long-long-maps = { group = "org.cloudburstmc.fastutil.maps", name = "long-long-maps", version.ref = "fastutilmaps" }
fastutil-int-short-maps = { group = "org.cloudburstmc.fastutil.maps", name = "int-short-maps", version.ref = "fastutilmaps" }
fastutil-object-int-maps = { group = "org.cloudburstmc.fastutil.maps", name = "object-int-maps", version.ref = "fastutilmaps" }
fastutil-object-object-maps = { group = "org.cloudburstmc.fastutil.maps", name = "object-object-maps", version.ref = "fastutilmaps" }
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-SNAPSHOT" }
jwt = { group = "com.nimbusds", name = "nimbus-jose-jwt", version = "9.13" }
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" }
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" }
lombok = { group = "org.projectlombok", name = "lombok", version = "1.18.26" }
blockstateupdater = { group = "org.cloudburstmc", name = "block-state-updater", version = "1.21.30-SNAPSHOT" }
lmbda = { group = "org.lanternpowered", name = "lmbda", version = "2.0.0" }
noise = { group = "net.daporkchop.lib", name = "noise", version = "0.5.6-SNAPSHOT" }
lombok = { group = "org.projectlombok", name = "lombok", version = "1.18.34" }

# Logging dependencies
log4j-api = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" }
Expand All @@ -33,6 +43,7 @@ junit-jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engi
log4j = [ "log4j-api", "log4j-core" ]
terminal = [ "jline-terminal", "jline-terminal-jna", "jline-reader", "terminal-console" ]
junit = [ "junit-jupiter-api", "junit-jupiter-engine" ]
fastutilmaps = [ "fastutil-long-long-maps", "fastutil-int-short-maps", "fastutil-object-int-maps", "fastutil-object-object-maps" ]

[plugins]
shadow = { id = "com.github.johnrengelman.shadow", version = "8.0.0" }
Expand Down
2 changes: 0 additions & 2 deletions nukkit.yml.default
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
settings:
# Multi-language setting
# Available: eng, chs, cht, jpn, rus, spa, pol, bra, kor, ukr, deu
language: "eng"
61 changes: 54 additions & 7 deletions src/main/java/cn/nukkit/Achievement.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@
import java.util.HashMap;

/**
* Created by CreeperFace on 9. 11. 2016.
* Achievement list and functions
*
* @author CreeperFace
*/
public class Achievement {

/**
* All known achievements.
* <p>
* Based on <a href="https://minecraft.fandom.com/wiki/Achievement/Java_Edition#List_of_achievements">...</a>
*/
public static final HashMap<String, Achievement> achievements = new HashMap<String, Achievement>() {
{
put("mineWood", new Achievement("Getting Wood"));
put("openInventory", new Achievement("Taking Inventory"));
put("mineWood", new Achievement("Getting Wood", "openInventory"));
put("buildWorkBench", new Achievement("Benchmarking", "mineWood"));
put("buildPickaxe", new Achievement("Time to Mine!", "buildWorkBench"));
put("buildFurnace", new Achievement("Hot Topic", "buildPickaxe"));
Expand All @@ -20,25 +28,57 @@ public class Achievement {
put("makeBread", new Achievement("Bake Bread", "buildHoe"));
put("bakeCake", new Achievement("The Lie", "buildHoe"));
put("buildBetterPickaxe", new Achievement("Getting an Upgrade", "buildPickaxe"));
put("cookFish", new Achievement("Delicious Fish", "buildFurnace"));
put("onARail", new Achievement("On A Rail", "acquireIron"));
put("buildSword", new Achievement("Time to Strike!", "buildWorkBench"));
put("killEnemy", new Achievement("Monster Hunter", "buildSword"));
put("killCow", new Achievement("Cow Tipper", "buildSword"));
put("flyPig", new Achievement("When Pigs Fly", "killCow"));
put("snipeSkeleton", new Achievement("Sniper Duel", "killEnemy"));
put("diamonds", new Achievement("DIAMONDS!", "acquireIron"));
put("portal", new Achievement("We Need to Go Deeper", "diamonds"));
put("ghast", new Achievement("Return to Sender", "portal"));
put("blazeRod", new Achievement("Into Fire", "portal"));
put("potion", new Achievement("Local Brewery", "blazeRod"));
put("theEnd", new Achievement("The End?", "blazeRod"));
put("theEnd2", new Achievement("The End.", "theEnd"));
put("enchantments", new Achievement("Enchanter", "diamonds"));
put("overkill", new Achievement("Overkill", "enchantments"));
put("bookcase", new Achievement("Librarian", "enchantments"));
put("exploreAllBiomes", new Achievement("Adventuring Time", "theEnd")); //TODO
put("spawnWither", new Achievement("The Beginning?", "theEnd"));
put("killWither", new Achievement("The Beginning.", "spawnWither"));
put("fullBeacon", new Achievement("Beaconator", "killWither"));
put("breedCow", new Achievement("Repopulation", "killCow"));
put("diamondsToYou", new Achievement("Diamonds to you!", "diamonds"));
put("overpowered", new Achievement("Overpowered", "buildBetterPickaxe"));
}
};

/**
* Broadcasts achievement get message if player does not have the achievement yet. Returns true if broadcast.
*/
public static boolean broadcast(Player player, String achievementId) {
if (!achievements.containsKey(achievementId)) {
return false;
}
String translation = Server.getInstance().getLanguage().translateString("chat.type.achievement", player.getDisplayName(), TextFormat.GREEN + achievements.get(achievementId).getMessage() + TextFormat.RESET);

if (Server.getInstance().getPropertyBoolean("announce-player-achievements", true)) {
String translation = TextFormat.WHITE + Server.getInstance().getLanguage().translateString("chat.type.achievement", player.getDisplayName(), TextFormat.GREEN + "[" + achievements.get(achievementId).message + "]", null);

if (Server.getInstance().announceAchievements) {
Server.getInstance().broadcastMessage(translation);
} else {
player.sendMessage(translation);
}
return true;
}

/**
* Register an achievement
* @param name save id
* @param achievement achievement
* @return true if successful, false if save id is already in use
*/
public static boolean add(String name, Achievement achievement) {
if (achievements.containsKey(name)) {
return false;
Expand All @@ -51,6 +91,10 @@ public static boolean add(String name, Achievement achievement) {
public final String message;
public final String[] requires;

/**
* @param message achievement name displayed in achievement get message
* @param requires save IDs of achievements player must complete before this achievement can be completed
*/
public Achievement(String message, String... requires) {
this.message = message;
this.requires = requires;
Expand All @@ -60,13 +104,16 @@ public String getMessage() {
return message;
}

/**
* Broadcasts achievement get message
*/
public void broadcast(Player player) {
String translation = Server.getInstance().getLanguage().translateString("chat.type.achievement", player.getDisplayName(), TextFormat.GREEN + this.getMessage(), null);
String translation = TextFormat.WHITE + Server.getInstance().getLanguage().translateString("chat.type.achievement", player.getDisplayName(), TextFormat.GREEN + "[" + this.message + "]", null);

if (Server.getInstance().getPropertyBoolean("announce-player-achievements", true)) {
if (Server.getInstance().announceAchievements) {
Server.getInstance().broadcastMessage(translation);
} else {
player.sendMessage(translation);
}
}
}
}
Loading

0 comments on commit bfb30cd

Please sign in to comment.