Updated APIv5 DataExtension API (markdown)

Risto Lahtela 2021-05-03 22:00:30 +03:00
parent 96705474a7
commit 8feb6df2e3

@ -61,15 +61,12 @@ You might need to catch the error when calling your method that does the registe
Every `DataExtension` implementation **requires** `@PluginInfo` annotation. Every `DataExtension` implementation **requires** `@PluginInfo` annotation.
> **Notation:**
> `*` means required parameter
<details> <details>
<summary>Usage & Parameters</summary> <summary>Usage & Parameters</summary>
```java ```java
@PluginInfo( @PluginInfo(
name* = "Your Plugin", name = "Your Plugin", // ALWAYS REQUIRED
iconName = "cube" iconName = "cube"
iconFamily = Family.SOLID, iconFamily = Family.SOLID,
color = Color.NONE color = Color.NONE
@ -88,9 +85,6 @@ public class YourExtension implements DataExtension {}
Provider annotations are method annotations that tell Plan what kind of data methods in your `DataExtension` class provide. Provider annotations are method annotations that tell Plan what kind of data methods in your `DataExtension` class provide.
> **Notation:**
> `*` means required parameter
The name of the methods are used for storing information the methods provide. The name of the methods are used for storing information the methods provide.
Methods can have 4 different parameters (**But only one**): Methods can have 4 different parameters (**But only one**):
@ -156,7 +150,7 @@ caller.updateServerData();
```java ```java
@BooleanProvider( @BooleanProvider(
text* = "Has Island", text = "Has Island", // ALWAYS REQUIRED
description = "Whether or not the player has an island in the island world", description = "Whether or not the player has an island in the island world",
priority = 5, priority = 5,
iconName = "question", iconName = "question",
@ -206,7 +200,7 @@ public String islandName(UUID playerUUID) {...}
```java ```java
@BooleanProvider( @BooleanProvider(
... ...
conditionName* = "hasLinkedAccount", conditionName = "hasLinkedAccount", // REQUIRED to use hidden
hidden = true hidden = true
) )
public boolean hasLinkedAccount(UUID playerUUID) {...} public boolean hasLinkedAccount(UUID playerUUID) {...}
@ -226,7 +220,7 @@ public boolean hasLinkedAccount(UUID playerUUID) {...}
```java ```java
@NumberProvider( @NumberProvider(
text* = "Number of Islands", text = "Number of Islands", // ALWAYS REQUIRED
description = "How many islands does the player own", description = "How many islands does the player own",
priority = 4, priority = 4,
iconName = "question", iconName = "question",
@ -273,7 +267,7 @@ public long banDate(UUID playerUUID) {...}
```java ```java
@DoubleProvider( @DoubleProvider(
text* = "Balance", text = "Balance", // ALWAYS REQUIRED
description = "Amount of money the player has", description = "Amount of money the player has",
priority = 3, priority = 3,
iconName = "question", iconName = "question",
@ -301,7 +295,7 @@ public double balance(UUID playerUUID) {...}
```java ```java
@PercentageProvider( @PercentageProvider(
text* = "Quest completion", text = "Quest completion", // ALWAYS REQUIRED
description = "Quest completion percentage", description = "Quest completion percentage",
priority = 5, priority = 5,
iconName = "question", iconName = "question",
@ -329,7 +323,7 @@ public double questCompletion(UUID playerUUID) {...}
```java ```java
@StringProvider( @StringProvider(
text* = "Town Name", text = "Town Name", // ALWAYS REQUIRED
description = "What town the player has residency in.", description = "What town the player has residency in.",
priority = 5, priority = 5,
iconName = "question", iconName = "question",
@ -391,7 +385,7 @@ Plan will construct following from given group data:
```java ```java
@GroupProvider( @GroupProvider(
text = "Jobs", text = "Jobs", // ALWAYS REQUIRED
groupColor = Color.NONE groupColor = Color.NONE
iconName = "question", iconName = "question",
iconFamily = Family.SOLID, iconFamily = Family.SOLID,
@ -491,12 +485,12 @@ These annotations can be used to further control how the values are displayed.
```java ```java
@TabInfo( @TabInfo(
tab* = "Economy", tab = "Economy", // REQUIRED
iconName = "circle", iconName = "circle",
iconFamily = Family.SOLID, iconFamily = Family.SOLID,
elementOrder = {ElementOrder.VALUES, ElementOrder.TABLE, ElementOrder.GRAPH} elementOrder = {ElementOrder.VALUES, ElementOrder.TABLE, ElementOrder.GRAPH}
) )
@TabInfo(tab* = "Second Tab") @TabInfo(tab = "Second Tab") // REQUIRED
@TabOrder({"Economy", "Second Tab"}) @TabOrder({"Economy", "Second Tab"})
@PluginInfo(...) @PluginInfo(...)
public class YourExtension implements DataExtension { public class YourExtension implements DataExtension {