mirror of
https://github.com/PaperMC/Folia.git
synced 2024-12-02 13:43:31 +01:00
388cdacd1b
Most significant changes are to portal/teleport logic, there may be some bugs there. Not really concerned about the passenger teleport, as Folia had already added support for that. Not sure how the spark changes are going to work.
83 lines
4.8 KiB
Diff
83 lines
4.8 KiB
Diff
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
|
|
index d3b3a8baca013909fa9c6204d964d7d7efeb2719..fb7c6621e2805f4339c255f6c2e02c55ff4c502e 100644
|
|
--- a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
|
|
+++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
|
|
@@ -64,6 +64,7 @@ public class PaperPluginMeta implements PluginMeta {
|
|
private PermissionConfiguration permissionConfiguration = new PermissionConfiguration(PermissionDefault.OP, List.of());
|
|
@Required
|
|
private ApiVersion apiVersion;
|
|
+ private boolean foliaSupported = false; // Folia
|
|
|
|
private Map<PluginDependencyLifeCycle, Map<String, DependencyConfiguration>> dependencies = new EnumMap<>(PluginDependencyLifeCycle.class);
|
|
|
|
@@ -251,6 +252,13 @@ public class PaperPluginMeta implements PluginMeta {
|
|
return this.apiVersion.getVersionString();
|
|
}
|
|
|
|
+ // 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
|
|
index 0a27b468560ccf4b9588cd12d50c02e442f3024f..6369b13e1fcdbdb25dd9d6e4d3bffdedbee4f739 100644
|
|
--- 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
|
|
public PaperPluginParent build(JarFile file, PaperPluginMeta configuration, Path source) {
|
|
+ // 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());
|
|
PluginProviderContext context = PluginProviderContextImpl.create(configuration, logger, source);
|
|
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
|
|
index 9edf79dffd2836b40d41da4437c18d6145853f89..276461c70d383709d5420f050e5d409dda3dfd6e 100644
|
|
--- 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
|
|
@@ -35,6 +35,11 @@ class SpigotPluginProviderFactory implements PluginTypeFactory<SpigotPluginProvi
|
|
|
|
@Override
|
|
public SpigotPluginProvider build(JarFile file, PluginDescriptionFile configuration, Path source) throws InvalidDescriptionException {
|
|
+ // 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.
|
|
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;
|