Package com.plotsquared.core.plot.flag
Class PlotFlag<T,F extends PlotFlag<T,F>>
java.lang.Object
com.plotsquared.core.plot.flag.PlotFlag<T,F>
- Type Parameters:
T
- Value contained in the flag.
- Direct Known Subclasses:
BooleanFlag
,DenyTeleportFlag
,FlyFlag
,GamemodeFlag
,GuestGamemodeFlag
,KeepFlag
,LiquidFlowFlag
,ListFlag
,MusicFlag
,NumberFlag
,PlotTitleFlag
,StringFlag
,TimedFlag
,TitlesFlag
,WeatherFlag
A plot flag is any property that can be assigned
to a plot, that will alter its functionality in some way.
These are user assignable in-game, or via configuration files.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Deprecated, for removal: This API element is subject to removal in a future version.This method is not meant to be invoked or overridden, with no replacement.final F
createFlagInstance
(@NonNull T value) Create a new instance of the flag using a provided (non-null) value.boolean
protected abstract F
abstract String
An example of a string that would parse into a valid flag value.Get the category this flag belongs to.Get a simple caption that describes the flag usage.getFlagName
(Class<F> flagClass) Return the name of the flag.final String
getName()
Get the flag name.Get the tab completable values associated with the flag type, or an empty collection if tab completion isn't supported.getValue()
Get the flag valueint
hashCode()
boolean
Get if the flag's permission should check for values.abstract F
Merge this flag's value with another value and return an instance holding the merged value.abstract F
Parse a string into a flag, and throw an exception in the case that the string does not represent a valid flag value.abstract String
toString()
Returns a string representation of the flag instance, that when passed throughparse(String)
will result in an equivalent instance of the flag.
-
Constructor Details
-
Method Details
-
getFlagName
Return the name of the flag.- Type Parameters:
T
- Value typeF
- Flag type- Parameters:
flagClass
- Flag class- Returns:
- The name of the flag implemented by the given class
-
getValue
Get the flag value- Returns:
- Non-nullable flag value
-
parse
Parse a string into a flag, and throw an exception in the case that the string does not represent a valid flag value. This instance won't change its state, but instead an instance holding the parsed flag value will be returned.- Parameters:
input
- String to parse.- Returns:
- Parsed value, if valid.
- Throws:
FlagParseException
- If the value could not be parsed.
-
merge
Merge this flag's value with another value and return an instance holding the merged value.- Parameters:
newValue
- New flag value.- Returns:
- Flag containing parsed flag value.
-
toString
Returns a string representation of the flag instance, that when passed throughparse(String)
will result in an equivalent instance of the flag. -
getName
Get the flag name.- Returns:
- Flag name
-
getFlagDescription
Get a simple caption that describes the flag usage.- Returns:
- Flag description.
-
getFlagCategory
Get the category this flag belongs to. Usually a caption fromTranslatableCaption
These categories are used to categorize the flags when outputting flag lists to players.
- Returns:
- Flag category
-
isValuedPermission
Get if the flag's permission should check for values. E.g. plots.flag.set.music.VALUE- Returns:
- if valued permission
- Since:
- 6.0.10
-
getExample
An example of a string that would parse into a valid flag value.- Returns:
- An example flag value.
-
flagOf
-
createFlagInstance
Create a new instance of the flag using a provided (non-null) value.- Parameters:
value
- The flag value- Returns:
- The created flag instance
-
getTabCompletions
Get the tab completable values associated with the flag type, or an empty collection if tab completion isn't supported.- Returns:
- Collection containing tab completable flag values
-
equals
-
hashCode
-
canEqual
Deprecated, for removal: This API element is subject to removal in a future version.This method is not meant to be invoked or overridden, with no replacement.
-