Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public static void load(OptionSet optionSet) throws Exception {
@SuppressWarnings("unchecked")
java.util.List<Path> files = ((java.util.List<File>) optionSet.valuesOf("add-plugin")).stream().map(File::toPath).toList();
io.papermc.paper.plugin.util.EntrypointUtil.registerProvidersFromSource(io.papermc.paper.plugin.provider.source.PluginFlagProviderSource.INSTANCE, files);
@SuppressWarnings("unchecked")
java.util.List<Path> dirs = ((java.util.List<File>) optionSet.valuesOf("add-plugin-dir")).stream().map(File::toPath).toList();
dirs.forEach(pluginDir -> io.papermc.paper.plugin.util.EntrypointUtil.registerProvidersFromSource(io.papermc.paper.plugin.provider.source.DirectoryProviderSource.INSTANCE_NO_CREATE, pluginDir));

final Set<String> paperPluginNames = new TreeSet<>();
final Set<String> legacyPluginNames = new TreeSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,23 @@
*/
public class DirectoryProviderSource implements ProviderSource<Path, List<Path>> {

public static final DirectoryProviderSource INSTANCE = new DirectoryProviderSource();
public static final DirectoryProviderSource INSTANCE = new DirectoryProviderSource(true);
public static final DirectoryProviderSource INSTANCE_NO_CREATE = new DirectoryProviderSource(false);
private static final FileProviderSource FILE_PROVIDER_SOURCE = new FileProviderSource("Directory '%s'"::formatted, false); // Paper - Remap plugins
private static final Logger LOGGER = LogUtils.getClassLogger();

private final boolean createDirectory;

public DirectoryProviderSource(final boolean createDirectory) {
this.createDirectory = createDirectory;
}

@Override
public List<Path> prepareContext(Path context) throws IOException {
// Symlink happy, create file if missing.
if (!Files.isDirectory(context)) {
Files.createDirectories(context);
if(this.createDirectory) Files.createDirectories(context);
else return List.of();
}

final List<Path> files = new ArrayList<>();
Expand Down
6 changes: 6 additions & 0 deletions paper-server/src/main/java/org/bukkit/craftbukkit/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ public static void main(String[] args) {
.defaultsTo(new File[] {})
.describedAs("Jar file");

this.acceptsAll(asList("add-plugin-dir", "add-extra-plugin-dir"), "Specify paths to extra plugin directories to be loaded in addition to the plugins folder. This argument can be specified multiple times, once for each extra plugin dir path.")
.withRequiredArg()
.ofType(File.class)
.defaultsTo(new File[] {})
.describedAs("Plugin directory");

this.accepts("server-name", "Name of the server")
.withRequiredArg()
.ofType(String.class)
Expand Down
Loading