Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
YamlConfigurationOptions.java
1 package org.bukkit.configuration.file;
2 
3 import org.apache.commons.lang.Validate;
4 
5 /**
6  * Various settings for controlling the input and output of a {@link
7  * YamlConfiguration}
8  */
10  private int indent = 2;
11 
12  protected YamlConfigurationOptions(YamlConfiguration configuration) {
13  super(configuration);
14  }
15 
16  @Override
17  public YamlConfiguration configuration() {
18  return (YamlConfiguration) super.configuration();
19  }
20 
21  @Override
22  public YamlConfigurationOptions copyDefaults(boolean value) {
23  super.copyDefaults(value);
24  return this;
25  }
26 
27  @Override
28  public YamlConfigurationOptions pathSeparator(char value) {
29  super.pathSeparator(value);
30  return this;
31  }
32 
33  @Override
34  public YamlConfigurationOptions header(String value) {
35  super.header(value);
36  return this;
37  }
38 
39  @Override
40  public YamlConfigurationOptions copyHeader(boolean value) {
41  super.copyHeader(value);
42  return this;
43  }
44 
45  /**
46  * Gets how much spaces should be used to indent each line.
47  * <p>
48  * The minimum value this may be is 2, and the maximum is 9.
49  *
50  * @return How much to indent by
51  */
52  public int indent() {
53  return indent;
54  }
55 
56  /**
57  * Sets how much spaces should be used to indent each line.
58  * <p>
59  * The minimum value this may be is 2, and the maximum is 9.
60  *
61  * @param value New indent
62  * @return This object, for chaining
63  */
64  public YamlConfigurationOptions indent(int value) {
65  Validate.isTrue(value >= 2, "Indent must be at least 2 characters");
66  Validate.isTrue(value <= 9, "Indent cannot be greater than 9 characters");
67 
68  this.indent = value;
69  return this;
70  }
71 }