diff --git a/.gitignore b/.gitignore index 34e52ea..9fa988e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ target/ +artifacts/ !.mvn/wrapper/maven-wrapper.jar !**/src/main/**/target/ !**/src/test/**/target/ diff --git a/README.md b/README.md index b0a6f34..b445827 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ This tool finds out chunks where players have barely stayed by examining the `In ## 3. Installation -1. Ensure you have the corresponding version of the JRE (Java Runtime Environment). -2. Download the `PotatoPeeler*.jar` from the [Releases](https://github.com/Bottle-M/PotatoPeeler/releases/latest) page, and place it in wherever you want(e.g. The root directory of your Minecraft server). +1. You should have already installed the corresponding version of JRE (Java Runtime Environment). For details, refer to [this document](https://minecraft.wiki/w/Server/Requirements#Server_requirements). +2. Download the `PotatoPeeler*.jar` from [Releases](https://github.com/Bottle-M/PotatoPeeler/releases/latest) according to your Java version, and place it in a suitable location (such as the root directory of your Minecraft Server). ## 4. Usage diff --git a/README.zh_CN.md b/README.zh_CN.md index b32c40e..f67a8ca 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -34,8 +34,8 @@ Lang: [English](README.md) | 简体中文 ## 3. 安装 -1. 确保你有相应版本的 JRE(Java 运行环境)。 -2. 从 [Releases](https://github.com/Bottle-M/PotatoPeeler/releases/latest) 下载 `PotatoPeeler*.jar`,找个位置放着即可(比如 Minecraft 服务端根目录)。 +1. 你应该已经按照了相应版本的 JRE(Java 运行环境),可以参考[这个文档](https://zh.minecraft.wiki/w/%E6%9C%8D%E5%8A%A1%E5%99%A8/%E9%9C%80%E6%B1%82#%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%9C%80%E6%B1%82)。 +2. 从 [Releases](https://github.com/Bottle-M/PotatoPeeler/releases/latest) 按照你的 Java 版本下载 `PotatoPeeler*.jar`,找个位置放着即可(比如 Minecraft 服务端根目录)。 ## 4. 使用 diff --git a/source/PotatoPeeler/build.sh b/source/PotatoPeeler/build.sh new file mode 100644 index 0000000..8a820bb --- /dev/null +++ b/source/PotatoPeeler/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +OUTPUT_DIR="./artifacts" + +rm -f $OUTPUT_DIR/* + +mkdir -p $OUTPUT_DIR + +# Maven Profiles + +for p in java11 java16 java17 java21; do + # Skip tests + mvn clean package -f pom.multiple.xml -DskipTests -P$p + cp target/PotatoPeeler*java*.jar $OUTPUT_DIR +done diff --git a/source/PotatoPeeler/dependency-reduced-pom.xml b/source/PotatoPeeler/dependency-reduced-pom.xml index 6437540..26fe24a 100644 --- a/source/PotatoPeeler/dependency-reduced-pom.xml +++ b/source/PotatoPeeler/dependency-reduced-pom.xml @@ -6,6 +6,14 @@ 1.0.0 + + maven-compiler-plugin + 3.13.0 + + ${maven.compiler.source} + ${maven.compiler.target} + + maven-shade-plugin 3.6.0 @@ -21,13 +29,51 @@ indi.somebottle.Main - PotatoPeeler-${project.version} + PotatoPeeler-${project.version}-java${javaVersion} + + + java11 + + 11 + 11 + 11 + UTF-8 + + + + java16 + + 16 + 16 + 16 + UTF-8 + + + + java17 + + 17 + 17 + 17 + UTF-8 + + + + java21 + + 21 + 21 + 21 + UTF-8 + + + junit @@ -42,9 +88,4 @@ - - 21 - 21 - UTF-8 - diff --git a/source/PotatoPeeler/pom.multiple.xml b/source/PotatoPeeler/pom.multiple.xml new file mode 100644 index 0000000..a7bdd53 --- /dev/null +++ b/source/PotatoPeeler/pom.multiple.xml @@ -0,0 +1,106 @@ + + + 4.0.0 + + indi.somebottle + potatopeeler + 1.0.0 + + + + org.lz4 + lz4-java + 1.8.0 + + + junit + junit + 4.13.1 + test + + + com.github.davidmoten + rtree2 + 0.9.3 + + + + + + java11 + + 11 + 11 + UTF-8 + 11 + + + + java16 + + 16 + 16 + UTF-8 + 16 + + + + java17 + + 17 + 17 + UTF-8 + 17 + + + + java21 + + 21 + 21 + UTF-8 + 21 + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + ${maven.compiler.source} + ${maven.compiler.target} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + + package + + shade + + + + + indi.somebottle.Main + + + PotatoPeeler-${project.version}-java${javaVersion} + + + + + + + + + \ No newline at end of file diff --git a/source/PotatoPeeler/src/main/java/indi/somebottle/Main.java b/source/PotatoPeeler/src/main/java/indi/somebottle/Main.java index b2ccf45..bb485d7 100644 --- a/source/PotatoPeeler/src/main/java/indi/somebottle/Main.java +++ b/source/PotatoPeeler/src/main/java/indi/somebottle/Main.java @@ -14,6 +14,8 @@ public class Main { public static void main(String[] args) { + // 设置编码为 UTF-8 + System.setProperty("file.encoding", "UTF-8"); // 如果一个参数都没有 if (args.length == 0) { // 尝试从工作目录下的 potatopeeler.args 文件中读取参数 diff --git a/source/PotatoPeeler/src/main/java/indi/somebottle/utils/NumUtils.java b/source/PotatoPeeler/src/main/java/indi/somebottle/utils/NumUtils.java index 5fec3f0..c5da523 100644 --- a/source/PotatoPeeler/src/main/java/indi/somebottle/utils/NumUtils.java +++ b/source/PotatoPeeler/src/main/java/indi/somebottle/utils/NumUtils.java @@ -80,7 +80,7 @@ public static String bytesToHumanReadable(long bytes) { sb.append(bytes / BYTES_PER_KIB).append(" KiB "); bytes %= BYTES_PER_KIB; } - if (bytes > 0 || sb.isEmpty()) { + if (bytes > 0 || sb.length() == 0) { sb.append(bytes).append(" Bytes"); } return sb.toString().trim(); diff --git a/source/PotatoPeeler/src/main/java/indi/somebottle/utils/RegionUtils.java b/source/PotatoPeeler/src/main/java/indi/somebottle/utils/RegionUtils.java index 03e1b3f..e019906 100644 --- a/source/PotatoPeeler/src/main/java/indi/somebottle/utils/RegionUtils.java +++ b/source/PotatoPeeler/src/main/java/indi/somebottle/utils/RegionUtils.java @@ -89,7 +89,6 @@ public static Region readRegion(File regionFile) throws RegionPosNotFoundExcepti * 但是 wiki 里是:x 先递增。 * SomeBottle 2024.8.5 */ - // TODO:重新测试 forceloaded 区块的保留 for (int z = 0; z < 32; z++) { for (int x = 0; x < 32; x++) { // 先读取距离文件起点的偏移扇区数目