Skip to content

Commit

Permalink
Plugin Meta stuff (#580)
Browse files Browse the repository at this point in the history
* Add Code Modularization.

* Add Code Modularization.

* Fixed spelling error in utilize.

* Made into less wordy.

* Wording changes.

* Inscrutable kills my writing style.

* My battery is going to die from all the small changes I'm making.

* Change @plugin authors

* Too early.

* Fix some misconceptions, further elaborate on dependencies.

* link to javadoc instead

* Remove modularization

* Nuke moduralization

There's just not enough, and it's not quite on-topic anyway.
  • Loading branch information
Saladoc authored and Inscrutable committed Feb 17, 2018
1 parent c25c59c commit 912c2d9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 3 additions & 1 deletion source/plugin/plugin-class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ email address (such as ``com.gmail.username.project``) or an open-source reposit
(such as ``io.github.username.project``).

After creating your main class, the :javadoc:`Plugin` annotation must be affixed to it. This annotation allows Sponge
to easily find your main plugin class when your plugin is loaded. An example usage is illustrated below.
to easily find your main plugin class when your plugin is loaded. An example usage is illustrated below, more detailed
usage is explained on :doc:`plugin-meta`.

.. code-block:: java
Expand All @@ -52,6 +53,7 @@ to easily find your main plugin class when your plugin is loaded. An example usa
.. note::
Refer to :doc:`plugin-identifier` if you've not chosen your plugin ID yet.


Initializing Your Plugin
========================

Expand Down
18 changes: 16 additions & 2 deletions source/plugin/plugin-meta.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Plugin Metadata
===============

.. javadoc-import::
org.spongepowered.api.plugin.Dependency

Adding plugin metadata helps users to identify your plugin more easily by giving them the ability to check the name,
version, description, or even the authors of a plugin at runtime. It will also be used when publishing plugins on a plugin
portal like Ore_.
Expand All @@ -17,7 +20,9 @@ Currently, Sponge supports the following types of plugin metadata:
Plugin annotation
=================

You can define the additional (optional) plugin metadata on your ``@Plugin`` annotation:
You can define the additional (optional) plugin metadata on your ``@Plugin`` annotation. You can provide all meta
information in the annotation, despite only the id being required. A ``@Plugin`` annotation which uses all fields
available looks like this:

.. code-block:: java
Expand All @@ -27,7 +32,16 @@ You can define the additional (optional) plugin metadata on your ``@Plugin`` ann
description = "This is a very cool plugin I made for me",
url = "http://example.com",
authors = {"Spongie", "FLARD"},
dependencies = @Dependency(id = "otherplugin", optional = true))
dependencies = {@Dependency(id = "otherplugin", optional = true)})
For every ``@Dependency`` you provide, you may also give a ``version`` attribute specifying a version range according to
:javadoc:`Dependency#version()`. The ``optional`` attribute specifies that your plugin may be loaded even if the
dependency is not available. Unless explicitly specified as optional, the absence of any dependency will prevent your
plugin from being loaded.

.. note::
For both ``authors`` and ``dependencies``, the curly brackets may be left out if only one element is supplied, e.g.
``dependencies = @Dependency(id = "otherplugin", optional = true)`` in the above example.


File metadata
Expand Down

0 comments on commit 912c2d9

Please sign in to comment.