'showInPlayerTable' parameter for Providers

for BooleanProvider, DoubleProvider, PercentageProvider, NumberProvider,
StringProvider annotations.
When the parameter is set to 'true' the value from the Provider is shown
on a table alongside players.

Capability DATA_EXTENSION_SHOW_IN_PLAYER_TABLE added
This commit is contained in:
Rsl1122 2019-05-12 11:13:39 +03:00
parent 6d788ba61a
commit 45da64e88f
6 changed files with 41 additions and 2 deletions

View File

@ -42,9 +42,15 @@ enum Capability {
*/ */
DATA_EXTENSION_TABLES, DATA_EXTENSION_TABLES,
/** /**
* DataExtension API * DataExtension API addition, allows throwing {@link com.djrapitops.plan.extension.NotReadyException} inside a Provider method when your API is not ready for a method call.
*/ */
DATA_EXTENSION_NOT_READY_EXCEPTION; DATA_EXTENSION_NOT_READY_EXCEPTION,
/**
* DataExtension API addition, parameter {@code showInPlayerTable} for BooleanProvider, DoubleProvider, PercentageProvider, NumberProvider, StringProvider annotations.
* <p>
* When the parameter is set to {@code true} the value from this Provider is shown on a table alongside players.
*/
DATA_EXTENSION_SHOW_IN_PLAYER_TABLE;
static Optional<Capability> getByName(String name) { static Optional<Capability> getByName(String name) {
if (name == null) { if (name == null) {

View File

@ -112,4 +112,13 @@ public @interface BooleanProvider {
* @return Preferred color. If none are specified defaults are used. * @return Preferred color. If none are specified defaults are used.
*/ */
Color iconColor() default Color.NONE; Color iconColor() default Color.NONE;
/**
* When the parameter is set to {@code true} the value from this Provider is shown on a table alongside players.
* <p>
* If {@link BooleanProvider#hidden()} is {@code true} then this value will not be shown in the table regardless of the value of this parameter.
*
* @return false by default.
*/
boolean showInPlayerTable() default false;
} }

View File

@ -91,4 +91,10 @@ public @interface DoubleProvider {
*/ */
Color iconColor() default Color.NONE; Color iconColor() default Color.NONE;
/**
* When the parameter is set to {@code true} the value from this Provider is shown on a table alongside players.
*
* @return false by default.
*/
boolean showInPlayerTable() default false;
} }

View File

@ -103,4 +103,10 @@ public @interface NumberProvider {
*/ */
Color iconColor() default Color.NONE; Color iconColor() default Color.NONE;
/**
* When the parameter is set to {@code true} the value from this Provider is shown on a table alongside players.
*
* @return false by default.
*/
boolean showInPlayerTable() default false;
} }

View File

@ -94,4 +94,10 @@ public @interface PercentageProvider {
*/ */
Color iconColor() default Color.NONE; Color iconColor() default Color.NONE;
/**
* When the parameter is set to {@code true} the value from this Provider is shown on a table alongside players.
*
* @return false by default.
*/
boolean showInPlayerTable() default false;
} }

View File

@ -103,4 +103,10 @@ public @interface StringProvider {
*/ */
Color iconColor() default Color.NONE; Color iconColor() default Color.NONE;
/**
* When the parameter is set to {@code true} the value from this Provider is shown on a table alongside players.
*
* @return false by default.
*/
boolean showInPlayerTable() default false;
} }