This commit is contained in:
Tamion 2024-05-01 20:36:13 +02:00 committed by GitHub
commit 632dc74b05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 75 additions and 10 deletions

View File

@ -487,10 +487,10 @@ index 0000000000000000000000000000000000000000..7684e71f802f3d19e5340713b45cc848
+}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..4a34a49f12b106976ba19436f96f74ebb068249c
index 0000000000000000000000000000000000000000..67bd46188c8ba018cbb760f8d41c66017ba4007e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -0,0 +1,311 @@
@@ -0,0 +1,313 @@
+package io.papermc.paper.configuration;
+
+import co.aikar.timings.MinecraftTimings;
@ -512,6 +512,7 @@ index 0000000000000000000000000000000000000000..4a34a49f12b106976ba19436f96f74eb
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"})
+public class GlobalConfiguration extends ConfigurationPart {
@ -791,6 +792,7 @@ index 0000000000000000000000000000000000000000..4a34a49f12b106976ba19436f96f74eb
+ public boolean useDimensionTypeForCustomSpawners = false;
+ public boolean strictAdvancementDimensionCheck = false;
+ public IntOr.Default compressionLevel = IntOr.Default.USE_DEFAULT;
+ public Set<String> requiredPlugins = Set.of();
+ }
+
+ public BlockUpdates blockUpdates;

View File

@ -22,10 +22,10 @@ is actually processed, this is honestly really just exposed for the misnomers or
who just wanna ensure that this won't grow over a specific size if chat gets stupidly active
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 4a34a49f12b106976ba19436f96f74ebb068249c..d12fd313730c44dcec3c73fcd8c99c0c84f46743 100644
index 6b5ea449205603c2b5e1019be03e4618f9e65e15..357487acf2853ba84f0e08955a11401826165e08 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -285,7 +285,18 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -286,7 +286,18 @@ public class GlobalConfiguration extends ConfigurationPart {
@PostProcess
private void postProcess() {

View File

@ -17,10 +17,10 @@ index 522156e1b7578663c426fcaf7e47acb93d030486..4495e1e8930619a0d58745cc55c69a5b
node = loader.load();
this.verifyGlobalConfigVersion(node);
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index d12fd313730c44dcec3c73fcd8c99c0c84f46743..5f59e733c00de9c0f5692b3b3c092a050a9f409f 100644
index 357487acf2853ba84f0e08955a11401826165e08..e322db862ef0b87256486e3610e7b63431786dd3 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -25,6 +25,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -26,6 +26,7 @@ public class GlobalConfiguration extends ConfigurationPart {
private static final Logger LOGGER = LogUtils.getLogger();
static final int CURRENT_VERSION = 29; // (when you change the version, change the comment, so it conflicts on rebases): <insert changes here>
private static GlobalConfiguration instance;

View File

@ -14605,10 +14605,10 @@ index 0000000000000000000000000000000000000000..962d3cae6340fc11607b59355e291629
+
+}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 5f59e733c00de9c0f5692b3b3c092a050a9f409f..b8a89bf8a7a0ef25f00ccc0e84ca64f4524fdc3e 100644
index e322db862ef0b87256486e3610e7b63431786dd3..9d7da100e5e3a88148a7a5ca788952349652e077 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -29,6 +29,45 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -30,6 +30,45 @@ public class GlobalConfiguration extends ConfigurationPart {
public static GlobalConfiguration get() {
return instance;
}
@ -14654,7 +14654,7 @@ index 5f59e733c00de9c0f5692b3b3c092a050a9f409f..b8a89bf8a7a0ef25f00ccc0e84ca64f4
static void set(GlobalConfiguration instance) {
GlobalConfiguration.instance = instance;
}
@@ -130,21 +169,6 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -131,21 +170,6 @@ public class GlobalConfiguration extends ConfigurationPart {
public int incomingPacketThreshold = 300;
}
@ -14676,7 +14676,7 @@ index 5f59e733c00de9c0f5692b3b3c092a050a9f409f..b8a89bf8a7a0ef25f00ccc0e84ca64f4
public UnsupportedSettings unsupportedSettings;
public class UnsupportedSettings extends ConfigurationPart {
@@ -201,7 +225,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -202,7 +226,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@PostProcess
private void postProcess() {

View File

@ -0,0 +1,63 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tamion <70228790+notTamion@users.noreply.github.com>
Date: Sat, 25 Nov 2023 23:15:22 +0100
Subject: [PATCH] Add RequiredPlugins
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
index 3e82ea07ca4194844c5528446e2c4a46ff4acee5..a3c4b162111f6c1485efab383dec916fa7e02ee8 100644
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
@@ -223,6 +223,9 @@ class PaperPluginInstanceManager {
if (!(plugin instanceof JavaPlugin javaPlugin)) {
throw new IllegalArgumentException("Only expects java plugins.");
}
+ if (!this.server.isStopping() && !((org.bukkit.craftbukkit.CraftServer) this.server).isReloadingPlugins && io.papermc.paper.configuration.GlobalConfiguration.get().misc.requiredPlugins.contains(plugin.getName())) {
+ return;
+ }
if (!plugin.isEnabled()) {
return;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 05e304f9fc8d0291fa779da589bd060ef4165b49..683802c34b0a0b1f3524958328646e0f07d66c12 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -304,6 +304,7 @@ public final class CraftServer implements Server {
private boolean overrideAllCommandBlockCommands = false;
public boolean ignoreVanillaPermissions = false;
private final List<CraftPlayer> playerView;
+ public boolean isReloadingPlugins; // Paper - Add RequiredPlugins
public int reloadCount;
private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper
public static Exception excessiveVelEx; // Paper - Velocity warnings
@@ -553,6 +554,14 @@ public final class CraftServer implements Server {
}
if (type == PluginLoadOrder.POSTWORLD) {
+ // Paper start - Add RequiredPlugins
+ List<String> missingPlugins = new ArrayList<>(io.papermc.paper.configuration.GlobalConfiguration.get().misc.requiredPlugins);
+ missingPlugins.removeAll(java.util.Arrays.stream(this.paperPluginManager.getPlugins()).filter(Plugin::isEnabled).map(Plugin::getName).toList());
+ if (!missingPlugins.isEmpty()) {
+ this.getLogger().severe("The following required plugins aren't enabled: " + String.join(", ", missingPlugins) + ". Stopping Server.");
+ this.getServer().stopServer();
+ }
+ // Paper end - Add RequiredPlugins
// Spigot start - Allow vanilla commands to be forced to be the main command
this.setVanillaCommands(true);
this.commandMap.setFallbackCommands();
@@ -1071,6 +1080,7 @@ public final class CraftServer implements Server {
world.spigotConfig.init(); // Spigot
}
+ this.isReloadingPlugins = true; // Paper - Add RequiredPlugins
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
this.pluginManager.clearPlugins();
this.commandMap.clearCommands();
@@ -1112,6 +1122,7 @@ public final class CraftServer implements Server {
this.loadPlugins();
this.enablePlugins(PluginLoadOrder.STARTUP);
this.enablePlugins(PluginLoadOrder.POSTWORLD);
+ this.isReloadingPlugins = false; // Paper - Add RequiredPlugins
this.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.RELOAD));
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins
org.spigotmc.WatchdogThread.hasStarted = true; // Paper - Disable watchdog early timeout on reload