9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-21 15:59:33 +00:00

fix import

This commit is contained in:
violetc
2022-03-09 09:19:31 +00:00
parent 61cfcf5c8e
commit 083458dc3c
9 changed files with 71 additions and 165 deletions

View File

@@ -5,18 +5,12 @@ 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
index ece77f5ea4b14bbed7c070131b3251ea86764538..102232306e7ee9922258e38e8a449a92173f074a 100644
index ece77f5ea4b14bbed7c070131b3251ea86764538..9f6ec8d4880672d4e767959700d4e167db32e0cd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -3,16 +3,20 @@ package com.destroystokyo.paper;
import com.destroystokyo.paper.util.VersionFetcher;
import com.google.common.base.Charsets;
@@ -5,10 +5,9 @@ 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 com.google.gson.*;
import net.kyori.adventure.text.Component;
-import net.kyori.adventure.text.event.ClickEvent;
+import net.kyori.adventure.text.TextComponent;
@@ -26,25 +20,20 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..102232306e7ee9922258e38e8a449a92
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 {
@@ -31,8 +30,10 @@ public class PaperVersionFetcher implements VersionFetcher {
@Nonnull
@Override
public Component getVersionMessage(@Nonnull String serverVersion) {
- String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]");
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
+ // Leaves start - we dont have jenkins setup
+ String[] parts = serverVersion.substring("git-Leaves-".length()).split("[-\\s]");
+ final Component updateMessage = getUpdateStatusMessage("LeavesMC/Leaves", GITHUB_BRANCH_NAME, parts[0]);
+ // Leaves end - we dont have jenkins setup
final Component history = getHistory();
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
@@ -56,14 +60,12 @@ public class PaperVersionFetcher implements VersionFetcher {
@@ -56,14 +57,12 @@ public class PaperVersionFetcher implements VersionFetcher {
private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
int distance;
@@ -64,7 +53,7 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..102232306e7ee9922258e38e8a449a92
switch (distance) {
case -1:
return Component.text("Error obtaining version information", NamedTextColor.YELLOW);
@@ -72,12 +74,7 @@ public class PaperVersionFetcher implements VersionFetcher {
@@ -72,12 +71,7 @@ public class PaperVersionFetcher implements VersionFetcher {
case -2:
return Component.text("Unknown version", NamedTextColor.YELLOW);
default: