mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +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: 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
|
||||
|
||||
|
||||
@ -13,28 +13,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
String version = Bukkit.getVersion();
|
||||
if (version == null) version = "Custom";
|
||||
- if (version.startsWith("git-Spigot-")) {
|
||||
+ // PaperSpigot start - Add PaperSpigot version checking
|
||||
+ // PaperSpigot start
|
||||
+ if (version.startsWith("git-PaperSpigot-")) {
|
||||
+ 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]);
|
||||
+ if (cbVersions == -1 || paperSpigotVersions == -1)
|
||||
+ {
|
||||
+ if (cbVersions == -1 || paperSpigotVersions == -1) {
|
||||
+ setVersionMessage("Error obtaining version information");
|
||||
+ } else
|
||||
+ {
|
||||
+ if (cbVersions == 0 && paperSpigotVersions == 0)
|
||||
+ {
|
||||
+ } else {
|
||||
+ if (cbVersions == 0 && paperSpigotVersions == 0) {
|
||||
+ setVersionMessage("You are running the latest version");
|
||||
+ } else
|
||||
+ {
|
||||
+ } 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 cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' ')));
|
||||
int spigotVersions = getDistance("spigot", parts[0]);
|
||||
@@ -0,0 +0,0 @@ public class VersionCommand extends BukkitCommand {
|
||||
private static int getDistance(String repo, String hash) {
|
||||
|
Loading…
Reference in New Issue
Block a user