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 TypeMethodDescriptionfinal FcreateFlagInstance(@NonNull T value) Create a new instance of the flag using a provided (non-null) value.booleanprotected abstract Fabstract StringAn 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.getFlagNameComponent(Class<F> flagClass) Gets the flag name as a KyoriComponentfinal StringgetName()Get the flag name.Get the tab completable values associated with the flag type, or an empty collection if tab completion isn't supported.final @NonNull TgetValue()Get the flag valueinthashCode()booleanGet if the flag's permission should check for values.abstract FMerge this flag's value with another value and return an instance holding the merged value.abstract FParse a string into a flag, and throw an exception in the case that the string does not represent a valid flag value.abstract StringtoString()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
-
getFlagNameComponent
Gets the flag name as a KyoriComponent- Since:
- 7.0.0
- See Also:
-
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 fromTranslatableCaptionThese 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
-