diff --git a/Plan/api/src/main/java/com/djrapitops/plan/extension/FormatType.java b/Plan/api/src/main/java/com/djrapitops/plan/extension/FormatType.java new file mode 100644 index 000000000..4964a754c --- /dev/null +++ b/Plan/api/src/main/java/com/djrapitops/plan/extension/FormatType.java @@ -0,0 +1,43 @@ +/* + * This file is part of Player Analytics (Plan). + * + * Plan is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License v3 as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Plan is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Plan. If not, see . + */ +package com.djrapitops.plan.extension; + +/** + * Enum for determining additional formatter for a value given by a {@link com.djrapitops.plan.extension.annotation.NumberProvider}. + * + * @author Rsl1122 + */ +public enum FormatType { + + /** + * Formats a long value (Epoch ms) to a readable timestamp, year is important. + */ + DATE_YEAR, + /** + * Formats a long value (Epoch ms) to a readable timestamp, second is important. + */ + DATE_SECOND, + /** + * Formats a long value (ms) to a readable format. + */ + TIME_MILLISECONDS, + /** + * Applies no formatting to the value. + */ + NONE + +} diff --git a/Plan/api/src/main/java/com/djrapitops/plan/extension/annotation/NumberProvider.java b/Plan/api/src/main/java/com/djrapitops/plan/extension/annotation/NumberProvider.java new file mode 100644 index 000000000..d5812f89e --- /dev/null +++ b/Plan/api/src/main/java/com/djrapitops/plan/extension/annotation/NumberProvider.java @@ -0,0 +1,90 @@ +/* + * This file is part of Player Analytics (Plan). + * + * Plan is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License v3 as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Plan is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Plan. If not, see . + */ +package com.djrapitops.plan.extension.annotation; + +import com.djrapitops.plan.extension.FormatType; +import com.djrapitops.plan.extension.icon.Color; +import com.djrapitops.plan.extension.icon.Family; + +/** + * Method annotation to provide a long (64bit number) value about a Player. + *

+ * If you want to return int values, use this provider with a long as + * return type of the method. + *

+ * Usage: {@code @NumberProvider long method(UUID playerUUID)} + * + * @author Rsl1122 + */ +public @interface NumberProvider { + + /** + * Text displayed before the value, limited to 50 characters. + *

+ * Should inform the user what the value represents, for example + * "Owned Chickens", "Claimed Blocks" + * + * @return String of max 50 characters, remainder will be clipped. + */ + String text(); + + /** + * Text displayed when hovering over the value, limited to 150 characters. + *

+ * Should be used to clarify what the value is if not self evident, for example + * text: "Fished", description: "How long the player has fished for" + * + * @return String of max 150 characters, remainder will be clipped. + */ + String description() default ""; + + /** + * Apply special formatting to the value before presentation. + * + * @return {@link FormatType} that best represents the long value. + * @see FormatType for available formatters. + */ + FormatType format() default FormatType.NONE; + + /** + * Name of Font Awesome icon. + *

+ * See https://fontawesome.com/icons?d=gallery&m=free for icons and their {@link Family}. + * + * @return Name of the icon, if name is not valid no icon is shown. + */ + String iconName() default "question"; + + /** + * Family of Font Awesome icon. + *

+ * See https://fontawesome.com/icons?d=gallery&m=free for icons and their {@link Family}. + * + * @return Family that matches an icon, if there is no icon for this family no icon is shown. + */ + Family iconFamily() default Family.SOLID; + + /** + * Color preference of the plugin. + *

+ * This color will be set as the default color to use for plugin's elements. + * + * @return Preferred color. If none are specified defaults are used. + */ + Color iconColor() default Color.NONE; + +}