Skip to content

Commit

Permalink
Add support for 1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverSchlueter committed Aug 12, 2024
1 parent 4e70d28 commit adf2dfa
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
15 changes: 9 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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
}
}
}
Expand All @@ -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")
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
22 changes: 13 additions & 9 deletions src/main/java/de/oliver/fancyholograms/FancyHolograms.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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");
Expand Down Expand Up @@ -89,14 +88,16 @@ public void onLoad() {
final var adapter = resolveHologramAdapter();

if (adapter == null) {
List<String> 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;
}
Expand All @@ -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
Expand Down Expand Up @@ -221,8 +221,12 @@ public ExecutorService getFileStorageExecutor() {
private @Nullable Function<HologramData, Hologram> 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;
Expand Down Expand Up @@ -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).
Expand Down

0 comments on commit adf2dfa

Please sign in to comment.