diff --git a/Spigot-API-Patches/0008-Check-PaperSpigot-versions.patch b/Spigot-API-Patches/0008-Check-PaperSpigot-versions.patch new file mode 100644 index 0000000000..2ebfb508e5 --- /dev/null +++ b/Spigot-API-Patches/0008-Check-PaperSpigot-versions.patch @@ -0,0 +1,50 @@ +From 1b6f451cdbf0bc86645a056a884ec00a666b850c Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Sat, 27 Dec 2014 17:17:06 -0600 +Subject: [PATCH] Check PaperSpigot versions + + +diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java +index 7062946..9d988b0 100644 +--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java ++++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java +@@ -185,7 +185,26 @@ public class VersionCommand extends BukkitCommand { + private void obtainVersion() { + String version = Bukkit.getVersion(); + if (version == null) version = "Custom"; +- if (version.startsWith("git-Spigot-")) { ++ // PaperSpigot start - Add PaperSpigot version checking ++ if (version.startsWith("git-PaperSpigot-")) { ++ String[] parts = version.substring("git-PaperSpigot-".length()).split("-"); ++ int cbVersions = getDistance("craftbukkit", parts[1]); ++ int paperSpigotVersions = getDistance("paperspigot", parts[0]); ++ if (cbVersions == -1 || paperSpigotVersions == -1) ++ { ++ setVersionMessage("Error obtaining version information"); ++ } else ++ { ++ if (cbVersions == 0 && paperSpigotVersions == 0) ++ { ++ setVersionMessage("You are running the latest version"); ++ } else ++ { ++ setVersionMessage("You are " + (cbVersions + paperSpigotVersions) + " version(s) behind"); ++ } ++ } ++ } else if (version.startsWith("git-Spigot-")) { ++ // PaperSpigot end + String[] parts = version.substring("git-Spigot-".length()).split("-"); + int cbVersions = getDistance("craftbukkit", parts[1]); + int spigotVersions = getDistance("spigot", parts[0]); +@@ -234,7 +253,7 @@ public class VersionCommand extends BukkitCommand { + private static int getDistance(String repo, String hash) { + try { + BufferedReader reader = Resources.asCharSource( +- new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/SPIGOT/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"), ++ new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/PAPER/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"), // PaperSpigot + Charsets.UTF_8 + ).openBufferedStream(); + try { +-- +1.9.5.msysgit.0 +