2023-03-06 23:02:11 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
|
|
Date: Mon, 6 Mar 2023 13:14:06 -0800
|
|
|
|
Subject: [PATCH] Require plugins to be explicitly marked as Folia supported
|
|
|
|
|
|
|
|
Plugins must add "folia-supported: true" to their plugin.yml
|
|
|
|
otherwise the server will refuse to load them.
|
|
|
|
|
|
|
|
Since Folia is a major breakage for plugins, the vast majority
|
|
|
|
of plugins will not function correctly on Folia. To prevent
|
|
|
|
user confusion from this, we will refuse to load the plugin
|
|
|
|
and provide a log indicating why - which will be much
|
|
|
|
more helpful than some random error log caused by
|
|
|
|
a breakage.
|
|
|
|
|
2023-03-29 23:12:30 +02:00
|
|
|
diff --git a/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java b/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java
|
2024-02-21 03:42:54 +01:00
|
|
|
index bcf91d048d84144f6acf9bfd2095df9ada2e585f..3072f95dc1cafb47c1820dc67c8d24991540fc4a 100644
|
2023-03-29 23:12:30 +02:00
|
|
|
--- a/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java
|
|
|
|
+++ b/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java
|
|
|
|
@@ -200,4 +200,12 @@ public interface PluginMeta {
|
|
|
|
@Nullable
|
|
|
|
String getAPIVersion();
|
|
|
|
|
|
|
|
+ // Folia start - block plugins not marked as supported
|
|
|
|
+ /**
|
|
|
|
+ * Returns whether the plugin has been marked to be compatible with regionised threading as provided
|
|
|
|
+ * by Folia
|
|
|
|
+ */
|
|
|
|
+ public boolean isFoliaSupported();
|
|
|
|
+ // Folia end - block plugins not marked as supported
|
|
|
|
+
|
|
|
|
}
|
2023-03-06 23:02:11 +01:00
|
|
|
diff --git a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
|
2024-06-19 23:42:39 +02:00
|
|
|
index a857e46fa6f0c212db93193e1fdd8b0ea9c33c38..90cd9568363a7532d600b627de605c12a7b816c7 100644
|
2023-03-06 23:02:11 +01:00
|
|
|
--- a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
|
|
|
|
+++ b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
|
2024-06-19 23:42:39 +02:00
|
|
|
@@ -267,6 +267,19 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
|
|
|
|
return this.paperPluginLoader;
|
|
|
|
}
|
|
|
|
// Paper end - plugin loader api
|
2023-03-06 23:02:11 +01:00
|
|
|
+ // Folia start - block plugins not marked as supported
|
2023-03-23 14:55:09 +01:00
|
|
|
+ private String foliaSupported;
|
|
|
|
+ private static final String FOLIA_SUPPORTED_KEY = "folia-supported";
|
2023-03-06 23:02:11 +01:00
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Returns whether the plugin has been marked to be compatible with regionised threading as provided
|
|
|
|
+ * by Folia
|
|
|
|
+ */
|
2023-03-29 23:12:30 +02:00
|
|
|
+ @Override
|
2023-03-06 23:02:11 +01:00
|
|
|
+ public boolean isFoliaSupported() {
|
2023-03-23 14:55:09 +01:00
|
|
|
+ return this.foliaSupported != null && this.foliaSupported.equalsIgnoreCase("true");
|
2023-03-06 23:02:11 +01:00
|
|
|
+ }
|
|
|
|
+ // Folia end - block plugins not marked as supported
|
2023-03-23 14:55:09 +01:00
|
|
|
// Paper start - oh my goddddd
|
|
|
|
/**
|
|
|
|
* Don't use this.
|
2024-06-19 23:42:39 +02:00
|
|
|
@@ -1267,6 +1280,11 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
|
2023-03-06 23:02:11 +01:00
|
|
|
if (map.get("prefix") != null) {
|
|
|
|
prefix = map.get("prefix").toString();
|
|
|
|
}
|
|
|
|
+ // Folia start - block plugins not marked as supported
|
2023-03-23 14:55:09 +01:00
|
|
|
+ if (map.get(FOLIA_SUPPORTED_KEY) != null) {
|
|
|
|
+ foliaSupported = map.get(FOLIA_SUPPORTED_KEY).toString();
|
2023-03-06 23:02:11 +01:00
|
|
|
+ }
|
|
|
|
+ // Folia end - block plugins not marked as supported
|
|
|
|
}
|
|
|
|
|
|
|
|
@NotNull
|
2024-06-19 23:42:39 +02:00
|
|
|
@@ -1343,6 +1361,11 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
|
2023-03-23 14:55:09 +01:00
|
|
|
if (prefix != null) {
|
|
|
|
map.put("prefix", prefix);
|
|
|
|
}
|
|
|
|
+ // Folia start - block plugins not marked as supported
|
|
|
|
+ if (foliaSupported != null) {
|
|
|
|
+ map.put(FOLIA_SUPPORTED_KEY, foliaSupported);
|
|
|
|
+ }
|
|
|
|
+ // Folia end - block plugins not marked as supported
|
|
|
|
|
|
|
|
return map;
|
|
|
|
}
|