Class PluginMetadata
java.lang.Object
eu.hexagonmc.spigot.annotation.meta.PluginMetadata
- All Implemented Interfaces:
Consumer<PluginMetadata>
Reresents the parsed metadata of an plugin loaded from file, gradle or
annotation.
This metadata is used for Spigot and BungeeCord plugins. Each field
represents a value in the yaml file.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPluginMetadata(String name) Creates a new metadata for a plugin with the given name. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(PluginMetadata other) Merges another metadata into this one.voidAdds an author the the list of authors of this plugin.voidaddCommand(PluginCommand command) Adds a command to this plugin.voidaddDependency(PluginDependency dependency) Adds a dependency to this plugin.voidaddPermission(PluginPermission permission) Adds a permission to this plugin.booleanstatic PluginMetadataCreates metadata from a plugins main-class name and an annotation.Gets the list of authors for this plugin.Gets all commands of this plugin.Gets if the plugin should use plugin-databases.Gets all dependencies of this plugin.Gets the description of this plugin.Gets the load time of this plugin.getMain()Gets the main-class name of this plugin.getName()Gets the name of this plugin.Gets all permissions of this plugin.Gets the log prefix of this plugin.Gets the version of this plugin.Gets the website of this plugin.inthashCode()booleanisBungee()booleanremoveAuthor(String author) Removes an author from the list of authors of this plugin.booleanremoveCommand(PluginCommand command) Removes a command from this pugin.booleanremoveDependency(PluginDependency dependency) Removes a dependency from this pugin.booleanremovePermission(PluginPermission permission) Removes a permission from this pugin.replaceCommand(PluginCommand command) Replaces or inserts a command of this plugin.replaceDependency(PluginDependency dependency) Replaces or inserts a dependency of this plugin.replacePermission(PluginPermission permission) Replaces or inserts a permission of this plugin.voidsetBungee(boolean b) voidsetDatabase(Boolean database) Sets if the plugin should use plugin-databases.voidsetDescription(String description) Sets the description of this plugin.voidSets the load time of this plugin.voidSets the main-class name of this plugin.voidSets the name of this plugin.voidSets the log prefix of this plugin.voidsetVersion(String version) Sets the version of this plugin.voidsetWebsite(String website) Sets the website of this plugin.toString()
-
Field Details
-
NAME_PATTERN
The pattern plugin names must match.- See Also:
-
-
Constructor Details
-
PluginMetadata
Creates a new metadata for a plugin with the given name.- Parameters:
name- The name of the plugin
-
-
Method Details
-
from
Creates metadata from a plugins main-class name and an annotation. Parses the data tored in the annotation.- Parameters:
main- The main-class name of the pluginannotation- The annotation to parse for data- Returns:
- The new metadata
- See Also:
-
addAuthor
Adds an author the the list of authors of this plugin.- Parameters:
author- The author to add
-
getAuthors
Gets the list of authors for this plugin.- Returns:
- The list of authors
- See Also:
-
removeAuthor
Removes an author from the list of authors of this plugin.- Parameters:
author- The author to remove- Returns:
- True if an author was removed false if not found
-
addDependency
Adds a dependency to this plugin.- Parameters:
dependency- The dependency to add- See Also:
-
getDependencies
Gets all dependencies of this plugin.- Returns:
- The dependencies
- See Also:
-
replaceDependency
Replaces or inserts a dependency of this plugin.- Parameters:
dependency- The dependency to replace or add- Returns:
- The old dependency if replaced or null
- See Also:
-
removeDependency
Removes a dependency from this pugin.- Parameters:
dependency- The dependency to remove- Returns:
- true if the dependency was removed false if it did not exist
- See Also:
-
addCommand
Adds a command to this plugin.- Parameters:
command- The command to add- See Also:
-
getCommands
Gets all commands of this plugin.- Returns:
- The command
- See Also:
-
replaceCommand
Replaces or inserts a command of this plugin.- Parameters:
command- The command to replace or add- Returns:
- The old command if replaced or null
- See Also:
-
removeCommand
Removes a command from this pugin.- Parameters:
command- The command to remove- Returns:
- true if the command was removed false if it did not exist
- See Also:
-
addPermission
Adds a permission to this plugin.- Parameters:
permission- The permission to add- See Also:
-
getPermissions
Gets all permissions of this plugin.- Returns:
- The permissions
- See Also:
-
replacePermission
Replaces or inserts a permission of this plugin.- Parameters:
permission- The permission to replace or add- Returns:
- The old permission if replaced or null
- See Also:
-
removePermission
Removes a permission from this pugin.- Parameters:
permission- The permission to remove- Returns:
- true if the permission was removed false if it did not exist
- See Also:
-
accept
Merges another metadata into this one.- Specified by:
acceptin interfaceConsumer<PluginMetadata>
-
setName
Sets the name of this plugin.- Parameters:
name- The name to set
-
getName
Gets the name of this plugin.- Returns:
- The name
-
setVersion
Sets the version of this plugin.- Parameters:
version- The version to set
-
getVersion
Gets the version of this plugin.- Returns:
- The version
-
setDescription
Sets the description of this plugin.- Parameters:
description- The description to set
-
getDescription
Gets the description of this plugin.- Returns:
- The description
-
setLoadOn
Sets the load time of this plugin.- Parameters:
loadOn- The load time to set- See Also:
-
getLoadOn
Gets the load time of this plugin.- Returns:
- The load time
- See Also:
-
setWebsite
Sets the website of this plugin.- Parameters:
website- The website to set
-
getWebsite
Gets the website of this plugin.- Returns:
- The website
-
setMain
Sets the main-class name of this plugin.- Parameters:
main- The main-class name to set
-
getMain
Gets the main-class name of this plugin.- Returns:
- The main-class name
-
setDatabase
Sets if the plugin should use plugin-databases.- Parameters:
database- True if it should be used false othewise
-
getDatabase
Gets if the plugin should use plugin-databases.- Returns:
- True if it should be used false othewise
-
setPrefix
Sets the log prefix of this plugin.- Parameters:
prefix- The log prefix to set
-
getPrefix
Gets the log prefix of this plugin.- Returns:
- The log prefix
-
setBungee
public void setBungee(boolean b) -
isBungee
public boolean isBungee() -
toString
-
hashCode
public int hashCode() -
equals
-