mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-26 01:32:02 -07:00
Add download link to the /version command (#6482)
* Add download link to /version command * Change colors
This commit is contained in:
@@ -17,6 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import com.google.common.io.Resources;
|
||||
+import com.google.gson.*;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.event.ClickEvent;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+
|
||||
+import javax.annotation.Nonnull;
|
||||
@@ -29,6 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+public class PaperVersionFetcher implements VersionFetcher {
|
||||
+ private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end
|
||||
+ private static final String GITHUB_BRANCH_NAME = "master";
|
||||
+ private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
|
||||
+ private static @Nullable String mcVer;
|
||||
+
|
||||
+ @Override
|
||||
@@ -77,7 +79,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ case -2:
|
||||
+ return Component.text("Unknown version", NamedTextColor.YELLOW);
|
||||
+ default:
|
||||
+ return Component.text("You are " + distance + " version(s) behind", NamedTextColor.YELLOW);
|
||||
+ return Component.text("You are " + distance + " version(s) behind", NamedTextColor.YELLOW)
|
||||
+ .append(Component.newline())
|
||||
+ .append(Component.text("Download the new version at: ")
|
||||
+ .append(Component.text(DOWNLOAD_PAGE, NamedTextColor.GOLD)
|
||||
+ .hoverEvent(Component.text("Click to open", NamedTextColor.WHITE))
|
||||
+ .clickEvent(ClickEvent.openUrl(DOWNLOAD_PAGE))));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
Reference in New Issue
Block a user