Package org.spongepowered.plugin.meta
Class PluginMetadata
java.lang.Object
org.spongepowered.plugin.meta.PluginMetadata
- All Implemented Interfaces:
- Consumer<PluginMetadata>
Represents additional metadata for a specific version of a plugin.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionPluginMetadata(String id) Constructs a newPluginMetadatawith the specified plugin ID.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaccept(PluginMetadata other) Replaces the properties in thisPluginMetadatawith all properties of the specifiedPluginMetadatathat are not empty.voidAdds an author to theListof authors for this plugin.voidaddAuthors(String... authors) Adds the authors to theListof authors for this plugin.voidaddDependencies(PluginDependency... dependencies) Adds the list ofPluginDependencyto thisPluginMetadata.voidaddDependency(PluginDependency dependency) Adds a newPluginDependencyto thisPluginMetadata.authors()Returns a mutableListof authors for this plugin.Collects all dependencies of thisPluginMetadatathat are not optional.Returns aCollectionwith all dependencies of the plugin represented by thisPluginMetadata.Returns aMapwith all dependencies grouped by their plugin ID.dependency(String id) Returns thePluginDependencythat is currently associated with the specified plugin ID.Returns the plugin description.Returns aMapwith additional properties for thisPluginMetadata.<T> @Nullable TgetExtension(String key) Returns the value for a specific extension.Groups the dependencies of thisPluginMetadatabased on theirPluginDependency.LoadOrder.id()Returns the plugin ID that is represented by thisPluginMetadata.name()Returns the plugin name.booleanremoveAuthor(String author) Removes an author from theListof authors for this plugin.booleanRemoves a dependency from thisPluginMetadata.booleanremoveExtension(String key) Removes an extension from thisPluginMetadata.replaceDependency(PluginDependency dependency) Replaces the currentPluginDependencywith the same plugin ID with a new one.voidsetDescription(@Nullable String description) Sets the plugin description.voidsetExtension(String key, Object extension) Adds the specified extension to thisPluginMetadata.voidSets the plugin ID that is represented by thisPluginMetadata.voidSets the plugin name.voidSets a URL where additional information about a plugin may be found.voidsetVersion(@Nullable String version) Sets the plugin version.toString()url()Returns a URL where additional information about a plugin may be found.version()Returns the plugin version.
- 
Field Details- 
ID_PATTERNThe pattern plugin IDs must match. Plugin IDs must be lower case, and start with an alphabetic character. It may only contain alphanumeric characters, dashes or underscores. It must be at least 2 characters, and cannot be longer than 64 characters.
 
- 
- 
Constructor Details- 
PluginMetadataConstructs a newPluginMetadatawith the specified plugin ID.- Parameters:
- id- The plugin ID
- Throws:
- IllegalArgumentException- If the plugin ID is empty
 
 
- 
- 
Method Details- 
idReturns the plugin ID that is represented by thisPluginMetadata.- Returns:
- The plugin ID
 
- 
setIdSets the plugin ID that is represented by thisPluginMetadata.- Parameters:
- id- The plugin ID
- Throws:
- IllegalArgumentException- If the plugin ID is empty
 
- 
nameReturns the plugin name.- Returns:
- The plugin name or nullif unknown
 
- 
setNameSets the plugin name.- Parameters:
- name- The plugin name or- nullto reset
 
- 
versionReturns the plugin version.- Returns:
- The plugin version or nullif unknown
 
- 
setVersionSets the plugin version.- Parameters:
- version- The plugin version or- nullto reset
 
- 
descriptionReturns the plugin description.- Returns:
- The plugin description or nullif unknown
 
- 
setDescriptionSets the plugin description.- Parameters:
- description- The plugin description or- nullto reset
 
- 
urlReturns a URL where additional information about a plugin may be found.- Returns:
- The URL or nullif unknown
 
- 
setUrlSets a URL where additional information about a plugin may be found.- Parameters:
- url- The URL or- nullto reset
 
