Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
Update version checking patch
Dieser Commit ist enthalten in:
Ursprung
e74ba3a4ec
Commit
9ba61a6dd0
@ -1,42 +1,38 @@
|
||||
From 1b6f451cdbf0bc86645a056a884ec00a666b850c Mon Sep 17 00:00:00 2001
|
||||
From 17906168cc148f5e0159b13415a6c6be73e07475 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <Zbob750@live.com>
|
||||
Date: Sat, 27 Dec 2014 17:17:06 -0600
|
||||
Date: Sun, 28 Dec 2014 16:28:21 -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
|
||||
index b55abdb..61f7443 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 {
|
||||
@@ -185,7 +185,22 @@ 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
|
||||
+ // 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]);
|
||||
@@ -234,7 +253,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
@@ -235,7 +250,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
private static int getDistance(String repo, String hash) {
|
||||
try {
|
||||
BufferedReader reader = Resources.asCharSource(
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren