public abstract class PluginData extends Object
API-section of documentation has examples on the usage of this class and how to register objects extending this class.
Modifier and Type | Field and Description |
---|---|
protected boolean |
analysisOnly
Determines if the datapoint should only be used for the analysis page.
|
protected List<AnalysisType> |
analysisTypes
A list containing the AnalysisType enums that determine what should be
done with the data on the analysis page.
|
protected String |
icon
Font Awesome icon name.
|
protected String |
placeholder
Placeholder string, for example "stepsTaken".
|
protected String |
prefix
Prefix shown before the data, for example "Steps taken: ".
|
protected String |
sourcePlugin
Name of the plugin the data is coming from.
|
protected String |
suffix
Suffix shown after the data, for example " steps".
|
Constructor and Description |
---|
PluginData(String sourcePlugin,
String placeholder)
Constructor for Inspect-page only data point.
|
PluginData(String sourcePlugin,
String placeholder,
AnalysisType... analysisTypes)
Constructor for accepting single, multiple and arrays of AnalysisType.
|
PluginData(String sourcePlugin,
String placeholder,
List<AnalysisType> analysisTypes)
Main constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
analysisOnly()
Used to get the analysisOnly parameter.
|
boolean |
equals(Object o) |
List<AnalysisType> |
getAnalysisTypes()
Returns the list of AnalysisTypes.
|
abstract String |
getHtmlReplaceValue(String modifierPrefix,
UUID uuid)
Used to get the string for the html page.
|
protected String |
getNameOf(UUID uuid) |
String |
getPlaceholder()
Used to get the placeholder without the modifier.
|
String |
getPlaceholder(String modifier)
Used to get the full placeholder.
|
String |
getPlaceholderName()
Used to get the placeholder name.
|
String |
getPlaceholderName(String modifier)
Used to get the placeholder name with modifier.
|
String |
getPrefix()
Used to get the prefix.
|
String |
getSourcePlugin()
Used to get the source plugin's name.
|
String |
getSuffix()
Used to get the suffix.
|
protected Set<UUID> |
getUUIDsBeingAnalyzed() |
abstract Serializable |
getValue(UUID uuid)
Used to get the value for analysis.
|
Map<UUID,Serializable> |
getValues(Collection<UUID> uuids) |
int |
hashCode() |
boolean |
isBanData() |
String |
parseContainer(String modifier,
String contents)
This method should be used with the return values of
getHtmlReplaceValue(String, UUID).
|
void |
setAnalysisOnly(boolean analysisOnly)
Used to set the analysisOnly parameter.
|
void |
setIcon(String iconName)
Used to set the Font Awesome icon.
|
void |
setPrefix(String prefix)
Used to set the prefix.
|
void |
setSuffix(String suffix)
Used to set the suffix.
|
String |
toString() |
protected final List<AnalysisType> analysisTypes
protected final String placeholder
The complete placeholder also includes the plugin name and if analysis is run, a modifier.
Second parameter of any super constructor.
protected final String sourcePlugin
All sources of data with the same sourcePlugin will be placed in the same "box" in the "Plugins" tab.
A box has a max height of 600px, and higher than that will add a scrollbar.
First parameter of any super constructor.
protected boolean analysisOnly
If set to false, the datapoint will be added to the inspect page as well.
protected String icon
http://fontawesome.io/icons/
protected String prefix
protected String suffix
public PluginData(String sourcePlugin, String placeholder, List<AnalysisType> analysisTypes)
Defaults analysisOnly to true.
Defaults icon, prefix and suffix to "".
sourcePlugin
- Name of the plugin the data is coming fromplaceholder
- Placeholder string, for example "stepsTaken"analysisTypes
- A list containing the AnalysisType enums that
determine what should be done with the data on the analysis pagepublic PluginData(String sourcePlugin, String placeholder, AnalysisType... analysisTypes)
sourcePlugin
- Name of the plugin the data is coming fromplaceholder
- Placeholder string, for example "stepsTaken"analysisTypes
- AnalysisType enums that determine what should be
done with the data on the analysis pagepublic final List<AnalysisType> getAnalysisTypes()
Used by Analysis
public final String parseContainer(String modifier, String contents)
It will add the div, icon, modifier, prefix and suffix to the value. Modifier is for example, if calculating AnalysisType.INT_AVG "Average ", it is a text that helps user understand that a calculation has been made.
modifier
- For example "Average " - Determined by value of
AnalysisType's modifier-variable.contents
- The data, number/string/html that should be placed on the
page.AnalysisType
public final String getPlaceholder(String modifier)
Used to avoid conflicts with existing placeholders and placeholders of other plugins.
modifier
- Modifier determined by AnalysisType's
placeholderModifier-variable.AnalysisType
public final String getPlaceholder()
getPlaceholder(String)
public final String getPlaceholderName(String modifier)
getPlaceholder(String)
public final String getPlaceholderName()
getPlaceholder(String)
public final String getSourcePlugin()
public abstract String getHtmlReplaceValue(String modifierPrefix, UUID uuid)
parseContainer(modifierPrefix, value); should be used for all return values so that div, icon, prefix and suffix are added.
This method is used when AnalysisType.HTML is set, or while getting the value for the inspect page.
When using AnalysisType.HTML a random UUID is given, so it should be disregarded. modifierPrefix is empty in that case.
modifierPrefix
- Modifier determined by AnalysisType's
modifier-variable.uuid
- UUID of the player or random UUID if AnalysisType.HTML is
used.public abstract Serializable getValue(UUID uuid)
If the Type and return value mismatch, exception is thrown and the result on the analysis page will say that error occurred as the value.
If a player has no value a -1 should be returned in the case of a Number. -1 is excluded from the Average calculation's size and total.
uuid
- UUID of the player the value belongs to.UnsupportedOperationException
- if implementing class has not overridden the method.public Map<UUID,Serializable> getValues(Collection<UUID> uuids)
public final void setIcon(String iconName)
iconName
- Icon's name http://fontawesome.io/icons/public final void setAnalysisOnly(boolean analysisOnly)
true: only used for Analysis page false: used for both if AnalysisTypes specified, if no AnalysisTypes are specified only used for Inspect page.
analysisOnly
- true/falsepublic final boolean analysisOnly()
public final String getPrefix()
public final void setPrefix(String prefix)
prefix
- for example "Steps Taken: " or a Html start tag.public final String getSuffix()
public final void setSuffix(String suffix)
suffix
- for example " steps" or a html end tag.public final boolean isBanData()
Copyright © 2017. All rights reserved.