mirror of
https://github.com/PaperMC/Folia.git
synced 2024-11-28 13:05:13 +01:00
c7fbdd87d2
Patches applied, but not yet checked compile.
82 lines
4.0 KiB
Diff
82 lines
4.0 KiB
Diff
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.
|
|
|
|
diff --git a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
|
|
index 028805bcdb1d2bb0d11387db165b7376579e5f60..51bc04571f75a4ccf05c3d080531a29fe35817d1 100644
|
|
--- a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
|
|
+++ b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java
|
|
@@ -255,6 +255,20 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
|
|
private Set<PluginAwareness> awareness = ImmutableSet.of();
|
|
private String apiVersion = null;
|
|
private List<String> libraries = ImmutableList.of();
|
|
+
|
|
+ // Folia start - block plugins not marked as supported
|
|
+ private String foliaSupported;
|
|
+ private static final String FOLIA_SUPPORTED_KEY = "folia-supported";
|
|
+
|
|
+ /**
|
|
+ * Returns whether the plugin has been marked to be compatible with regionised threading as provided
|
|
+ * by Folia
|
|
+ */
|
|
+ public boolean isFoliaSupported() {
|
|
+ return this.foliaSupported != null && this.foliaSupported.equalsIgnoreCase("true");
|
|
+ }
|
|
+ // Folia end - block plugins not marked as supported
|
|
+
|
|
// Paper start - oh my goddddd
|
|
/**
|
|
* Don't use this.
|
|
@@ -1238,6 +1252,11 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
|
|
if (map.get("prefix") != null) {
|
|
prefix = map.get("prefix").toString();
|
|
}
|
|
+ // Folia start - block plugins not marked as supported
|
|
+ if (map.get(FOLIA_SUPPORTED_KEY) != null) {
|
|
+ foliaSupported = map.get(FOLIA_SUPPORTED_KEY).toString();
|
|
+ }
|
|
+ // Folia end - block plugins not marked as supported
|
|
}
|
|
|
|
@NotNull
|
|
@@ -1314,6 +1333,11 @@ public final class PluginDescriptionFile implements io.papermc.paper.plugin.conf
|
|
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;
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
index 800f954161886ca4f6332f8e0cbc4d4e8f9cbb74..e0026c938aa369d6d9797852324437456d3c4ed9 100644
|
|
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
@@ -173,6 +173,12 @@ public final class SimplePluginManager implements PluginManager {
|
|
server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': uses the space-character (0x20) in its name");
|
|
continue;
|
|
}
|
|
+ // Folia start - block plugins not marked as supported
|
|
+ if (!description.isFoliaSupported()) {
|
|
+ server.getLogger().log(Level.SEVERE, "Could not load plugin '" + name + "' as it is not marked as supporting Folia!");
|
|
+ continue;
|
|
+ }
|
|
+ // Folia end - block plugins not marked as supported
|
|
} catch (InvalidDescriptionException ex) {
|
|
server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
|
continue;
|