2023-03-29 23:12:30 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
|
|
|
Date: Wed, 29 Mar 2023 16:50:14 -0400
|
|
|
|
Subject: [PATCH] Require plugins to be explicitly marked as Folia supported
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
|
2024-05-10 06:07:34 +02:00
|
|
|
index c685871155c8dff1d57ff151d7a5ec70350e5390..e582b988071f56c3e44de75460cf83db140339a3 100644
|
2023-03-29 23:12:30 +02:00
|
|
|
--- a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
|
|
|
|
+++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
|
2024-05-10 06:07:34 +02:00
|
|
|
@@ -64,6 +64,7 @@ public class PaperPluginMeta implements PluginMeta {
|
|
|
|
private PermissionConfiguration permissionConfiguration = new PermissionConfiguration(PermissionDefault.OP, List.of());
|
2023-03-29 23:12:30 +02:00
|
|
|
@Required
|
2024-05-10 06:07:34 +02:00
|
|
|
private ApiVersion apiVersion;
|
2023-03-29 23:12:30 +02:00
|
|
|
+ private boolean foliaSupported = false; // Folia
|
|
|
|
|
2023-06-08 00:32:55 +02:00
|
|
|
private Map<PluginDependencyLifeCycle, Map<String, DependencyConfiguration>> dependencies = new EnumMap<>(PluginDependencyLifeCycle.class);
|
2023-03-29 23:12:30 +02:00
|
|
|
|
2024-05-10 06:07:34 +02:00
|
|
|
@@ -251,6 +252,13 @@ public class PaperPluginMeta implements PluginMeta {
|
|
|
|
return this.apiVersion.getVersionString();
|
2023-03-29 23:12:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Folia start
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isFoliaSupported() {
|
|
|
|
+ return this.foliaSupported;
|
|
|
|
+ }
|
|
|
|
+ // Folia end
|
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public @NotNull List<String> getProvidedPlugins() {
|
|
|
|
return this.provides;
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java
|
2024-02-05 20:41:39 +01:00
|
|
|
index 0a27b468560ccf4b9588cd12d50c02e442f3024f..6369b13e1fcdbdb25dd9d6e4d3bffdedbee4f739 100644
|
2023-03-29 23:12:30 +02:00
|
|
|
--- a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java
|
|
|
|
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java
|
|
|
|
@@ -24,6 +24,11 @@ class PaperPluginProviderFactory implements PluginTypeFactory<PaperPluginParent,
|
|
|
|
|
|
|
|
@Override
|
2024-02-05 20:41:39 +01:00
|
|
|
public PaperPluginParent build(JarFile file, PaperPluginMeta configuration, Path source) {
|
2023-03-29 23:12:30 +02:00
|
|
|
+ // Folia start - block plugins not marked as supported
|
|
|
|
+ if (!configuration.isFoliaSupported()) {
|
|
|
|
+ throw new RuntimeException("Could not load plugin '" + configuration.getDisplayName() + "' as it is not marked as supporting Folia!");
|
|
|
|
+ }
|
|
|
|
+ // Folia end - block plugins not marked as supported
|
|
|
|
Logger jul = PaperPluginLogger.getLogger(configuration);
|
|
|
|
ComponentLogger logger = ComponentLogger.logger(jul.getName());
|
2023-09-07 05:02:39 +02:00
|
|
|
PluginProviderContext context = PluginProviderContextImpl.create(configuration, logger, source);
|
2023-03-29 23:12:30 +02:00
|
|
|
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
|
2024-06-19 23:42:39 +02:00
|
|
|
index 38075b7348ad7ca3cfece2bfae63e0cce827c694..a45235493bfed0e271a3fee1bbf27e62606bf0d3 100644
|
2023-03-29 23:12:30 +02:00
|
|
|
--- a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
|
|
|
|
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
|
2024-06-19 23:42:39 +02:00
|
|
|
@@ -35,6 +35,11 @@ class SpigotPluginProviderFactory implements PluginTypeFactory<SpigotPluginProvi
|
2023-03-29 23:12:30 +02:00
|
|
|
|
|
|
|
@Override
|
2024-02-05 20:41:39 +01:00
|
|
|
public SpigotPluginProvider build(JarFile file, PluginDescriptionFile configuration, Path source) throws InvalidDescriptionException {
|
2023-03-29 23:12:30 +02:00
|
|
|
+ // Folia start - block plugins not marked as supported
|
|
|
|
+ if (!configuration.isFoliaSupported()) {
|
|
|
|
+ throw new RuntimeException("Could not load plugin '" + configuration.getDisplayName() + "' as it is not marked as supporting Folia!");
|
|
|
|
+ }
|
|
|
|
+ // Folia end - block plugins not marked as supported
|
|
|
|
// Copied from SimplePluginManager#loadPlugins
|
|
|
|
// Spigot doesn't validate the name when the config is created, and instead when the plugin is loaded.
|
|
|
|
// Paper plugin configuration will do these checks in config serializer instead of when this is created.
|
2023-03-29 23:33:48 +02:00
|
|
|
diff --git a/src/test/java/io/papermc/paper/plugin/TestPluginMeta.java b/src/test/java/io/papermc/paper/plugin/TestPluginMeta.java
|
|
|
|
index ba271c35eb2804f94cfc893bf94affb9ae13d3ba..db9285c2ff0c805f5d9564b6e8520c33ea5bb65a 100644
|
|
|
|
--- a/src/test/java/io/papermc/paper/plugin/TestPluginMeta.java
|
|
|
|
+++ b/src/test/java/io/papermc/paper/plugin/TestPluginMeta.java
|
|
|
|
@@ -20,6 +20,13 @@ public class TestPluginMeta implements PluginMeta {
|
|
|
|
this.identifier = identifier;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Folia start - region threading
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isFoliaSupported() {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ // Folia end - region threading
|
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public @NotNull String getName() {
|
|
|
|
return this.identifier;
|