-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a77661b
commit 8098084
Showing
1 changed file
with
131 additions
and
0 deletions.
There are no files selected for viewing
131 changes: 131 additions & 0 deletions
131
patches/server/0019-configurable-remapped-directory.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Jendrik Eggers <[email protected]> | ||
Date: Fri, 11 Oct 2024 15:23:10 +0200 | ||
Subject: [PATCH] configurable remapped directory | ||
|
||
|
||
diff --git a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java | ||
index 70413fddd23ca1165cb5090cce4fddcb1bbca93f..eb0475eaa9b01d79ecc90d077fdce1ff61164c6d 100644 | ||
--- a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java | ||
+++ b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java | ||
@@ -32,12 +32,12 @@ public class PluginInitializerManager { | ||
private final Path updateDirectory; | ||
public final io.papermc.paper.pluginremap.@org.checkerframework.checker.nullness.qual.MonotonicNonNull PluginRemapper pluginRemapper; // Paper | ||
|
||
- PluginInitializerManager(final Path pluginDirectory, final Path updateDirectory) { | ||
+ PluginInitializerManager(final Path pluginDirectory, final Path updateDirectory, final Path remappedDirectory) { // Cheetah - configurable remapped directory | ||
this.pluginDirectory = pluginDirectory; | ||
this.updateDirectory = updateDirectory; | ||
this.pluginRemapper = Boolean.getBoolean("paper.disablePluginRemapping") | ||
? null | ||
- : PluginRemapper.create(pluginDirectory); | ||
+ : PluginRemapper.create(pluginDirectory, remappedDirectory); // Cheetah - configurable remapped directory | ||
LibraryLoader.REMAPPER = this.pluginRemapper == null ? Function.identity() : this.pluginRemapper::remapLibraries; | ||
} | ||
|
||
@@ -46,12 +46,13 @@ public class PluginInitializerManager { | ||
final File configFileLocationBukkit = (File) minecraftOptionSet.valueOf("bukkit-settings"); | ||
|
||
final Path pluginDirectory = ((File) minecraftOptionSet.valueOf("plugins")).toPath(); | ||
+ final Path remappedDirectory = ((File) minecraftOptionSet.valueOf("remapped-directory")).toPath(); // Cheetah - configurable remapped directory | ||
|
||
final YamlConfiguration configuration = PaperConfigurations.loadLegacyConfigFile(configFileLocationBukkit); | ||
|
||
final String updateDirectoryName = configuration.getString("settings.update-folder", "update"); | ||
if (updateDirectoryName.isBlank()) { | ||
- return new PluginInitializerManager(pluginDirectory, null); | ||
+ return new PluginInitializerManager(pluginDirectory, null, remappedDirectory); // Cheetah - configurable remapped directory | ||
} | ||
|
||
final Path resolvedUpdateDirectory = pluginDirectory.resolve(updateDirectoryName); | ||
@@ -61,7 +62,7 @@ public class PluginInitializerManager { | ||
LOGGER.error("Your configured update directory ({}) in bukkit.yml is pointing to a non-directory path. " + | ||
"Auto updating functionality will not work.", resolvedUpdateDirectory); | ||
} | ||
- return new PluginInitializerManager(pluginDirectory, null); | ||
+ return new PluginInitializerManager(pluginDirectory, null, remappedDirectory); // Cheetah - configurable remapped directory | ||
} | ||
|
||
boolean isSameFile; | ||
@@ -70,7 +71,7 @@ public class PluginInitializerManager { | ||
} catch (final IOException e) { | ||
LOGGER.error("Misconfigured update directory!"); | ||
LOGGER.error("Failed to compare update/plugin directory", e); | ||
- return new PluginInitializerManager(pluginDirectory, null); | ||
+ return new PluginInitializerManager(pluginDirectory, null, remappedDirectory); // Cheetah - configurable remapped directory | ||
} | ||
|
||
if (isSameFile) { | ||
@@ -78,10 +79,10 @@ public class PluginInitializerManager { | ||
LOGGER.error(("Your configured update directory (%s) in bukkit.yml is pointing to the same location as the plugin directory (%s). " + | ||
"Disabling auto updating functionality.").formatted(resolvedUpdateDirectory, pluginDirectory)); | ||
|
||
- return new PluginInitializerManager(pluginDirectory, null); | ||
+ return new PluginInitializerManager(pluginDirectory, null, remappedDirectory); // Cheetah - configurable remapped directory | ||
} | ||
|
||
- return new PluginInitializerManager(pluginDirectory, resolvedUpdateDirectory); | ||
+ return new PluginInitializerManager(pluginDirectory, resolvedUpdateDirectory, remappedDirectory); // Cheetah - configurable remapped directory | ||
} | ||
|
||
public static PluginInitializerManager init(final OptionSet optionSet) throws Exception { | ||
diff --git a/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java b/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java | ||
index 28857d0c9b53f2068d51b8f09ef40df7a2b97502..af0288fb9c02487c60e178ffc0929f1ee7aafa91 100644 | ||
--- a/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java | ||
+++ b/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java | ||
@@ -42,7 +42,7 @@ import static io.papermc.paper.pluginremap.InsertManifestAttribute.addNamespaceM | ||
@DefaultQualifier(NonNull.class) | ||
public final class PluginRemapper { | ||
public static final boolean DEBUG_LOGGING = Boolean.getBoolean("Paper.PluginRemapperDebug"); | ||
- private static final String PAPER_REMAPPED = ".paper-remapped"; | ||
+ public static final String PAPER_REMAPPED = ".paper-remapped"; // Cheetah - configurable remapped directory | ||
private static final String UNKNOWN_ORIGIN = "unknown-origin"; | ||
private static final String LIBRARIES = "libraries"; | ||
private static final String EXTRA_PLUGINS = "extra-plugins"; | ||
@@ -58,10 +58,10 @@ public final class PluginRemapper { | ||
private final UnknownOriginRemappedPluginIndex libraries; | ||
private @Nullable CompletableFuture<IMappingFile> reversedMappings; | ||
|
||
- public PluginRemapper(final Path pluginsDir) { | ||
+ public PluginRemapper(final Path pluginsDir, final Path remappedDir) { // Cheetah - configurable remapped directory | ||
this.threadPool = createThreadPool(); | ||
final CompletableFuture<IMappingFile> mappings = CompletableFuture.supplyAsync(PluginRemapper::loadReobfMappings, this.threadPool); | ||
- final Path remappedPlugins = pluginsDir.resolve(PAPER_REMAPPED); | ||
+ final Path remappedPlugins = remappedDir.toString().equals(PAPER_REMAPPED) ? pluginsDir.resolve(PAPER_REMAPPED) : remappedDir; // Cheetah - configurable remapped directory | ||
this.reversedMappings = this.reversedMappingsFuture(() -> mappings, remappedPlugins, this.threadPool); | ||
this.reobf = new ReobfServer(remappedPlugins.resolve(REMAP_CLASSPATH), mappings, this.threadPool); | ||
this.remappedPlugins = new RemappedPluginIndex(remappedPlugins, false); | ||
@@ -70,12 +70,12 @@ public final class PluginRemapper { | ||
this.libraries = new UnknownOriginRemappedPluginIndex(this.remappedPlugins.dir().resolve(LIBRARIES)); | ||
} | ||
|
||
- public static @Nullable PluginRemapper create(final Path pluginsDir) { | ||
+ public static @Nullable PluginRemapper create(final Path pluginsDir, final Path remappedDir) { // Cheetah - configurable remapped directory | ||
if (MappingEnvironment.reobf() || !MappingEnvironment.hasMappings()) { | ||
return null; | ||
} | ||
|
||
- return new PluginRemapper(pluginsDir); | ||
+ return new PluginRemapper(pluginsDir, remappedDir); // Cheetah - configurable remapped directory | ||
} | ||
|
||
public void shutdown() { | ||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java | ||
index c1e88c31910e96ef07cece05046c0b55e708b52d..b1bebe062bbf774a75b43606403eee01e720e4d1 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java | ||
@@ -183,6 +183,14 @@ public class Main { | ||
.defaultsTo("Unknown Server") | ||
.describedAs("Name"); | ||
// Paper end | ||
+ | ||
+ // Cheetah start - configurable remapped directory | ||
+ acceptsAll(asList("remapped-directory"), "Remapped directory") | ||
+ .withRequiredArg() | ||
+ .ofType(File.class) | ||
+ .defaultsTo(new File(io.papermc.paper.pluginremap.PluginRemapper.PAPER_REMAPPED)) | ||
+ .describedAs("Remapped directory"); | ||
+ // Cheetah end - configurable remapped directory | ||
} | ||
}; | ||
|