mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-19 14:51:27 +01:00
Update version checking patch
This commit is contained in:
parent
fe8a0e7ce3
commit
d80ee4a413
@ -1,6 +1,6 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||||
Date: Sat, 27 Dec 2014 17:17:06 -0600
|
Date: Sun, 28 Dec 2014 16:28:21 -0600
|
||||||
Subject: [PATCH] Check PaperSpigot versions
|
Subject: [PATCH] Check PaperSpigot versions
|
||||||
|
|
||||||
|
|
||||||
@ -13,28 +13,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
String version = Bukkit.getVersion();
|
String version = Bukkit.getVersion();
|
||||||
if (version == null) version = "Custom";
|
if (version == null) version = "Custom";
|
||||||
- if (version.startsWith("git-Spigot-")) {
|
- if (version.startsWith("git-Spigot-")) {
|
||||||
+ // PaperSpigot start - Add PaperSpigot version checking
|
+ // PaperSpigot start
|
||||||
+ if (version.startsWith("git-PaperSpigot-")) {
|
+ if (version.startsWith("git-PaperSpigot-")) {
|
||||||
+ String[] parts = version.substring("git-PaperSpigot-".length()).split("-");
|
+ String[] parts = version.substring("git-PaperSpigot-".length()).split("-");
|
||||||
+ int cbVersions = getDistance("craftbukkit", parts[1]);
|
+ int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' ')));
|
||||||
+ int paperSpigotVersions = getDistance("paperspigot", parts[0]);
|
+ int paperSpigotVersions = getDistance("paperspigot", parts[0]);
|
||||||
+ if (cbVersions == -1 || paperSpigotVersions == -1)
|
+ if (cbVersions == -1 || paperSpigotVersions == -1) {
|
||||||
+ {
|
|
||||||
+ setVersionMessage("Error obtaining version information");
|
+ setVersionMessage("Error obtaining version information");
|
||||||
+ } else
|
+ } else {
|
||||||
+ {
|
+ if (cbVersions == 0 && paperSpigotVersions == 0) {
|
||||||
+ if (cbVersions == 0 && paperSpigotVersions == 0)
|
|
||||||
+ {
|
|
||||||
+ setVersionMessage("You are running the latest version");
|
+ setVersionMessage("You are running the latest version");
|
||||||
+ } else
|
+ } else {
|
||||||
+ {
|
|
||||||
+ setVersionMessage("You are " + (cbVersions + paperSpigotVersions) + " version(s) behind");
|
+ setVersionMessage("You are " + (cbVersions + paperSpigotVersions) + " version(s) behind");
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ } else if (version.startsWith("git-Spigot-")) {
|
+ } else if (version.startsWith("git-Spigot-")) {
|
||||||
+ // PaperSpigot end
|
+ // PaperSpigot end
|
||||||
String[] parts = version.substring("git-Spigot-".length()).split("-");
|
String[] parts = version.substring("git-Spigot-".length()).split("-");
|
||||||
int cbVersions = getDistance("craftbukkit", parts[1]);
|
int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' ')));
|
||||||
int spigotVersions = getDistance("spigot", parts[0]);
|
int spigotVersions = getDistance("spigot", parts[0]);
|
||||||
@@ -0,0 +0,0 @@ public class VersionCommand extends BukkitCommand {
|
@@ -0,0 +0,0 @@ public class VersionCommand extends BukkitCommand {
|
||||||
private static int getDistance(String repo, String hash) {
|
private static int getDistance(String repo, String hash) {
|
||||||
|
Loading…
Reference in New Issue
Block a user