mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-21 15:59:33 +00:00
Update Paper
This commit is contained in:
@@ -4,4 +4,4 @@ version = 1.18.1-R0.1-SNAPSHOT
|
|||||||
mcVersion = 1.18.1
|
mcVersion = 1.18.1
|
||||||
packageVersion = 1_18_R1
|
packageVersion = 1_18_R1
|
||||||
org.gradle.jvmargs=-Xmx2G
|
org.gradle.jvmargs=-Xmx2G
|
||||||
paperRef=ca523abbddd9e27848d601ea1db0340d5faf78df
|
paperRef=41263d9231f32079f5a08078d87a1fd641dbec3c
|
||||||
|
|||||||
@@ -5,10 +5,35 @@ Subject: [PATCH] Update version fetcher repo
|
|||||||
|
|
||||||
|
|
||||||
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 ece77f5ea4b14bbed7c070131b3251ea86764538..dde1105ede055a17725a4c820ddb3a014f67f145 100644
|
index ece77f5ea4b14bbed7c070131b3251ea86764538..102232306e7ee9922258e38e8a449a92173f074a 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
|
||||||
@@ -31,8 +31,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
@@ -3,16 +3,20 @@ package com.destroystokyo.paper;
|
||||||
|
import com.destroystokyo.paper.util.VersionFetcher;
|
||||||
|
import com.google.common.base.Charsets;
|
||||||
|
import com.google.common.io.Resources;
|
||||||
|
-import com.google.gson.*;
|
||||||
|
+import com.google.gson.Gson;
|
||||||
|
+import com.google.gson.JsonArray;
|
||||||
|
+import com.google.gson.JsonObject;
|
||||||
|
+import com.google.gson.JsonSyntaxException;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
-import net.kyori.adventure.text.event.ClickEvent;
|
||||||
|
+import net.kyori.adventure.text.TextComponent;
|
||||||
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.kyori.adventure.text.format.TextDecoration;
|
||||||
|
-import net.kyori.adventure.text.TextComponent;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
-import java.io.*;
|
||||||
|
+import java.io.BufferedReader;
|
||||||
|
+import java.io.IOException;
|
||||||
|
+import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
@@ -31,8 +35,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Component getVersionMessage(@Nonnull String serverVersion) {
|
public Component getVersionMessage(@Nonnull String serverVersion) {
|
||||||
@@ -19,7 +44,7 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..dde1105ede055a17725a4c820ddb3a01
|
|||||||
final Component history = getHistory();
|
final Component history = getHistory();
|
||||||
|
|
||||||
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
||||||
@@ -56,14 +56,12 @@ public class PaperVersionFetcher implements VersionFetcher {
|
@@ -56,14 +60,12 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||||
|
|
||||||
private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
|
private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
|
||||||
int distance;
|
int distance;
|
||||||
@@ -39,3 +64,17 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..dde1105ede055a17725a4c820ddb3a01
|
|||||||
switch (distance) {
|
switch (distance) {
|
||||||
case -1:
|
case -1:
|
||||||
return Component.text("Error obtaining version information", NamedTextColor.YELLOW);
|
return Component.text("Error obtaining version information", NamedTextColor.YELLOW);
|
||||||
|
@@ -72,12 +74,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||||
|
case -2:
|
||||||
|
return Component.text("Unknown version", NamedTextColor.YELLOW);
|
||||||
|
default:
|
||||||
|
- 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))));
|
||||||
|
+ return Component.text("You are " + distance + " version(s) behind", NamedTextColor.YELLOW); // Leaves - we dont have DOWNLOAD_PAGE now
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user