From adf2dfaae8148ce07cd05431855e47bc304e88b1 Mon Sep 17 00:00:00 2001 From: OliverSchlueter Date: Mon, 12 Aug 2024 14:05:18 +0200 Subject: [PATCH] Add support for 1.21.1 --- README.md | 2 +- build.gradle.kts | 15 ++++++++----- gradle.properties | 4 ++-- .../oliver/fancyholograms/FancyHolograms.java | 22 +++++++++++-------- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 6f8a4e5d..6f748c79 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Check out **[images section](#images)** down below. ## Installation -Paper **1.19.4** - **1.21** with **Java 21** (or higher) is required. Plugin should also work on **Paper** forks. +Paper **1.19.4** - **1.21.1** with **Java 21** (or higher) is required. Plugin should also work on **Paper** forks. **Spigot** is **not** supported. diff --git a/build.gradle.kts b/build.gradle.kts index a98c4c97..5fe8015a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,6 +16,9 @@ plugins { runPaper.folia.registerTask() +val supportedVersions = + listOf("1.19.4", "1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4", "1.20.5", "1.20.6", "1.21", "1.21.1") + allprojects { group = "de.oliver" val buildId = System.getenv("BUILD_ID") @@ -90,9 +93,10 @@ tasks { downloadPlugins { modrinth("fancynpcs", "2.2.1") - hangar("ViaVersion", "5.0.1") - hangar("ViaBackwards", "5.0.1") -// hangar("PlaceholderAPI", "2.11.6") + hangar("ViaVersion", "5.0.3") + hangar("ViaBackwards", "5.0.3") + modrinth("multiverse-core", "4.3.11") + hangar("PlaceholderAPI", "2.11.6") } } @@ -203,8 +207,7 @@ hangarPublish { platforms { paper { jar = tasks.shadowJar.flatMap { it.archiveFile } - platformVersions = - listOf("1.19.4", "1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4", "1.20.5", "1.20.6", "1.21") + platformVersions = supportedVersions } } } @@ -216,6 +219,6 @@ modrinth { versionNumber.set(project.version.toString()) versionType.set("alpha") uploadFile.set(file("build/libs/${project.name}-${project.version}.jar")) - gameVersions.addAll(listOf("1.19.4", "1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4", "1.20.5", "1.20.6", "1.21")) + gameVersions.addAll(supportedVersions) loaders.add("paper") } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index c242cb63..32ae02a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ -minecraftVersion=1.21 +minecraftVersion=1.21.1 fancyNpcsVersion=2.2.1 fancyLibVersion=1.0.31 -fancySitulaVersion=0.0.5 +fancySitulaVersion=0.0.6 viaversionVersion=5.0.1 chatcolorhandlerVersion=v2.5.3 \ No newline at end of file diff --git a/src/main/java/de/oliver/fancyholograms/FancyHolograms.java b/src/main/java/de/oliver/fancyholograms/FancyHolograms.java index 0c5bbc54..ea0b28ee 100644 --- a/src/main/java/de/oliver/fancyholograms/FancyHolograms.java +++ b/src/main/java/de/oliver/fancyholograms/FancyHolograms.java @@ -24,6 +24,7 @@ import de.oliver.fancylib.serverSoftware.schedulers.FoliaScheduler; import de.oliver.fancylib.versionFetcher.MasterVersionFetcher; import de.oliver.fancylib.versionFetcher.VersionFetcher; +import de.oliver.fancysitula.api.utils.ServerVersion; import org.apache.maven.artifact.versioning.ComparableVersion; import org.bukkit.Bukkit; import org.bukkit.command.Command; @@ -32,9 +33,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Arrays; -import java.util.Collection; -import java.util.Objects; +import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; @@ -45,7 +44,7 @@ public final class FancyHolograms extends JavaPlugin implements FancyHologramsPlugin { - public static final String[] SUPPORTED_VERSIONS = {"1.19.4", "1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4", "1.20.5", "1.20.6", "1.21"}; + public static final String[] SUPPORTED_VERSIONS = {"1.19.4", "1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4"}; private static @Nullable FancyHolograms INSTANCE; private final VersionFetcher versionFetcher = new MasterVersionFetcher("FancyHolograms"); @@ -89,14 +88,16 @@ public void onLoad() { final var adapter = resolveHologramAdapter(); if (adapter == null) { + List supportedVersions = new ArrayList<>(Arrays.asList(SUPPORTED_VERSIONS)); + supportedVersions.addAll(ServerVersion.getSupportedVersions()); + getLogger().warning(""" - -------------------------------------------------- Unsupported minecraft server version. Please update the server to one of (%s). Disabling the FancyHolograms plugin. -------------------------------------------------- - """.formatted(String.join(" / ", SUPPORTED_VERSIONS))); + """.formatted(String.join(" / ", supportedVersions))); Bukkit.getPluginManager().disablePlugin(this); return; } @@ -112,7 +113,6 @@ public void onEnable() { if (!ServerSoftware.isPaper()) { getLogger().warning(""" - -------------------------------------------------- It is recommended to use Paper as server software. Because you are not using paper, the plugin @@ -221,8 +221,12 @@ public ExecutorService getFileStorageExecutor() { private @Nullable Function resolveHologramAdapter() { final var version = Bukkit.getMinecraftVersion(); + // check if the server version is supported by FancySitula + if (ServerVersion.isVersionSupported(version)) { + return Hologram1_20_6::new; + } + return switch (version) { - case "1.20.5", "1.20.6", "1.21" -> Hologram1_20_6::new; // implemented by FancySitula case "1.20.3", "1.20.4" -> Hologram1_20_4::new; case "1.20.2" -> Hologram1_20_2::new; case "1.20", "1.20.1" -> Hologram1_20_1::new; @@ -263,7 +267,7 @@ private void checkForNewerVersion() { } getLogger().warning(""" - + ------------------------------------------------------- You are not using the latest version the FancyHolograms plugin. Please update to the newest version (%s).