mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 04:17:44 +01:00
#701: Option to configure the max width of a line in the config
By: Wolf2323 <gabrielpatrikurban@gmail.com>
This commit is contained in:
parent
a4c6cce830
commit
b911613abe
@ -71,6 +71,7 @@ public class YamlConfiguration extends FileConfiguration {
|
||||
@Override
|
||||
public String saveToString() {
|
||||
yamlDumperOptions.setIndent(options().indent());
|
||||
yamlDumperOptions.setWidth(options().width());
|
||||
yamlDumperOptions.setProcessComments(options().parseComments());
|
||||
|
||||
MappingNode node = toNodeTree(this);
|
||||
|
@ -11,6 +11,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class YamlConfigurationOptions extends FileConfigurationOptions {
|
||||
private int indent = 2;
|
||||
private int width = 80;
|
||||
|
||||
protected YamlConfigurationOptions(@NotNull YamlConfiguration configuration) {
|
||||
super(configuration);
|
||||
@ -100,4 +101,25 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
|
||||
this.indent = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets how long a line can be, before it gets split.
|
||||
*
|
||||
* @return How the max line width
|
||||
*/
|
||||
public int width() {
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets how long a line can be, before it gets split.
|
||||
*
|
||||
* @param value New width
|
||||
* @return This object, for chaining
|
||||
*/
|
||||
@NotNull
|
||||
public YamlConfigurationOptions width(int value) {
|
||||
this.width = value;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user