Updated APIv5 (markdown)
parent
08c3c5783c
commit
5319756b1e
78
APIv5.md
78
APIv5.md
|
@ -14,6 +14,8 @@ API can be called on all platforms.
|
|||
- 🔔 [How to register a DataExtension](https://github.com/Rsl1122/Plan-PlayerAnalytics/wiki/APIv5#-how-to-register-a-dataextension)
|
||||
- ℹ️ [PluginInfo Annotation](https://github.com/Rsl1122/Plan-PlayerAnalytics/wiki/APIv5#%E2%84%B9%EF%B8%8F-plugininfo-annotation)
|
||||
- 📏 [Provider Annotations](https://github.com/Rsl1122/Plan-PlayerAnalytics/wiki/APIv5#-provider-annotations)
|
||||
- 🔨 [Special Provider Annotations](https://github.com/plan-player-analytics/Plan/wiki/APIv5#-special-provider-annotations)
|
||||
- 👥 [`@GroupProvider`](https://github.com/plan-player-analytics/Plan/wiki/APIv5#groupprovider)
|
||||
- 📐 [Extra annotations](https://github.com/Rsl1122/Plan-PlayerAnalytics/wiki/APIv5#-extra-annotations)
|
||||
- ❕ [Preventing runtime errors](https://github.com/Rsl1122/Plan-PlayerAnalytics/wiki/APIv5#-preventing-runtime-errors)
|
||||
- Implementation violations
|
||||
|
@ -49,6 +51,9 @@ try {
|
|||
}
|
||||
```
|
||||
|
||||
> Registration should be done in it's own class to avoid `NoClassDefFoundError` if Plan is not installed.
|
||||
You might need to catch the error when calling your method that does the registering.
|
||||
|
||||
## ℹ️ `@PluginInfo` annotation
|
||||
|
||||
Every `DataExtension` implementation **requires** `@PluginInfo` annotation.
|
||||
|
@ -215,6 +220,79 @@ public String townName(UUID playerUUID) {...}
|
|||
- `iconColor` - Color of the icon that appears next to the value
|
||||
- `playerName` - Does this provider return a player name that can be linked to? Links are automatic
|
||||
|
||||
## 🔨 Special Provider annotations
|
||||
|
||||
These annotations can be used to add information structures. They might have different limitations than other providers.
|
||||
|
||||
### `@GroupProvider`
|
||||
|
||||
**Speciality:** Multiple `Group`s the player is in. Any providers with `Group` parameter will be called with the groups that this method provides.
|
||||
|
||||
- **There can only be one GroupProvider per DataExtension** - If you need multiple kinds of groups, create another `DataExtension` class.
|
||||
- **GroupProvider method requires UUID or String as method parameter.**
|
||||
|
||||
Plan will construct following from given group data:
|
||||
|
||||
- Players in different groups are counted
|
||||
- Additional data given by `Group` parameter methods about each group.
|
||||
- Additional data about players is grouped based on groups.
|
||||
- Additional data is displayed under a dropdown of the group.
|
||||
|
||||
Example usage:
|
||||
```
|
||||
@GroupProvider(
|
||||
text* = "Jobs",
|
||||
description = "What jobs the player has",
|
||||
priority = 5,
|
||||
iconName = "question",
|
||||
iconFamily = Family.SOLID,
|
||||
iconColor = Color.NONE
|
||||
)
|
||||
public String[] playerJobs(UUID playerUUID) {...}
|
||||
```
|
||||
|
||||
- `text` - Text that appears next to the value on Player's page, for example "Jobs: None"
|
||||
- `description` - Text that appears when hovering over the value
|
||||
- `priority` - Ordering number, highest value is placed top most
|
||||
- `iconName` - Icon names can be found from https://fontawesome.com/icons?d=gallery&m=free
|
||||
- `iconFamily` - Icon family should match details on the site above
|
||||
- `iconColor` - Color of the icon that appears next to the value
|
||||
|
||||
### `@TableProvider`
|
||||
|
||||
**Speciality:** Table structures.
|
||||
|
||||
- Player tables can have 4 columns.
|
||||
- Server tables can have 5 columns.
|
||||
|
||||
> If you want to display a table that lists how many players are using something (or data about groups), eg. Players on each version, use `@GroupProvider` (and `Group` parameter methods) instead.
|
||||
|
||||
Example usage:
|
||||
```
|
||||
@TableProvider(tableColor = Color.NONE)
|
||||
Table banHistory(UUID playerUUID) {
|
||||
Table.Factory banTable = Table.builder()
|
||||
.columnOne("When", new Icon(Family.SOLID, "gavel")) // Define column names and icons
|
||||
.columnTwo("...", new Icon(...)) // Icon colors are ignored.
|
||||
.columnThree("...", new Icon(...))
|
||||
.columnFour("...", new Icon(...));
|
||||
|
||||
for (YourData data : yourData) {
|
||||
banTable.addRow(String...);
|
||||
}
|
||||
|
||||
return banTable.build();
|
||||
}
|
||||
```
|
||||
|
||||
- `tableColor` - Color of the table header.
|
||||
|
||||
### `@GraphProvider`
|
||||
|
||||
**Speciality:** Graphs.
|
||||
|
||||
This will be implemented later.
|
||||
|
||||
## 📐 Extra annotations
|
||||
|
||||
These annotations can be used to further control how the values are displayed.
|
||||
|
|
Loading…
Reference in New Issue