Added persist explanation for internal expansions provided by the dependency

Ryan 2019-05-05 14:08:35 -04:00
parent 92a73eb326
commit a402cd0402
1 changed files with 14 additions and 0 deletions

@ -292,6 +292,8 @@ class SomeExpansion extends PlaceholderExpansion {
#### Internal class
You can have the class inside your plugin.
This has some advantages but can also have some disadvantages.
If you include a PlaceholderExpansion class in your plugin, you MUST add and override the persist() method to return true
otherwise if PlaceholderAPI is reloaded, your expansion will be unregistered and lost forever.
```java
@ -321,6 +323,18 @@ class SomeExpansion extends PlaceholderExpansion {
this.plugin = plugin;
}
/**
* Because this is an internal class,
* you must override this method to let PlaceholderAPI know to not unregister your expansion class when
* PlaceholderAPI is reloaded
*
* @return true to persist through reloads
*/
@Override
public boolean persist(){
return true;
}
/**
* Because this is a internal class, this check is not needed
* and we can simply return {@code true}