9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-19 15:09:24 +00:00
This commit is contained in:
XiaoMoMi
2025-10-14 00:56:38 +08:00
parent f1165cfafe
commit 7d158ae4b1
5 changed files with 70 additions and 64 deletions

View File

@@ -58,17 +58,44 @@ public class VersionHelper {
return updateFuture;
};
private static float version;
private static int version;
private static boolean mojmap;
private static boolean folia;
public static void init(String serverVersion) {
String[] split = serverVersion.split("\\.");
version = Float.parseFloat(split[1] + "." + (split.length == 3 ? split[2] : "0"));
version = parseVersionToInteger(serverVersion);
checkMojMap();
checkFolia();
}
public static int parseVersionToInteger(String versionString) {
int major = 0;
int minor = 0;
int currentNumber = 0;
int part = 0;
for (int i = 0; i < versionString.length(); i++) {
char c = versionString.charAt(i);
if (c >= '0' && c <= '9') {
currentNumber = currentNumber * 10 + (c - '0');
} else if (c == '.') {
if (part == 1) {
major = currentNumber;
}
part++;
currentNumber = 0;
if (part > 2) {
break;
}
}
}
if (part == 1) {
major = currentNumber;
} else if (part == 2) {
minor = currentNumber;
}
return 10000 + major * 100 + minor;
}
private static void checkMojMap() {
// Check if the server is Mojmap
try {
@@ -87,31 +114,31 @@ public class VersionHelper {
}
public static boolean isVersionNewerThan1_19() {
return version >= 19;
return version >= 11900;
}
public static boolean isVersionNewerThan1_19_4() {
return version >= 19.39;
return version >= 11904;
}
public static boolean isVersionNewerThan1_20_2() {
return version >= 20.19;
return version >= 12002;
}
public static boolean isVersionNewerThan1_20_5() {
return version >= 20.49;
return version >= 12005;
}
public static boolean isVersionNewerThan1_21_3() {
return version >= 21.29;
return version >= 12103;
}
public static boolean isVersionNewerThan1_21_4() {
return version >= 21.39;
return version >= 12104;
}
public static boolean isVersionNewerThan1_21_5() {
return version >= 21.49;
return version >= 12105;
}
public static boolean isFolia() {

View File

@@ -1,9 +1,6 @@
import org.gradle.process.internal.ExecException
import java.io.ByteArrayOutputStream
plugins {
id("java")
id("com.gradleup.shadow") version "9.0.0-beta6"
id("com.gradleup.shadow") version "9.2.2"
}
val git : String = versionBanner()
@@ -28,35 +25,17 @@ subprojects {
filesMatching(arrayListOf("*.yml", "*/*.yml")) {
expand(
Pair("project_version", rootProject.properties["project_version"]),
Pair("config_version", rootProject.properties["config_version"])
Pair("project_version", rootProject.properties["project_version"]!!),
Pair("config_version", rootProject.properties["config_version"]!!)
)
}
}
}
fun versionBanner(): String {
val os = ByteArrayOutputStream()
try {
project.exec {
commandLine = "git rev-parse --short=8 HEAD".split(" ")
standardOutput = os
}
} catch (e: ExecException) {
return "Unknown"
}
return String(os.toByteArray()).trim()
}
fun versionBanner() = project.providers.exec {
commandLine("git", "rev-parse", "--short=8", "HEAD")
}.standardOutput.asText.map { it.trim() }.getOrElse("Unknown")
fun builder(): String {
val os = ByteArrayOutputStream()
try {
project.exec {
commandLine = "git config user.name".split(" ")
standardOutput = os
}
} catch (e: ExecException) {
return "Unknown"
}
return String(os.toByteArray()).trim()
}
fun builder() = project.providers.exec {
commandLine("git", "config", "user.name")
}.standardOutput.asText.map { it.trim() }.getOrElse("Unknown")

View File

@@ -48,7 +48,7 @@ public abstract class BukkitItemFactory extends ItemFactory<CustomFishingPlugin,
"1.21", "1.21.1", "1.21.2", "1.21.3", "1.21.4" -> {
return new ComponentItemFactory(plugin);
}
case "1.21.5", "1.21.6", "1.21.7", "1.21.8" -> {
case "1.21.5", "1.21.6", "1.21.7", "1.21.8", "1.21.9", "1.21.10" -> {
return new ComponentItemFactory1_21_5(plugin);
}
default -> throw new IllegalStateException("Unsupported server version: " + plugin.getServerVersion());

View File

@@ -1,6 +1,6 @@
# Project settings
# Rule: [major update].[feature update].[bug fix]
project_version=2.3.15
project_version=2.3.16
config_version=38
project_group=net.momirealms
@@ -8,41 +8,41 @@ project_group=net.momirealms
lang=en,zh_cn,uk,ru,pt_br,fr
# Dependency settings
sparrow_heart_version=0.59
sparrow_heart_version=0.60
paper_version=1.20.4
jetbrains_annotations_version=26.0.2
slf4j_version=2.0.17
log4j_version=2.24.3
gson_version=2.11.0
asm_version=9.8
asm_commons_version=9.8
log4j_version=2.25.2
gson_version=2.13.2
asm_version=9.9
asm_commons_version=9.9
jar_relocator_version=1.7
h2_driver_version=2.3.232
sqlite_driver_version=3.49.1.0
adventure_bundle_version=4.23.0
adventure_platform_version=4.4.0
h2_driver_version=2.4.240
sqlite_driver_version=3.50.3.0
adventure_bundle_version=4.25.0
adventure_platform_version=4.4.1
cloud_core_version=2.0.0
cloud_services_version=2.0.0
cloud_brigadier_version=2.0.0-beta.11
cloud_bukkit_version=2.0.0-beta.11
cloud_paper_version=2.0.0-beta.11
cloud_minecraft_extras_version=2.0.0-beta.11
cloud_brigadier_version=2.0.0-beta.13
cloud_bukkit_version=2.0.0-beta.13
cloud_paper_version=2.0.0-beta.13
cloud_minecraft_extras_version=2.0.0-beta.13
boosted_yaml_version=1.3.7
mojang_brigadier_version=1.0.18
mongodb_driver_version=5.4.0
mariadb_driver_version=3.5.3
mysql_driver_version=9.2.0
hikari_version=5.1.0
mongodb_driver_version=5.6.1
mariadb_driver_version=3.5.6
mysql_driver_version=9.4.0
hikari_version=7.0.2
commons_pool_version=2.12.1
bstats_version=3.1.0
geantyref_version=1.3.16
caffeine_version=3.2.0
rtag_version=1.5.11
jedis_version=5.2.0
caffeine_version=3.2.2
rtag_version=1.5.13
jedis_version=7.0.0
exp4j_version=0.4.8
placeholder_api_version=2.11.6
vault_version=1.7
guava_version=33.3.1-jre
guava_version=33.5.0-jre
lz4_version=1.8.0
# Proxy settings

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists