9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Cleanup & fix version fetcher

This commit is contained in:
Dreeam
2025-05-28 01:11:22 +08:00
parent 2815224ed9
commit 0a650c3c20
4 changed files with 22 additions and 16 deletions

View File

@@ -220,7 +220,7 @@ index 94a9ed024d3859793618152ea559a168bbcbb5e2..e60008693e017bec1b4eb49c84be3898
-<http://www.gnu.org/philosophy/why-not-lgpl.html>. -<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+<https://www.gnu.org/philosophy/why-not-lgpl.html>. +<https://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index d0554ed6631535815e5932930911e3fe1dee8710..8f42fba5615c7e1bda4c27334e39a8e3e434db81 100644 index d0554ed6631535815e5932930911e3fe1dee8710..4608f94a2cc98e397aed41fa5c65749bdbe92ce7 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java --- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -9,6 +9,7 @@ import com.google.gson.JsonObject; @@ -9,6 +9,7 @@ import com.google.gson.JsonObject;
@@ -239,7 +239,7 @@ index d0554ed6631535815e5932930911e3fe1dee8710..8f42fba5615c7e1bda4c27334e39a8e3
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
@@ -30,58 +32,35 @@ import org.slf4j.Logger; @@ -30,58 +32,34 @@ import org.slf4j.Logger;
import static net.kyori.adventure.text.Component.text; import static net.kyori.adventure.text.Component.text;
import static net.kyori.adventure.text.format.TextColor.color; import static net.kyori.adventure.text.format.TextColor.color;
@@ -261,7 +261,6 @@ index d0554ed6631535815e5932930911e3fe1dee8710..8f42fba5615c7e1bda4c27334e39a8e3
- return 720000; - return 720000;
+ public PaperVersionFetcher() { + public PaperVersionFetcher() {
+ super( + super(
+ "main",
+ "https://papermc.io/downloads/paper", + "https://papermc.io/downloads/paper",
+ "PaperMC", + "PaperMC",
+ "Paper", + "Paper",
@@ -319,7 +318,7 @@ index d0554ed6631535815e5932930911e3fe1dee8710..8f42fba5615c7e1bda4c27334e39a8e3
private static int fetchDistanceFromSiteApi(final ServerBuildInfo build, final int jenkinsBuild) { private static int fetchDistanceFromSiteApi(final ServerBuildInfo build, final int jenkinsBuild) {
try { try {
@@ -105,42 +84,4 @@ public class PaperVersionFetcher implements VersionFetcher { @@ -105,42 +83,4 @@ public class PaperVersionFetcher implements VersionFetcher {
return DISTANCE_ERROR; return DISTANCE_ERROR;
} }
} }
@@ -415,6 +414,19 @@ index 790bad0494454ca12ee152e3de6da3da634d9b20..5b844d2fea387f2cb655169f458ec0ca
} }
@Override @Override
diff --git a/src/main/java/io/papermc/paper/command/PaperVersionCommand.java b/src/main/java/io/papermc/paper/command/PaperVersionCommand.java
index a7d1a959af6a810c0ce6d5baa08e4429e14d4f5b..3a64b6845b1175bee2c0e4bc919eb5395657a28a 100644
--- a/src/main/java/io/papermc/paper/command/PaperVersionCommand.java
+++ b/src/main/java/io/papermc/paper/command/PaperVersionCommand.java
@@ -45,7 +45,7 @@ public class PaperVersionCommand {
private static final Component FAILED_TO_FETCH = Component.text("Could not fetch version information!", NamedTextColor.RED);
private static final Component FETCHING = Component.text("Checking version, please wait...", NamedTextColor.WHITE, TextDecoration.ITALIC);
- private final VersionFetcher versionFetcher = new PaperVersionFetcher();
+ public static final VersionFetcher versionFetcher = new org.dreeam.leaf.version.LeafVersionFetcher(); // Leaf - Rebrand
private CompletableFuture<ComputedVersion> computedVersion = CompletableFuture.completedFuture(new ComputedVersion(Component.empty(), -1)); // Precompute-- someday move that stuff out of bukkit
public static LiteralCommandNode<CommandSourceStack> create() {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 1354ccfbf525e5e64483ac5f443cc2325ba63850..f6f787db016f4d1ac14648ebf2b8e162a3e85962 100644 index 1354ccfbf525e5e64483ac5f443cc2325ba63850..f6f787db016f4d1ac14648ebf2b8e162a3e85962 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -429,7 +441,7 @@ index 1354ccfbf525e5e64483ac5f443cc2325ba63850..f6f787db016f4d1ac14648ebf2b8e162
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code) // (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index a287ad5cce532229f2a514956d34a9358175bc45..d705eae9da291b7d3095994bc4baa7a2c570ddeb 100644 index a287ad5cce532229f2a514956d34a9358175bc45..05823a2865565446a100e161ca3a44c972868ea7 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -485,7 +485,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -485,7 +485,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -437,7 +449,7 @@ index a287ad5cce532229f2a514956d34a9358175bc45..d705eae9da291b7d3095994bc4baa7a2
@Override @Override
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
- return new com.destroystokyo.paper.PaperVersionFetcher(); - return new com.destroystokyo.paper.PaperVersionFetcher();
+ return new org.dreeam.leaf.version.LeafVersionFetcher(); // Leaf - Rebrand + return io.papermc.paper.command.PaperVersionCommand.versionFetcher; // Leaf - Rebrand
} }
@Override @Override

View File

@@ -6,9 +6,8 @@ public class LeafVersionFetcher extends AbstractPaperVersionFetcher {
public LeafVersionFetcher() { public LeafVersionFetcher() {
super( super(
"ver/1.21.5", "https://www.leafmc.one/download",
"https://github.com/Winds-Studio/Leaf", "Winds Studio",
"Winds-Studio",
"Leaf", "Leaf",
"Winds-Studio", "Winds-Studio",
"Leaf" "Leaf"

View File

@@ -5,7 +5,6 @@ package org.galemc.gale.version;
import com.destroystokyo.paper.PaperVersionFetcher; import com.destroystokyo.paper.PaperVersionFetcher;
import com.destroystokyo.paper.VersionHistoryManager; import com.destroystokyo.paper.VersionHistoryManager;
import com.destroystokyo.paper.util.VersionFetcher; import com.destroystokyo.paper.util.VersionFetcher;
import com.google.common.base.Charsets;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;
@@ -41,18 +40,15 @@ public abstract class AbstractPaperVersionFetcher implements VersionFetcher {
protected static final Logger LOGGER = LogUtils.getClassLogger(); protected static final Logger LOGGER = LogUtils.getClassLogger();
protected static final int DISTANCE_ERROR = -1; protected static final int DISTANCE_ERROR = -1;
protected static final int DISTANCE_UNKNOWN = -2; protected static final int DISTANCE_UNKNOWN = -2;
protected static final ServerBuildInfo BUILD_INFO = ServerBuildInfo.buildInfo();
// Gale start - branding changes - version fetcher // Gale start - branding changes - version fetcher
protected final String gitHubBranchName;
protected final String downloadPage; protected final String downloadPage;
protected final String organizationDisplayName; protected final String organizationDisplayName;
protected final String projectDisplayName; protected final String projectDisplayName;
protected final String gitHubOrganizationName; protected final String gitHubOrganizationName;
protected final String gitHubRepoName; protected final String gitHubRepoName;
protected AbstractPaperVersionFetcher(String githubBranchName, String downloadPage, String organizationDisplayName, String projectDisplayName, String gitHubOrganizationName, String gitHubRepoName) { protected AbstractPaperVersionFetcher(String downloadPage, String organizationDisplayName, String projectDisplayName, String gitHubOrganizationName, String gitHubRepoName) {
this.gitHubBranchName = githubBranchName;
this.downloadPage = downloadPage; this.downloadPage = downloadPage;
this.organizationDisplayName = organizationDisplayName; this.organizationDisplayName = organizationDisplayName;
this.projectDisplayName = projectDisplayName; this.projectDisplayName = projectDisplayName;
@@ -70,7 +66,7 @@ public abstract class AbstractPaperVersionFetcher implements VersionFetcher {
public @NotNull Component getVersionMessage() { public @NotNull Component getVersionMessage() {
final Component updateMessage; final Component updateMessage;
final ServerBuildInfo build = ServerBuildInfo.buildInfo(); final ServerBuildInfo build = ServerBuildInfo.buildInfo();
if (build.buildNumber().isEmpty() && build.gitCommit().isEmpty()) { if (build.buildNumber().isEmpty() || build.gitCommit().isEmpty()) { // Gale - branding changes - version fetcher
updateMessage = text("You are running a development version without access to version information", color(0xFF5300)); updateMessage = text("You are running a development version without access to version information", color(0xFF5300));
} else { } else {
updateMessage = getUpdateStatusMessage(this.gitHubOrganizationName + "/" + this.gitHubRepoName, build); // Gale - branding changes - version fetcher updateMessage = getUpdateStatusMessage(this.gitHubOrganizationName + "/" + this.gitHubRepoName, build); // Gale - branding changes - version fetcher

View File

@@ -6,7 +6,6 @@ public class GaleVersionFetcher extends AbstractPaperVersionFetcher {
public GaleVersionFetcher() { public GaleVersionFetcher() {
super( super(
"ver/1.21.4",
"https://github.com/Dreeam-qwq/Gale", "https://github.com/Dreeam-qwq/Gale",
"GaleMC", "GaleMC",
"Gale", "Gale",