Skip to content

Commit

Permalink
docs: add javadoc for PluginDescriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Jan 6, 2025
1 parent 7aa40f9 commit 5a38983
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 21 deletions.
38 changes: 35 additions & 3 deletions api/src/main/java/org/allaymc/api/plugin/PluginDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,52 @@ static void checkDescriptorValid(PluginDescriptor descriptor) {
Preconditions.checkNotNull(Semver.coerce(descriptor.getVersion()), "Plugin version cannot be coerced (Use https://semver.org/)");
}

/**
* Get the name of the plugin.
*
* @return the name of the plugin.
*/
String getName();

/**
* Get the entrance of the plugin.
*
* @return the entrance of the plugin.
*/
String getEntrance();

// Plugins can leave this information unavailable
/**
* Get the description of the plugin.
*
* @return the description of the plugin.
*/
String getDescription();

/**
* Get the version of the plugin.
*
* @return the version of the plugin.
*/
String getVersion();

/**
* Get the authors of the plugin.
*
* @return the authors of the plugin.
*/
List<String> getAuthors();

// Plugins can leave this information unavailable
/**
* Get the dependencies of the plugin.
*
* @return the dependencies of the plugin.
*/
List<PluginDependency> getDependencies();

// Plugins can leave this information unavailable
/**
* Get the website of the plugin.
*
* @return the website of the plugin.
*/
String getWebsite();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,12 @@
public class SimplePluginDescriptor implements PluginDescriptor {
private String entrance;
private String name;
private String description;
private String version;
private List<String> authors;
private List<PluginDependency> dependencies;
private String website;

public String getDescription() {
if (description == null) description = "";
return description;
}

public List<PluginDependency> getDependencies() {
if (dependencies == null) dependencies = Collections.emptyList();
return dependencies;
}

public String getWebsite() {
if (website == null) website = "";
return website;
}
// Optional
private String description = "";
// Optional
private List<PluginDependency> dependencies = Collections.emptyList();
// Optional
private String website = "";
}

0 comments on commit 5a38983

Please sign in to comment.