mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +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
|
@Override
|
||||||
public String saveToString() {
|
public String saveToString() {
|
||||||
yamlDumperOptions.setIndent(options().indent());
|
yamlDumperOptions.setIndent(options().indent());
|
||||||
|
yamlDumperOptions.setWidth(options().width());
|
||||||
yamlDumperOptions.setProcessComments(options().parseComments());
|
yamlDumperOptions.setProcessComments(options().parseComments());
|
||||||
|
|
||||||
MappingNode node = toNodeTree(this);
|
MappingNode node = toNodeTree(this);
|
||||||
|
@ -11,6 +11,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class YamlConfigurationOptions extends FileConfigurationOptions {
|
public class YamlConfigurationOptions extends FileConfigurationOptions {
|
||||||
private int indent = 2;
|
private int indent = 2;
|
||||||
|
private int width = 80;
|
||||||
|
|
||||||
protected YamlConfigurationOptions(@NotNull YamlConfiguration configuration) {
|
protected YamlConfigurationOptions(@NotNull YamlConfiguration configuration) {
|
||||||
super(configuration);
|
super(configuration);
|
||||||
@ -100,4 +101,25 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
|
|||||||
this.indent = value;
|
this.indent = value;
|
||||||
return this;
|
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