- 
authorsReturns a mutableListof authors for this plugin.The returned list can be used to remove an author from the metadata. - Returns:
- The list of authors, can be empty
 
- 
addAuthorAdds an author to theListof authors for this plugin.- Parameters:
- author- The author to add
- Throws:
- IllegalArgumentException- If the author is empty
 
- 
addAuthorsAdds the authors to theListof authors for this plugin.- Parameters:
- authors- The authors to add
- Throws:
- IllegalArgumentException- If the author is empty or has any invalid authors
 
- 
removeAuthorRemoves an author from theListof authors for this plugin.- Parameters:
- author- The author to remove
- Returns:
- True if the operation was successful
 
- 
dependenciesReturns aCollectionwith all dependencies of the plugin represented by thisPluginMetadata.It is possible to remove elements from the returned collection, however new elements must be added using addDependency(PluginDependency).- Returns:
- A collection with all dependencies
 
- 
dependenciesByIdReturns aMapwith all dependencies grouped by their plugin ID.- Returns:
- A map with all dependencies and their plugin IDs
 
- 
collectRequiredDependenciesCollects all dependencies of thisPluginMetadatathat are not optional.- Returns:
- An immutable set of all required dependencies
 
- 
groupDependenciesByLoadOrderGroups the dependencies of thisPluginMetadatabased on theirPluginDependency.LoadOrder.- Returns:
- An immutable map with all dependencies grouped by their load order
 
- 
dependencyReturns thePluginDependencythat is currently associated with the specified plugin ID.- Parameters:
- id- The plugin ID of the dependency
- Returns:
- The dependency or nullif there is no such dependency
 
- 
addDependencyAdds a newPluginDependencyto thisPluginMetadata.- Parameters:
- dependency- The dependency to add
- Throws:
- IllegalArgumentException- If this plugin already has a dependency with the specified plugin ID
 
- 
addDependenciesAdds the list ofPluginDependencyto thisPluginMetadata.- Parameters:
- dependencies- The dependencies to add
- Throws:
- IllegalArgumentException- If the plugins are null or invalid
 
- 
replaceDependencyReplaces the currentPluginDependencywith the same plugin ID with a new one. UnlikeaddDependency(PluginDependency)this method doesn't throw an exception if a dependency with the same plugin ID exists already.- Parameters:
- dependency- The dependency to add
- Returns:
- The dependency that was previously registered for the plugin ID
     or nullif this is a new dependency
 
- 
removeDependencyRemoves a dependency from thisPluginMetadata.- Parameters:
- id- The plugin ID of the dependency to remove
- Returns:
- True if the operation was successful
 
- 
extensionsReturns aMapwith additional properties for thisPluginMetadata.To serialize arbitrary objects, it may be necessary to register a custom serializer for the extension object. - Returns:
- An unmodifiable map with additional properties
 
- 
getExtensionReturns the value for a specific extension.Note: This method will not verify if this metadata contains a value with the specified type. A ClassCastExceptionwill be thrown if the value has a different type.- Type Parameters:
- T- The type to cast the extension to
- Parameters:
- key- The key of the extension
- Returns:
- The extension or nullif not set
- Throws:
- ClassCastException- If the given type does not match the type of the extension
 
- 
setExtensionAdds the specified extension to thisPluginMetadata.- Parameters:
- key- The key of the extension
- extension- The extension
 
- 
removeExtensionRemoves an extension from thisPluginMetadata.- Parameters:
- key- The key of the extension
- Returns:
- True if the operation was successful
 
- 
acceptReplaces the properties in thisPluginMetadatawith all properties of the specifiedPluginMetadatathat are not empty.- Specified by:
- acceptin interface- Consumer<PluginMetadata>
- Parameters:
- other- The plugin metadata to apply
- Throws:
- IllegalArgumentException- If the plugin IDs don't match
 
- 
toString
 
-