Java syntax highlighting

Risto Lahtela 2020-10-11 22:29:20 +03:00
parent b385ef6869
commit 89144b86f2
1 changed files with 25 additions and 25 deletions

@ -51,7 +51,7 @@ There is a lot of functionality in the API so it might feel overwhelming at firs
<details><summary>Example of a basic DataExtension</summary>
```
```java
@PluginInfo(name = "Test Plugin", iconName = "vial", iconFamily = Family.SOLID, color = Color.LIGHT_BLUE)
public class TestPluginExtension implements DataExtension {
@ -83,7 +83,7 @@ public class TestPluginExtension implements DataExtension {
}
```
```
```java
public class PlanHook {
private final TestPluginDatabase db;
@ -119,7 +119,7 @@ public class PlanHook {
1. Create a new object that implements `DataExtension`.
2. Obtain instance of `ExtensionService` and register using `ExtensionService#register(DataExtension)`
```
```java
try {
DataExtension yourExtension = new YourDataExtensionImplementation();
@ -147,7 +147,7 @@ Every `DataExtension` implementation **requires** `@PluginInfo` annotation.
<details>
<summary>Usage & Parameters</summary>
```
```java
@PluginInfo(
name* = "Your Plugin",
iconName = "cube"
@ -174,7 +174,7 @@ Provider annotations are method annotations that tell Plan what kind of data met
The name of the methods are used for storing information the methods provide.
Methods can have 4 different parameters (**But only one**):
```
```java
T method(); // The value is about the server as a whole
T method(UUID playerUUID); // The value is about a player
T method(String playerName); // The value is about a player
@ -184,7 +184,7 @@ T method(Group group); // The value is about a Group a player is in
<details>
<summary>Controlling when Plan calls your DataExtension methods</summary>
```
```java
@Override
public CallEvents[] callExtensionMethodsOn() {
return new CallEvents[]{
@ -208,7 +208,7 @@ public CallEvents[] callExtensionMethodsOn() {
<details>
<summary>Manual update calls</summary>
```
```java
DataExtension yourExtension;
Optional<Caller> caller = extensionService.register(yourExtension);
```
@ -218,7 +218,7 @@ Optional<Caller> caller = extensionService.register(yourExtension);
> **HOX** Do not use `Caller` inside `DataExtension` - This might lead to unbound recursion!
```
```java
Caller caller;
caller.updatePlayerData(playerUUID, playerName);
@ -234,7 +234,7 @@ caller.updateServerData();
<details>
<summary>Usage & Parameters</summary>
```
```java
@BooleanProvider(
text* = "Has Island",
description = "Whether or not the player has an island in the island world",
@ -261,7 +261,7 @@ public boolean hasIsland(UUID playerUUID) {...}
<details>
<summary>Usage with @Conditional</summary>
```
```java
@BooleanProvider(
...
conditionName = "hasIsland"
@ -283,7 +283,7 @@ public String islandName(UUID playerUUID) {...}
<details>
<summary>Hiding "Yes"/"No" results</summary>
```
```java
@BooleanProvider(
...
conditionName* = "hasLinkedAccount",
@ -304,7 +304,7 @@ public boolean hasLinkedAccount(UUID playerUUID) {...}
<details>
<summary>Usage & Parameters</summary>
```
```java
@NumberProvider(
text* = "Number of Islands",
description = "How many islands does the player own",
@ -329,7 +329,7 @@ public long islandCount(UUID playerUUID) {...}
<details>
<summary>FormatTypes (Dates / Time amounts)</summary>
```
```java
@NumberProvider(
...
format = FormatType.DATE_YEAR
@ -351,7 +351,7 @@ public long banDate(UUID playerUUID) {...}
<details>
<summary>Usage & Parameters</summary>
```
```java
@DoubleProvider(
text* = "Balance",
description = "Amount of money the player has",
@ -379,7 +379,7 @@ public double balance(UUID playerUUID) {...}
<details>
<summary>Usage & Parameters</summary>
```
```java
@PercentageProvider(
text* = "Quest completion",
description = "Quest completion percentage",
@ -407,7 +407,7 @@ public double questCompletion(UUID playerUUID) {...}
<details>
<summary>Usage & Parameters</summary>
```
```java
@StringProvider(
text* = "Town Name",
description = "What town the player has residency in.",
@ -433,7 +433,7 @@ public String townName(UUID playerUUID) {...}
<details>
<summary>Links to player pages</summary>
```
```java
@StringProvider(
...
playerName = true
@ -469,7 +469,7 @@ Plan will construct following from given group data:
<details>
<summary>Usage & Parameters</summary>
```
```java
@GroupProvider(
text = "Jobs",
groupColor = Color.NONE
@ -509,7 +509,7 @@ public String[] playerJobs(UUID playerUUID) {
<details>
<summary>Usage & Parameters</summary>
```
```java
@TableProvider(tableColor = Color.NONE)
public Table banHistory(UUID playerUUID) {
Table.Factory banTable = Table.builder()
@ -547,7 +547,7 @@ These annotations can be used to further control how the values are displayed.
<details>
<summary>Usage & Parameters</summary>
```
```java
@TabInfo(
tab* = "Economy",
iconName = "circle",
@ -580,7 +580,7 @@ public class YourExtension implements DataExtension {
<details>
<summary>Usage & Parameters</summary>
```
```java
@BooleanProvider(..., conditionName="hasPet")
public boolean hasPet(UUID playerUUID) {...}
@ -597,7 +597,7 @@ public String petName(UUID playerUUID) {...}
<details>
<summary>Reversed Conditions</summary>
```
```java
@BooleanProvider(..., conditionName="permanentBan")
public boolean isPermanentlyBanned(UUID playerUUID) {...}
@ -613,7 +613,7 @@ public long expiryDate(UUID playerUUID) {...}
<details>
<summary>Nested Conditions (Conjunction / AND)</summary>
```
```java
@BooleanProvider(..., conditionName="isBanned")
public boolean isBanned(UUID playerUUID) {...}
@ -637,7 +637,7 @@ public long expireDate(UUID playerUUID) {...}
<details>
<summary>Usage & Parameters</summary>
```
```java
@InvalidateMethod("oldMethodName")
@PluginInfo(...)
public class YourExtension implements DataExtension {
@ -657,7 +657,7 @@ Since annotations do not have any compiler checks, invalid implementation can no
To make implementation easier it is possible to Unit test against the implementation errors.
How:
```
```java
@Test
public void noImplementationErrors() {
DataExtension yourExtension = new YourExtensionImplementation();