Class YamlConfigurationOptions
- java.lang.Object
-
- org.bukkit.configuration.ConfigurationOptions
-
- org.bukkit.configuration.MemoryConfigurationOptions
-
- org.bukkit.configuration.file.FileConfigurationOptions
-
- org.bukkit.configuration.file.YamlConfigurationOptions
-
public class YamlConfigurationOptions extends FileConfigurationOptions
Various settings for controlling the input and output of aYamlConfiguration
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
YamlConfigurationOptions(YamlConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description YamlConfiguration
configuration()
Returns theConfiguration
that this object is responsible for.YamlConfigurationOptions
copyDefaults(boolean value)
Sets if theConfiguration
should copy values from its defaultConfiguration
directly.YamlConfigurationOptions
copyHeader(boolean value)
Sets whether or not the header should be copied from a default source.YamlConfigurationOptions
header(String value)
Sets the header that will be applied to the top of the saved output.int
indent()
Gets how much spaces should be used to indent each line.YamlConfigurationOptions
indent(int value)
Sets how much spaces should be used to indent each line.YamlConfigurationOptions
pathSeparator(char value)
Sets the char that will be used to separateConfigurationSection
s-
Methods inherited from class org.bukkit.configuration.file.FileConfigurationOptions
copyHeader, header
-
Methods inherited from class org.bukkit.configuration.ConfigurationOptions
copyDefaults, pathSeparator
-
-
-
-
Constructor Detail
-
YamlConfigurationOptions
protected YamlConfigurationOptions(@NotNull YamlConfiguration configuration)
-
-
Method Detail
-
configuration
@NotNull public YamlConfiguration configuration()
Description copied from class:ConfigurationOptions
Returns theConfiguration
that this object is responsible for.- Overrides:
configuration
in classFileConfigurationOptions
- Returns:
- Parent configuration
-
copyDefaults
@NotNull public YamlConfigurationOptions copyDefaults(boolean value)
Description copied from class:ConfigurationOptions
Sets if theConfiguration
should copy values from its defaultConfiguration
directly.If this is true, all values in the default Configuration will be directly copied, making it impossible to distinguish between values that were set and values that are provided by default. As a result,
ConfigurationSection.contains(java.lang.String)
will always return the same value asConfigurationSection.isSet(java.lang.String)
. The default value is false.- Overrides:
copyDefaults
in classFileConfigurationOptions
- Parameters:
value
- Whether or not defaults are directly copied- Returns:
- This object, for chaining
-
pathSeparator
@NotNull public YamlConfigurationOptions pathSeparator(char value)
Description copied from class:ConfigurationOptions
Sets the char that will be used to separateConfigurationSection
sThis value does not affect how the
Configuration
is stored, only in how you access the data. The default value is '.'.- Overrides:
pathSeparator
in classFileConfigurationOptions
- Parameters:
value
- Path separator- Returns:
- This object, for chaining
-
header
@NotNull public YamlConfigurationOptions header(@Nullable String value)
Description copied from class:FileConfigurationOptions
Sets the header that will be applied to the top of the saved output.This header will be commented out and applied directly at the top of the generated output of the
FileConfiguration
. It is not required to include a newline at the end of the header as it will automatically be applied, but you may include one if you wish for extra spacing.Null is a valid value which will indicate that no header is to be applied.
- Overrides:
header
in classFileConfigurationOptions
- Parameters:
value
- New header- Returns:
- This object, for chaining
-
copyHeader
@NotNull public YamlConfigurationOptions copyHeader(boolean value)
Description copied from class:FileConfigurationOptions
Sets whether or not the header should be copied from a default source.If this is true, if a default
FileConfiguration
is passed toMemoryConfiguration.setDefaults(org.bukkit.configuration.Configuration)
then upon saving it will use the header from that config, instead of the one provided here.If no default is set on the configuration, or the default is not of type FileConfiguration, or that config has no header (
FileConfigurationOptions.header()
returns null) then the header specified in this configuration will be used.Defaults to true.
- Overrides:
copyHeader
in classFileConfigurationOptions
- Parameters:
value
- Whether or not to copy the header- Returns:
- This object, for chaining
-
indent
public int indent()
Gets how much spaces should be used to indent each line.The minimum value this may be is 2, and the maximum is 9.
- Returns:
- How much to indent by
-
indent
@NotNull public YamlConfigurationOptions indent(int value)
Sets how much spaces should be used to indent each line.The minimum value this may be is 2, and the maximum is 9.
- Parameters:
value
- New indent- Returns:
- This object, for chaining
-
-