Paper Plugins

This commit is contained in:
Owen1212055
2022-07-06 23:00:36 -04:00
parent 844bc6c46a
commit 23095683d0
40 changed files with 1509 additions and 290 deletions

View File

@@ -199,7 +199,7 @@ import org.yaml.snakeyaml.representer.Representer;
* inferno.burningdeaths: true
*</pre></blockquote>
*/
public final class PluginDescriptionFile {
public final class PluginDescriptionFile implements io.papermc.paper.plugin.configuration.PluginMeta { // Paper
private static final Pattern VALID_NAME = Pattern.compile("^[A-Za-z0-9 _.-]+$");
private static final ThreadLocal<Yaml> YAML = new ThreadLocal<Yaml>() {
@Override
@@ -260,6 +260,70 @@ public final class PluginDescriptionFile {
private Set<PluginAwareness> awareness = ImmutableSet.of();
private String apiVersion = null;
private List<String> libraries = ImmutableList.of();
// Paper start - oh my goddddd
/**
* Don't use this.
*/
@org.jetbrains.annotations.ApiStatus.Internal
public PluginDescriptionFile(String rawName, String name, List<String> provides, String main, String classLoaderOf, List<String> depend, List<String> softDepend, List<String> loadBefore, String version, Map<String, Map<String, Object>> commands, String description, List<String> authors, List<String> contributors, String website, String prefix, PluginLoadOrder order, List<Permission> permissions, PermissionDefault defaultPerm, Set<PluginAwareness> awareness, String apiVersion, List<String> libraries) {
this.rawName = rawName;
this.name = name;
this.provides = provides;
this.main = main;
this.classLoaderOf = classLoaderOf;
this.depend = depend;
this.softDepend = softDepend;
this.loadBefore = loadBefore;
this.version = version;
this.commands = commands;
this.description = description;
this.authors = authors;
this.contributors = contributors;
this.website = website;
this.prefix = prefix;
this.order = order;
this.permissions = permissions;
this.defaultPerm = defaultPerm;
this.awareness = awareness;
this.apiVersion = apiVersion;
this.libraries = libraries;
}
@Override
public @NotNull String getMainClass() {
return this.main;
}
@Override
public @NotNull PluginLoadOrder getLoadOrder() {
return this.order;
}
@Override
public @Nullable String getLoggerPrefix() {
return this.prefix;
}
@Override
public @NotNull List<String> getPluginDependencies() {
return this.depend;
}
@Override
public @NotNull List<String> getPluginSoftDependencies() {
return this.softDepend;
}
@Override
public @NotNull List<String> getLoadBeforePlugins() {
return this.loadBefore;
}
@Override
public @NotNull List<String> getProvidedPlugins() {
return this.provides;
}
// Paper end
public PluginDescriptionFile(@NotNull final InputStream stream) throws InvalidDescriptionException {
loadMap(asMap(YAML.get().load(stream)));