mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 17:07:34 +01:00
Don't show 1.15 plugins as legacy in plugins command (#2755)
* Don't show 1.15 plugins as legacy in plugins command * Use CraftMagicNumbers.SUPPORTED_API
This commit is contained in:
parent
a133980223
commit
ff8a48b9d1
@ -1,27 +1,29 @@
|
||||
From 63b188a23ef7f524c393cd27697de441329502f5 Mon Sep 17 00:00:00 2001
|
||||
From d259c6119a7d3f5dc6297fa6f71d64cd2c574e5d Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Thu, 19 Jul 2018 15:07:02 -0500
|
||||
Date: Thu, 19 Jul 2018 22:07:02 +0200
|
||||
Subject: [PATCH] Add an asterisk to legacy API plugins
|
||||
|
||||
Not here to name and shame, only so server admins can be aware of which
|
||||
plugins have and haven't been updated.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index c0ff133de..b173e2ece 100644
|
||||
index c0ff133d..82106426 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -83,5 +83,9 @@ public interface UnsafeValues {
|
||||
@@ -83,5 +83,11 @@ public interface UnsafeValues {
|
||||
default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
||||
return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
|
||||
}
|
||||
+
|
||||
+ boolean isSupportedApiVersion(String apiVersion);
|
||||
+
|
||||
+ static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
|
||||
+ return !"1.13".equals(plugin.getDescription().getAPIVersion()) && !"1.14".equals(plugin.getDescription().getAPIVersion());
|
||||
+ return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||
index d4e74d292..6cfd9f3c6 100644
|
||||
index d4e74d29..6cfd9f3c 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||
@@ -41,7 +41,14 @@ public class PluginsCommand extends BukkitCommand {
|
||||
@ -41,7 +43,7 @@ index d4e74d292..6cfd9f3c6 100644
|
||||
|
||||
StringBuilder pluginList = new StringBuilder();
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index bc7bf6a35..31a70b294 100644
|
||||
index bc7bf6a3..31a70b29 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -316,7 +316,14 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@ -61,5 +63,5 @@ index bc7bf6a35..31a70b294 100644
|
||||
JavaPlugin jPlugin = (JavaPlugin) plugin;
|
||||
|
||||
--
|
||||
2.21.0
|
||||
2.24.1.windows.2
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 44e4be932907ddf286204247fc0bfd3d84dff770 Mon Sep 17 00:00:00 2001
|
||||
From: BlackHole <black-hole@live.com>
|
||||
Date: Sun, 15 Dec 2019 19:12:39 +0100
|
||||
Subject: [PATCH] Add CraftMagicNumbers.isSupportedApiVersion()
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 21bfdf9e7..ab5c6e92e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -298,6 +298,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
||||
return new com.destroystokyo.paper.PaperVersionFetcher();
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isSupportedApiVersion(String apiVersion) {
|
||||
+ return apiVersion != null && SUPPORTED_API.contains(apiVersion);
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
--
|
||||
2.24.1.windows.2
|
||||
|
Loading…
Reference in New Issue
Block a user