001 package org.bukkit.configuration.file; 002 003 import org.apache.commons.lang.Validate; 004 005 /** 006 * Various settings for controlling the input and output of a {@link 007 * YamlConfiguration} 008 */ 009 public class YamlConfigurationOptions extends FileConfigurationOptions { 010 private int indent = 2; 011 012 protected YamlConfigurationOptions(YamlConfiguration configuration) { 013 super(configuration); 014 } 015 016 @Override 017 public YamlConfiguration configuration() { 018 return (YamlConfiguration) super.configuration(); 019 } 020 021 @Override 022 public YamlConfigurationOptions copyDefaults(boolean value) { 023 super.copyDefaults(value); 024 return this; 025 } 026 027 @Override 028 public YamlConfigurationOptions pathSeparator(char value) { 029 super.pathSeparator(value); 030 return this; 031 } 032 033 @Override 034 public YamlConfigurationOptions header(String value) { 035 super.header(value); 036 return this; 037 } 038 039 @Override 040 public YamlConfigurationOptions copyHeader(boolean value) { 041 super.copyHeader(value); 042 return this; 043 } 044 045 /** 046 * Gets how much spaces should be used to indent each line. 047 * <p> 048 * The minimum value this may be is 2, and the maximum is 9. 049 * 050 * @return How much to indent by 051 */ 052 public int indent() { 053 return indent; 054 } 055 056 /** 057 * Sets how much spaces should be used to indent each line. 058 * <p> 059 * The minimum value this may be is 2, and the maximum is 9. 060 * 061 * @param value New indent 062 * @return This object, for chaining 063 */ 064 public YamlConfigurationOptions indent(int value) { 065 Validate.isTrue(value >= 2, "Indent must be at least 2 characters"); 066 Validate.isTrue(value <= 9, "Indent cannot be greater than 9 characters"); 067 068 this.indent = value; 069 return this; 070 } 071 }