Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.configuration.MemorySection Class Reference
Inheritance diagram for org.bukkit.configuration.MemorySection:
org.bukkit.configuration.ConfigurationSection org.bukkit.configuration.MemoryConfiguration org.bukkit.configuration.file.FileConfiguration org.bukkit.configuration.file.YamlConfiguration

Public Member Functions

Set< String > getKeys (boolean deep)
 
Map< String, Object > getValues (boolean deep)
 
boolean contains (String path)
 
boolean isSet (String path)
 
String getCurrentPath ()
 
String getName ()
 
Configuration getRoot ()
 
ConfigurationSection getParent ()
 
void addDefault (String path, Object value)
 
ConfigurationSection getDefaultSection ()
 
void set (String path, Object value)
 
Object get (String path)
 
Object get (String path, Object def)
 
ConfigurationSection createSection (String path)
 
ConfigurationSection createSection (String path, Map<?,?> map)
 
String getString (String path)
 
String getString (String path, String def)
 
boolean isString (String path)
 
int getInt (String path)
 
int getInt (String path, int def)
 
boolean isInt (String path)
 
boolean getBoolean (String path)
 
boolean getBoolean (String path, boolean def)
 
boolean isBoolean (String path)
 
double getDouble (String path)
 
double getDouble (String path, double def)
 
boolean isDouble (String path)
 
long getLong (String path)
 
long getLong (String path, long def)
 
boolean isLong (String path)
 
List<?> getList (String path)
 
List<?> getList (String path, List<?> def)
 
boolean isList (String path)
 
List< String > getStringList (String path)
 
List< Integer > getIntegerList (String path)
 
List< Boolean > getBooleanList (String path)
 
List< Double > getDoubleList (String path)
 
List< Float > getFloatList (String path)
 
List< Long > getLongList (String path)
 
List< Byte > getByteList (String path)
 
List< Character > getCharacterList (String path)
 
List< Short > getShortList (String path)
 
List< Map<?,?> > getMapList (String path)
 
Vector getVector (String path)
 
Vector getVector (String path, Vector def)
 
boolean isVector (String path)
 
OfflinePlayer getOfflinePlayer (String path)
 
OfflinePlayer getOfflinePlayer (String path, OfflinePlayer def)
 
boolean isOfflinePlayer (String path)
 
ItemStack getItemStack (String path)
 
ItemStack getItemStack (String path, ItemStack def)
 
boolean isItemStack (String path)
 
Color getColor (String path)
 
Color getColor (String path, Color def)
 
boolean isColor (String path)
 
ConfigurationSection getConfigurationSection (String path)
 
boolean isConfigurationSection (String path)
 
String toString ()
 

Static Public Member Functions

static String createPath (ConfigurationSection section, String key)
 
static String createPath (ConfigurationSection section, String key, ConfigurationSection relativeTo)
 

Protected Member Functions

 MemorySection ()
 
 MemorySection (ConfigurationSection parent, String path)
 
boolean isPrimitiveWrapper (Object input)
 
Object getDefault (String path)
 
void mapChildrenKeys (Set< String > output, ConfigurationSection section, boolean deep)
 
void mapChildrenValues (Map< String, Object > output, ConfigurationSection section, boolean deep)
 

Protected Attributes

final Map< String, Object > map = new LinkedHashMap<String, Object>()
 

Detailed Description

A type of ConfigurationSection that is stored in memory.

Definition at line 21 of file MemorySection.java.

Constructor & Destructor Documentation

org.bukkit.configuration.MemorySection.MemorySection ( )
protected

Creates an empty MemorySection for use as a root Configuration section.

Note that calling this without being yourself a Configuration will throw an exception!

Exceptions
IllegalStateExceptionThrown if this is not a Configuration root.

Definition at line 38 of file MemorySection.java.

Referenced by org.bukkit.configuration.MemorySection.createSection().

38  {
39  if (!(this instanceof Configuration)) {
40  throw new IllegalStateException("Cannot construct a root MemorySection when not a Configuration");
41  }
42 
43  this.path = "";
44  this.fullPath = "";
45  this.parent = null;
46  this.root = (Configuration) this;
47  }
org.bukkit.configuration.MemorySection.MemorySection ( ConfigurationSection  parent,
String  path 
)
protected

Creates an empty MemorySection with the specified parent and path.

Parameters
parentParent section that contains this own section.
pathPath that you may access this section from via the root Configuration.
Exceptions
IllegalArgumentExceptionThrown is parent or path is null, or if parent contains no root Configuration.

Definition at line 58 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.createPath(), and org.bukkit.configuration.ConfigurationSection.getRoot().

58  {
59  Validate.notNull(parent, "Parent cannot be null");
60  Validate.notNull(path, "Path cannot be null");
61 
62  this.path = path;
63  this.parent = parent;
64  this.root = parent.getRoot();
65 
66  Validate.notNull(root, "Path cannot be orphaned");
67 
68  this.fullPath = createPath(parent, path);
69  }
static String createPath(ConfigurationSection section, String key)

Member Function Documentation

void org.bukkit.configuration.MemorySection.addDefault ( String  path,
Object  value 
)

Sets the default value in the root at the given path as provided.

If no source Configuration was provided as a default collection, then a new MemoryConfiguration will be created to hold the new default value.

If value is null, the value will be removed from the default Configuration source.

If the value as returned by getDefaultSection() is null, then this will create a new section at the path, replacing anything that may have existed there previously.

Parameters
pathPath of the value to set.
valueValue to set the default to.
Exceptions
IllegalArgumentExceptionThrown if path is null.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 136 of file MemorySection.java.

References org.bukkit.configuration.Configuration.addDefault(), org.bukkit.configuration.MemorySection.createPath(), and org.bukkit.configuration.MemorySection.getRoot().

136  {
137  Validate.notNull(path, "Path cannot be null");
138 
139  Configuration root = getRoot();
140  if (root == null) {
141  throw new IllegalStateException("Cannot add default without root");
142  }
143  if (root == this) {
144  throw new UnsupportedOperationException("Unsupported addDefault(String, Object) implementation");
145  }
146  root.addDefault(createPath(this, path), value);
147  }
static String createPath(ConfigurationSection section, String key)
boolean org.bukkit.configuration.MemorySection.contains ( String  path)

Checks if this ConfigurationSection contains the given path.

If the value for the requested path does not exist but a default value has been specified, this will return true.

Parameters
pathPath to check for existence.
Returns
True if this section contains the requested path, either via default or being set.
Exceptions
IllegalArgumentExceptionThrown when path is null.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 105 of file MemorySection.java.

Referenced by org.bukkit.configuration.MemorySection.isSet().

105  {
106  return get(path) != null;
107  }
static String org.bukkit.configuration.MemorySection.createPath ( ConfigurationSection  section,
String  key 
)
static

Creates a full path to the given ConfigurationSection from its root Configuration.

You may use this method for any given ConfigurationSection, not only MemorySection.

Parameters
sectionSection to create a path for.
keyName of the specified section.
Returns
Full path of the section from its root.

Definition at line 762 of file MemorySection.java.

References org.bukkit.configuration.ConfigurationSection.getRoot().

Referenced by org.bukkit.configuration.MemorySection.addDefault(), and org.bukkit.configuration.MemorySection.MemorySection().

762  {
763  return createPath(section, key, (section == null) ? null : section.getRoot());
764  }
static String createPath(ConfigurationSection section, String key)
static String org.bukkit.configuration.MemorySection.createPath ( ConfigurationSection  section,
String  key,
ConfigurationSection  relativeTo 
)
static

Creates a relative path to the given ConfigurationSection from the given relative section.

You may use this method for any given ConfigurationSection, not only MemorySection.

Parameters
sectionSection to create a path for.
keyName of the specified section.
relativeToSection to create the path relative to.
Returns
Full path of the section from its root.

Definition at line 778 of file MemorySection.java.

References org.bukkit.configuration.ConfigurationSection.getName(), org.bukkit.configuration.ConfigurationSection.getParent(), org.bukkit.configuration.ConfigurationSection.getRoot(), and org.bukkit.configuration.Configuration.options().

778  {
779  Validate.notNull(section, "Cannot create path without a section");
780  Configuration root = section.getRoot();
781  if (root == null) {
782  throw new IllegalStateException("Cannot create path without a root");
783  }
784  char separator = root.options().pathSeparator();
785 
786  StringBuilder builder = new StringBuilder();
787  if (section != null) {
788  for (ConfigurationSection parent = section; (parent != null) && (parent != relativeTo); parent = parent.getParent()) {
789  if (builder.length() > 0) {
790  builder.insert(0, separator);
791  }
792 
793  builder.insert(0, parent.getName());
794  }
795  }
796 
797  if ((key != null) && (key.length() > 0)) {
798  if (builder.length() > 0) {
799  builder.append(separator);
800  }
801 
802  builder.append(key);
803  }
804 
805  return builder.toString();
806  }
ConfigurationSection org.bukkit.configuration.MemorySection.createSection ( String  path)

Creates an empty ConfigurationSection at the specified path.

Any value that was previously set at this path will be overwritten. If the previous value was itself a ConfigurationSection, it will be orphaned.

Parameters
pathPath to create the section at.
Returns
Newly created section

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 233 of file MemorySection.java.

References org.bukkit.configuration.ConfigurationSection.createSection(), org.bukkit.configuration.ConfigurationSection.getConfigurationSection(), org.bukkit.configuration.MemorySection.getRoot(), org.bukkit.configuration.MemorySection.MemorySection(), and org.bukkit.configuration.Configuration.options().

Referenced by org.bukkit.configuration.MemorySection.createSection(), and org.bukkit.configuration.MemorySection.getConfigurationSection().

233  {
234  Validate.notEmpty(path, "Cannot create section at empty path");
235  Configuration root = getRoot();
236  if (root == null) {
237  throw new IllegalStateException("Cannot create section without a root");
238  }
239 
240  final char separator = root.options().pathSeparator();
241  // i1 is the leading (higher) index
242  // i2 is the trailing (lower) index
243  int i1 = -1, i2;
244  ConfigurationSection section = this;
245  while ((i1 = path.indexOf(separator, i2 = i1 + 1)) != -1) {
246  String node = path.substring(i2, i1);
247  ConfigurationSection subSection = section.getConfigurationSection(node);
248  if (subSection == null) {
249  section = section.createSection(node);
250  } else {
251  section = subSection;
252  }
253  }
254 
255  String key = path.substring(i2);
256  if (section == this) {
257  ConfigurationSection result = new MemorySection(this, key);
258  map.put(key, result);
259  return result;
260  }
261  return section.createSection(key);
262  }
ConfigurationSection org.bukkit.configuration.MemorySection.createSection ( String  path,
Map<?,?>  map 
)

Creates a ConfigurationSection at the specified path, with specified values.

Any value that was previously set at this path will be overwritten. If the previous value was itself a ConfigurationSection, it will be orphaned.

Parameters
pathPath to create the section at.
mapThe values to used.
Returns
Newly created section

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 264 of file MemorySection.java.

References org.bukkit.configuration.ConfigurationSection.createSection(), org.bukkit.configuration.MemorySection.createSection(), and org.bukkit.configuration.ConfigurationSection.set().

264  {
265  ConfigurationSection section = createSection(path);
266 
267  for (Map.Entry<?, ?> entry : map.entrySet()) {
268  if (entry.getValue() instanceof Map) {
269  section.createSection(entry.getKey().toString(), (Map<?, ?>) entry.getValue());
270  } else {
271  section.set(entry.getKey().toString(), entry.getValue());
272  }
273  }
274 
275  return section;
276  }
ConfigurationSection createSection(String path)
Object org.bukkit.configuration.MemorySection.get ( String  path)

Gets the requested Object by path.

If the Object does not exist but a default value has been specified, this will return the default value. If the Object does not exist and no default value was specified, this will return null.

Parameters
pathPath of the Object to get.
Returns
Requested Object.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 197 of file MemorySection.java.

197  {
198  return get(path, getDefault(path));
199  }
Object org.bukkit.configuration.MemorySection.get ( String  path,
Object  def 
)

Gets the requested Object by path, returning a default value if not found.

If the Object does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

Parameters
pathPath of the Object to get.
defThe default value to return if the path is not found.
Returns
Requested Object.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 201 of file MemorySection.java.

References org.bukkit.configuration.ConfigurationSection.get(), org.bukkit.configuration.ConfigurationSection.getConfigurationSection(), org.bukkit.configuration.MemorySection.getRoot(), and org.bukkit.configuration.Configuration.options().

201  {
202  Validate.notNull(path, "Path cannot be null");
203 
204  if (path.length() == 0) {
205  return this;
206  }
207 
208  Configuration root = getRoot();
209  if (root == null) {
210  throw new IllegalStateException("Cannot access section without a root");
211  }
212 
213  final char separator = root.options().pathSeparator();
214  // i1 is the leading (higher) index
215  // i2 is the trailing (lower) index
216  int i1 = -1, i2;
217  ConfigurationSection section = this;
218  while ((i1 = path.indexOf(separator, i2 = i1 + 1)) != -1) {
219  section = section.getConfigurationSection(path.substring(i2, i1));
220  if (section == null) {
221  return def;
222  }
223  }
224 
225  String key = path.substring(i2);
226  if (section == this) {
227  Object result = map.get(key);
228  return (result == null) ? def : result;
229  }
230  return section.get(key, def);
231  }
boolean org.bukkit.configuration.MemorySection.getBoolean ( String  path)

Gets the requested boolean by path.

If the boolean does not exist but a default value has been specified, this will return the default value. If the boolean does not exist and no default value was specified, this will return false.

Parameters
pathPath of the boolean to get.
Returns
Requested boolean.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 309 of file MemorySection.java.

309  {
310  Object def = getDefault(path);
311  return getBoolean(path, (def instanceof Boolean) ? (Boolean) def : false);
312  }
boolean org.bukkit.configuration.MemorySection.getBoolean ( String  path,
boolean  def 
)

Gets the requested boolean by path, returning a default value if not found.

If the boolean does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

Parameters
pathPath of the boolean to get.
defThe default value to return if the path is not found or is not a boolean.
Returns
Requested boolean.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 314 of file MemorySection.java.

314  {
315  Object val = get(path, def);
316  return (val instanceof Boolean) ? (Boolean) val : def;
317  }
List<Boolean> org.bukkit.configuration.MemorySection.getBooleanList ( String  path)

Gets the requested List of Boolean by path.

If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

This method will attempt to cast any values into a Boolean if possible, but may miss any values out if they are not compatible.

Parameters
pathPath of the List to get.
Returns
Requested List of Boolean.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 415 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getList().

415  {
416  List<?> list = getList(path);
417 
418  if (list == null) {
419  return new ArrayList<Boolean>(0);
420  }
421 
422  List<Boolean> result = new ArrayList<Boolean>();
423 
424  for (Object object : list) {
425  if (object instanceof Boolean) {
426  result.add((Boolean) object);
427  } else if (object instanceof String) {
428  if (Boolean.TRUE.toString().equals(object)) {
429  result.add(true);
430  } else if (Boolean.FALSE.toString().equals(object)) {
431  result.add(false);
432  }
433  }
434  }
435 
436  return result;
437  }
List<Byte> org.bukkit.configuration.MemorySection.getByteList ( String  path)

Gets the requested List of Byte by path.

If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

This method will attempt to cast any values into a Byte if possible, but may miss any values out if they are not compatible.

Parameters
pathPath of the List to get.
Returns
Requested List of Byte.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 520 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getList().

520  {
521  List<?> list = getList(path);
522 
523  if (list == null) {
524  return new ArrayList<Byte>(0);
525  }
526 
527  List<Byte> result = new ArrayList<Byte>();
528 
529  for (Object object : list) {
530  if (object instanceof Byte) {
531  result.add((Byte) object);
532  } else if (object instanceof String) {
533  try {
534  result.add(Byte.valueOf((String) object));
535  } catch (Exception ex) {
536  }
537  } else if (object instanceof Character) {
538  result.add((byte) ((Character) object).charValue());
539  } else if (object instanceof Number) {
540  result.add(((Number) object).byteValue());
541  }
542  }
543 
544  return result;
545  }
List<Character> org.bukkit.configuration.MemorySection.getCharacterList ( String  path)

Gets the requested List of Character by path.

If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

This method will attempt to cast any values into a Character if possible, but may miss any values out if they are not compatible.

Parameters
pathPath of the List to get.
Returns
Requested List of Character.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 547 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getList().

547  {
548  List<?> list = getList(path);
549 
550  if (list == null) {
551  return new ArrayList<Character>(0);
552  }
553 
554  List<Character> result = new ArrayList<Character>();
555 
556  for (Object object : list) {
557  if (object instanceof Character) {
558  result.add((Character) object);
559  } else if (object instanceof String) {
560  String str = (String) object;
561 
562  if (str.length() == 1) {
563  result.add(str.charAt(0));
564  }
565  } else if (object instanceof Number) {
566  result.add((char) ((Number) object).intValue());
567  }
568  }
569 
570  return result;
571  }
Color org.bukkit.configuration.MemorySection.getColor ( String  path)

Gets the requested Color by path.

If the Color does not exist but a default value has been specified, this will return the default value. If the Color does not exist and no default value was specified, this will return null.

Parameters
pathPath of the Color to get.
Returns
Requested Color.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 663 of file MemorySection.java.

663  {
664  Object def = getDefault(path);
665  return getColor(path, (def instanceof Color) ? (Color) def : null);
666  }
Color org.bukkit.configuration.MemorySection.getColor ( String  path,
Color  def 
)

Gets the requested Color by path, returning a default value if not found.

If the Color does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

Parameters
pathPath of the Color to get.
defThe default value to return if the path is not found or is not a Color.
Returns
Requested Color.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 668 of file MemorySection.java.

668  {
669  Object val = get(path, def);
670  return (val instanceof Color) ? (Color) val : def;
671  }
ConfigurationSection org.bukkit.configuration.MemorySection.getConfigurationSection ( String  path)

Gets the requested ConfigurationSection by path.

If the ConfigurationSection does not exist but a default value has been specified, this will return the default value. If the ConfigurationSection does not exist and no default value was specified, this will return null.

Parameters
pathPath of the ConfigurationSection to get.
Returns
Requested ConfigurationSection.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 678 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.createSection().

678  {
679  Object val = get(path, null);
680  if (val != null) {
681  return (val instanceof ConfigurationSection) ? (ConfigurationSection) val : null;
682  }
683 
684  val = get(path, getDefault(path));
685  return (val instanceof ConfigurationSection) ? createSection(path) : null;
686  }
ConfigurationSection createSection(String path)
String org.bukkit.configuration.MemorySection.getCurrentPath ( )

Gets the path of this ConfigurationSection from its root Configuration

For any Configuration themselves, this will return an empty string.

If the section is no longer contained within its root for any reason, such as being replaced with a different value, this may return null.

To retrieve the single name of this section, that is, the final part of the path returned by this method, you may use getName().

Returns
Path of this section relative to its root

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 120 of file MemorySection.java.

Referenced by org.bukkit.configuration.MemorySection.getDefaultSection().

120  {
121  return fullPath;
122  }
ConfigurationSection org.bukkit.configuration.MemorySection.getDefaultSection ( )

Gets the equivalent ConfigurationSection from the default Configuration defined in getRoot().

If the root contains no defaults, or the defaults doesn't contain a value for this path, or the value at this path is not a ConfigurationSection then this will return null.

Returns
Equivalent section in root configuration

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 149 of file MemorySection.java.

References org.bukkit.configuration.ConfigurationSection.getConfigurationSection(), org.bukkit.configuration.MemorySection.getCurrentPath(), org.bukkit.configuration.Configuration.getDefaults(), org.bukkit.configuration.MemorySection.getRoot(), and org.bukkit.configuration.ConfigurationSection.isConfigurationSection().

Referenced by org.bukkit.configuration.MemorySection.getKeys(), and org.bukkit.configuration.MemorySection.getValues().

149  {
150  Configuration root = getRoot();
151  Configuration defaults = root == null ? null : root.getDefaults();
152 
153  if (defaults != null) {
154  if (defaults.isConfigurationSection(getCurrentPath())) {
155  return defaults.getConfigurationSection(getCurrentPath());
156  }
157  }
158 
159  return null;
160  }
double org.bukkit.configuration.MemorySection.getDouble ( String  path)

Gets the requested double by path.

If the double does not exist but a default value has been specified, this will return the default value. If the double does not exist and no default value was specified, this will return 0.

Parameters
pathPath of the double to get.
Returns
Requested double.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 324 of file MemorySection.java.

324  {
325  Object def = getDefault(path);
326  return getDouble(path, (def instanceof Number) ? toDouble(def) : 0);
327  }
double org.bukkit.configuration.MemorySection.getDouble ( String  path,
double  def 
)

Gets the requested double by path, returning a default value if not found.

If the double does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

Parameters
pathPath of the double to get.
defThe default value to return if the path is not found or is not a double.
Returns
Requested double.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 329 of file MemorySection.java.

329  {
330  Object val = get(path, def);
331  return (val instanceof Number) ? toDouble(val) : def;
332  }
List<Double> org.bukkit.configuration.MemorySection.getDoubleList ( String  path)

Gets the requested List of Double by path.

If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

This method will attempt to cast any values into a Double if possible, but may miss any values out if they are not compatible.

Parameters
pathPath of the List to get.
Returns
Requested List of Double.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 439 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getList().

439  {
440  List<?> list = getList(path);
441 
442  if (list == null) {
443  return new ArrayList<Double>(0);
444  }
445 
446  List<Double> result = new ArrayList<Double>();
447 
448  for (Object object : list) {
449  if (object instanceof Double) {
450  result.add((Double) object);
451  } else if (object instanceof String) {
452  try {
453  result.add(Double.valueOf((String) object));
454  } catch (Exception ex) {
455  }
456  } else if (object instanceof Character) {
457  result.add((double) ((Character) object).charValue());
458  } else if (object instanceof Number) {
459  result.add(((Number) object).doubleValue());
460  }
461  }
462 
463  return result;
464  }
List<Float> org.bukkit.configuration.MemorySection.getFloatList ( String  path)

Gets the requested List of Float by path.

If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

This method will attempt to cast any values into a Float if possible, but may miss any values out if they are not compatible.

Parameters
pathPath of the List to get.
Returns
Requested List of Float.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 466 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getList().

466  {
467  List<?> list = getList(path);
468 
469  if (list == null) {
470  return new ArrayList<Float>(0);
471  }
472 
473  List<Float> result = new ArrayList<Float>();
474 
475  for (Object object : list) {
476  if (object instanceof Float) {
477  result.add((Float) object);
478  } else if (object instanceof String) {
479  try {
480  result.add(Float.valueOf((String) object));
481  } catch (Exception ex) {
482  }
483  } else if (object instanceof Character) {
484  result.add((float) ((Character) object).charValue());
485  } else if (object instanceof Number) {
486  result.add(((Number) object).floatValue());
487  }
488  }
489 
490  return result;
491  }
int org.bukkit.configuration.MemorySection.getInt ( String  path)

Gets the requested int by path.

If the int does not exist but a default value has been specified, this will return the default value. If the int does not exist and no default value was specified, this will return 0.

Parameters
pathPath of the int to get.
Returns
Requested int.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 294 of file MemorySection.java.

294  {
295  Object def = getDefault(path);
296  return getInt(path, (def instanceof Number) ? toInt(def) : 0);
297  }
int org.bukkit.configuration.MemorySection.getInt ( String  path,
int  def 
)

Gets the requested int by path, returning a default value if not found.

If the int does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

Parameters
pathPath of the int to get.
defThe default value to return if the path is not found or is not an int.
Returns
Requested int.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 299 of file MemorySection.java.

299  {
300  Object val = get(path, def);
301  return (val instanceof Number) ? toInt(val) : def;
302  }
List<Integer> org.bukkit.configuration.MemorySection.getIntegerList ( String  path)

Gets the requested List of Integer by path.

If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

This method will attempt to cast any values into a Integer if possible, but may miss any values out if they are not compatible.

Parameters
pathPath of the List to get.
Returns
Requested List of Integer.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 388 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getList().

388  {
389  List<?> list = getList(path);
390 
391  if (list == null) {
392  return new ArrayList<Integer>(0);
393  }
394 
395  List<Integer> result = new ArrayList<Integer>();
396 
397  for (Object object : list) {
398  if (object instanceof Integer) {
399  result.add((Integer) object);
400  } else if (object instanceof String) {
401  try {
402  result.add(Integer.valueOf((String) object));
403  } catch (Exception ex) {
404  }
405  } else if (object instanceof Character) {
406  result.add((int) ((Character) object).charValue());
407  } else if (object instanceof Number) {
408  result.add(((Number) object).intValue());
409  }
410  }
411 
412  return result;
413  }
ItemStack org.bukkit.configuration.MemorySection.getItemStack ( String  path)

Gets the requested ItemStack by path.

If the ItemStack does not exist but a default value has been specified, this will return the default value. If the ItemStack does not exist and no default value was specified, this will return null.

Parameters
pathPath of the ItemStack to get.
Returns
Requested ItemStack.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 648 of file MemorySection.java.

648  {
649  Object def = getDefault(path);
650  return getItemStack(path, (def instanceof ItemStack) ? (ItemStack) def : null);
651  }
ItemStack org.bukkit.configuration.MemorySection.getItemStack ( String  path,
ItemStack  def 
)

Gets the requested ItemStack by path, returning a default value if not found.

If the ItemStack does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

Parameters
pathPath of the ItemStack to get.
defThe default value to return if the path is not found or is not an ItemStack.
Returns
Requested ItemStack.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 653 of file MemorySection.java.

653  {
654  Object val = get(path, def);
655  return (val instanceof ItemStack) ? (ItemStack) val : def;
656  }
Set<String> org.bukkit.configuration.MemorySection.getKeys ( boolean  deep)

Gets a set containing all keys in this section.

If deep is set to true, then this will contain all the keys within any child ConfigurationSections (and their children, etc). These will be in a valid path notation for you to use.

If deep is set to false, then this will contain only the keys of any direct children, and not their own children.

Parameters
deepWhether or not to get a deep list, as opposed to a shallow list.
Returns
Set of keys contained within this ConfigurationSection.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 71 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getDefaultSection(), org.bukkit.configuration.ConfigurationSection.getKeys(), and org.bukkit.configuration.MemorySection.getRoot().

71  {
72  Set<String> result = new LinkedHashSet<String>();
73 
74  Configuration root = getRoot();
75  if (root != null && root.options().copyDefaults()) {
76  ConfigurationSection defaults = getDefaultSection();
77 
78  if (defaults != null) {
79  result.addAll(defaults.getKeys(deep));
80  }
81  }
82 
83  mapChildrenKeys(result, this, deep);
84 
85  return result;
86  }
ConfigurationSection getDefaultSection()
List<?> org.bukkit.configuration.MemorySection.getList ( String  path)

Gets the requested List by path.

If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return null.

Parameters
pathPath of the List to get.
Returns
Requested List.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 355 of file MemorySection.java.

Referenced by org.bukkit.configuration.MemorySection.getBooleanList(), org.bukkit.configuration.MemorySection.getByteList(), org.bukkit.configuration.MemorySection.getCharacterList(), org.bukkit.configuration.MemorySection.getDoubleList(), org.bukkit.configuration.MemorySection.getFloatList(), org.bukkit.configuration.MemorySection.getIntegerList(), org.bukkit.configuration.MemorySection.getLongList(), org.bukkit.configuration.MemorySection.getMapList(), org.bukkit.configuration.MemorySection.getShortList(), and org.bukkit.configuration.MemorySection.getStringList().

355  {
356  Object def = getDefault(path);
357  return getList(path, (def instanceof List) ? (List<?>) def : null);
358  }
List<?> org.bukkit.configuration.MemorySection.getList ( String  path,
List<?>  def 
)

Gets the requested List by path, returning a default value if not found.

If the List does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

Parameters
pathPath of the List to get.
defThe default value to return if the path is not found or is not a List.
Returns
Requested List.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 360 of file MemorySection.java.

360  {
361  Object val = get(path, def);
362  return (List<?>) ((val instanceof List) ? val : def);
363  }
long org.bukkit.configuration.MemorySection.getLong ( String  path)

Gets the requested long by path.

If the long does not exist but a default value has been specified, this will return the default value. If the long does not exist and no default value was specified, this will return 0.

Parameters
pathPath of the long to get.
Returns
Requested long.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 339 of file MemorySection.java.

339  {
340  Object def = getDefault(path);
341  return getLong(path, (def instanceof Number) ? toLong(def) : 0);
342  }
long org.bukkit.configuration.MemorySection.getLong ( String  path,
long  def 
)

Gets the requested long by path, returning a default value if not found.

If the long does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

Parameters
pathPath of the long to get.
defThe default value to return if the path is not found or is not a long.
Returns
Requested long.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 344 of file MemorySection.java.

344  {
345  Object val = get(path, def);
346  return (val instanceof Number) ? toLong(val) : def;
347  }
List<Long> org.bukkit.configuration.MemorySection.getLongList ( String  path)

Gets the requested List of Long by path.

If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

This method will attempt to cast any values into a Long if possible, but may miss any values out if they are not compatible.

Parameters
pathPath of the List to get.
Returns
Requested List of Long.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 493 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getList().

493  {
494  List<?> list = getList(path);
495 
496  if (list == null) {
497  return new ArrayList<Long>(0);
498  }
499 
500  List<Long> result = new ArrayList<Long>();
501 
502  for (Object object : list) {
503  if (object instanceof Long) {
504  result.add((Long) object);
505  } else if (object instanceof String) {
506  try {
507  result.add(Long.valueOf((String) object));
508  } catch (Exception ex) {
509  }
510  } else if (object instanceof Character) {
511  result.add((long) ((Character) object).charValue());
512  } else if (object instanceof Number) {
513  result.add(((Number) object).longValue());
514  }
515  }
516 
517  return result;
518  }
List<Map<?, ?> > org.bukkit.configuration.MemorySection.getMapList ( String  path)

Gets the requested List of Maps by path.

If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

This method will attempt to cast any values into a Map if possible, but may miss any values out if they are not compatible.

Parameters
pathPath of the List to get.
Returns
Requested List of Maps.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 600 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getList().

600  {
601  List<?> list = getList(path);
602  List<Map<?, ?>> result = new ArrayList<Map<?, ?>>();
603 
604  if (list == null) {
605  return result;
606  }
607 
608  for (Object object : list) {
609  if (object instanceof Map) {
610  result.add((Map<?, ?>) object);
611  }
612  }
613 
614  return result;
615  }
String org.bukkit.configuration.MemorySection.getName ( )

Gets the name of this individual ConfigurationSection, in the path.

This will always be the final part of getCurrentPath(), unless the section is orphaned.

Returns
Name of this section

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 124 of file MemorySection.java.

124  {
125  return path;
126  }
OfflinePlayer org.bukkit.configuration.MemorySection.getOfflinePlayer ( String  path)

Gets the requested OfflinePlayer by path.

If the OfflinePlayer does not exist but a default value has been specified, this will return the default value. If the OfflinePlayer does not exist and no default value was specified, this will return null.

Parameters
pathPath of the OfflinePlayer to get.
Returns
Requested OfflinePlayer.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 633 of file MemorySection.java.

633  {
634  Object def = getDefault(path);
635  return getOfflinePlayer(path, (def instanceof OfflinePlayer) ? (OfflinePlayer) def : null);
636  }
OfflinePlayer getOfflinePlayer(String path)
OfflinePlayer org.bukkit.configuration.MemorySection.getOfflinePlayer ( String  path,
OfflinePlayer  def 
)

Gets the requested OfflinePlayer by path, returning a default value if not found.

If the OfflinePlayer does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

Parameters
pathPath of the OfflinePlayer to get.
defThe default value to return if the path is not found or is not an OfflinePlayer.
Returns
Requested OfflinePlayer.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 638 of file MemorySection.java.

638  {
639  Object val = get(path, def);
640  return (val instanceof OfflinePlayer) ? (OfflinePlayer) val : def;
641  }
ConfigurationSection org.bukkit.configuration.MemorySection.getParent ( )

Gets the parent ConfigurationSection that directly contains this ConfigurationSection.

For any Configuration themselves, this will return null.

If the section is no longer contained within its parent for any reason, such as being replaced with a different value, this may return null.

Returns
Parent section containing this section.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 132 of file MemorySection.java.

132  {
133  return parent;
134  }
Configuration org.bukkit.configuration.MemorySection.getRoot ( )

Gets the root Configuration that contains this ConfigurationSection

For any Configuration themselves, this will return its own object.

If the section is no longer contained within its root for any reason, such as being replaced with a different value, this may return null.

Returns
Root configuration containing this section.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 128 of file MemorySection.java.

Referenced by org.bukkit.configuration.MemorySection.addDefault(), org.bukkit.configuration.MemorySection.createSection(), org.bukkit.configuration.MemorySection.get(), org.bukkit.configuration.MemorySection.getDefaultSection(), org.bukkit.configuration.MemorySection.getKeys(), org.bukkit.configuration.MemorySection.getValues(), org.bukkit.configuration.MemorySection.isSet(), and org.bukkit.configuration.MemorySection.set().

128  {
129  return root;
130  }
List<Short> org.bukkit.configuration.MemorySection.getShortList ( String  path)

Gets the requested List of Short by path.

If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

This method will attempt to cast any values into a Short if possible, but may miss any values out if they are not compatible.

Parameters
pathPath of the List to get.
Returns
Requested List of Short.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 573 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getList().

573  {
574  List<?> list = getList(path);
575 
576  if (list == null) {
577  return new ArrayList<Short>(0);
578  }
579 
580  List<Short> result = new ArrayList<Short>();
581 
582  for (Object object : list) {
583  if (object instanceof Short) {
584  result.add((Short) object);
585  } else if (object instanceof String) {
586  try {
587  result.add(Short.valueOf((String) object));
588  } catch (Exception ex) {
589  }
590  } else if (object instanceof Character) {
591  result.add((short) ((Character) object).charValue());
592  } else if (object instanceof Number) {
593  result.add(((Number) object).shortValue());
594  }
595  }
596 
597  return result;
598  }
String org.bukkit.configuration.MemorySection.getString ( String  path)

Gets the requested String by path.

If the String does not exist but a default value has been specified, this will return the default value. If the String does not exist and no default value was specified, this will return null.

Parameters
pathPath of the String to get.
Returns
Requested String.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 279 of file MemorySection.java.

279  {
280  Object def = getDefault(path);
281  return getString(path, def != null ? def.toString() : null);
282  }
String org.bukkit.configuration.MemorySection.getString ( String  path,
String  def 
)

Gets the requested String by path, returning a default value if not found.

If the String does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

Parameters
pathPath of the String to get.
defThe default value to return if the path is not found or is not a String.
Returns
Requested String.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 284 of file MemorySection.java.

284  {
285  Object val = get(path, def);
286  return (val != null) ? val.toString() : def;
287  }
List<String> org.bukkit.configuration.MemorySection.getStringList ( String  path)

Gets the requested List of String by path.

If the List does not exist but a default value has been specified, this will return the default value. If the List does not exist and no default value was specified, this will return an empty List.

This method will attempt to cast any values into a String if possible, but may miss any values out if they are not compatible.

Parameters
pathPath of the List to get.
Returns
Requested List of String.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 370 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getList().

370  {
371  List<?> list = getList(path);
372 
373  if (list == null) {
374  return new ArrayList<String>(0);
375  }
376 
377  List<String> result = new ArrayList<String>();
378 
379  for (Object object : list) {
380  if ((object instanceof String) || (isPrimitiveWrapper(object))) {
381  result.add(String.valueOf(object));
382  }
383  }
384 
385  return result;
386  }
Map<String, Object> org.bukkit.configuration.MemorySection.getValues ( boolean  deep)

Gets a Map containing all keys and their values for this section.

If deep is set to true, then this will contain all the keys and values within any child ConfigurationSections (and their children, etc). These keys will be in a valid path notation for you to use.

If deep is set to false, then this will contain only the keys and values of any direct children, and not their own children.

Parameters
deepWhether or not to get a deep list, as opposed to a shallow list.
Returns
Map of keys and values of this section.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 88 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.getDefaultSection(), org.bukkit.configuration.MemorySection.getRoot(), and org.bukkit.configuration.ConfigurationSection.getValues().

88  {
89  Map<String, Object> result = new LinkedHashMap<String, Object>();
90 
91  Configuration root = getRoot();
92  if (root != null && root.options().copyDefaults()) {
93  ConfigurationSection defaults = getDefaultSection();
94 
95  if (defaults != null) {
96  result.putAll(defaults.getValues(deep));
97  }
98  }
99 
100  mapChildrenValues(result, this, deep);
101 
102  return result;
103  }
ConfigurationSection getDefaultSection()
Vector org.bukkit.configuration.MemorySection.getVector ( String  path)

Gets the requested Vector by path.

If the Vector does not exist but a default value has been specified, this will return the default value. If the Vector does not exist and no default value was specified, this will return null.

Parameters
pathPath of the Vector to get.
Returns
Requested Vector.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 618 of file MemorySection.java.

618  {
619  Object def = getDefault(path);
620  return getVector(path, (def instanceof Vector) ? (Vector) def : null);
621  }
Vector org.bukkit.configuration.MemorySection.getVector ( String  path,
Vector  def 
)

Gets the requested Vector by path, returning a default value if not found.

If the Vector does not exist then the specified default value will returned regardless of if a default has been identified in the root Configuration.

Parameters
pathPath of the Vector to get.
defThe default value to return if the path is not found or is not a Vector.
Returns
Requested Vector.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 623 of file MemorySection.java.

623  {
624  Object val = get(path, def);
625  return (val instanceof Vector) ? (Vector) val : def;
626  }
boolean org.bukkit.configuration.MemorySection.isBoolean ( String  path)

Checks if the specified path is a boolean.

If the path exists but is not a boolean, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a boolean and return appropriately.

Parameters
pathPath of the boolean to check.
Returns
Whether or not the specified path is a boolean.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 319 of file MemorySection.java.

319  {
320  Object val = get(path);
321  return val instanceof Boolean;
322  }
boolean org.bukkit.configuration.MemorySection.isColor ( String  path)

Checks if the specified path is a Color.

If the path exists but is not a Color, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a Color and return appropriately.

Parameters
pathPath of the Color to check.
Returns
Whether or not the specified path is a Color.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 673 of file MemorySection.java.

673  {
674  Object val = get(path);
675  return val instanceof Color;
676  }
boolean org.bukkit.configuration.MemorySection.isConfigurationSection ( String  path)

Checks if the specified path is a ConfigurationSection.

If the path exists but is not a ConfigurationSection, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a ConfigurationSection and return appropriately.

Parameters
pathPath of the ConfigurationSection to check.
Returns
Whether or not the specified path is a ConfigurationSection.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 688 of file MemorySection.java.

688  {
689  Object val = get(path);
690  return val instanceof ConfigurationSection;
691  }
boolean org.bukkit.configuration.MemorySection.isDouble ( String  path)

Checks if the specified path is a double.

If the path exists but is not a double, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a double and return appropriately.

Parameters
pathPath of the double to check.
Returns
Whether or not the specified path is a double.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 334 of file MemorySection.java.

334  {
335  Object val = get(path);
336  return val instanceof Double;
337  }
boolean org.bukkit.configuration.MemorySection.isInt ( String  path)

Checks if the specified path is an int.

If the path exists but is not a int, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a int and return appropriately.

Parameters
pathPath of the int to check.
Returns
Whether or not the specified path is an int.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 304 of file MemorySection.java.

304  {
305  Object val = get(path);
306  return val instanceof Integer;
307  }
boolean org.bukkit.configuration.MemorySection.isItemStack ( String  path)

Checks if the specified path is an ItemStack.

If the path exists but is not a ItemStack, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a ItemStack and return appropriately.

Parameters
pathPath of the ItemStack to check.
Returns
Whether or not the specified path is an ItemStack.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 658 of file MemorySection.java.

658  {
659  Object val = get(path);
660  return val instanceof ItemStack;
661  }
boolean org.bukkit.configuration.MemorySection.isList ( String  path)

Checks if the specified path is a List.

If the path exists but is not a List, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a List and return appropriately.

Parameters
pathPath of the List to check.
Returns
Whether or not the specified path is a List.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 365 of file MemorySection.java.

365  {
366  Object val = get(path);
367  return val instanceof List;
368  }
boolean org.bukkit.configuration.MemorySection.isLong ( String  path)

Checks if the specified path is a long.

If the path exists but is not a long, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a long and return appropriately.

Parameters
pathPath of the long to check.
Returns
Whether or not the specified path is a long.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 349 of file MemorySection.java.

349  {
350  Object val = get(path);
351  return val instanceof Long;
352  }
boolean org.bukkit.configuration.MemorySection.isOfflinePlayer ( String  path)

Checks if the specified path is an OfflinePlayer.

If the path exists but is not a OfflinePlayer, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a OfflinePlayer and return appropriately.

Parameters
pathPath of the OfflinePlayer to check.
Returns
Whether or not the specified path is an OfflinePlayer.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 643 of file MemorySection.java.

643  {
644  Object val = get(path);
645  return val instanceof OfflinePlayer;
646  }
boolean org.bukkit.configuration.MemorySection.isSet ( String  path)

Checks if this ConfigurationSection has a value set for the given path.

If the value for the requested path does not exist but a default value has been specified, this will still return false.

Parameters
pathPath to check for existence.
Returns
True if this section contains the requested path, regardless of having a default.
Exceptions
IllegalArgumentExceptionThrown when path is null.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 109 of file MemorySection.java.

References org.bukkit.configuration.MemorySection.contains(), org.bukkit.configuration.MemorySection.getRoot(), and org.bukkit.configuration.Configuration.options().

109  {
110  Configuration root = getRoot();
111  if (root == null) {
112  return false;
113  }
114  if (root.options().copyDefaults()) {
115  return contains(path);
116  }
117  return get(path, null) != null;
118  }
boolean org.bukkit.configuration.MemorySection.isString ( String  path)

Checks if the specified path is a String.

If the path exists but is not a String, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a String and return appropriately.

Parameters
pathPath of the String to check.
Returns
Whether or not the specified path is a String.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 289 of file MemorySection.java.

289  {
290  Object val = get(path);
291  return val instanceof String;
292  }
boolean org.bukkit.configuration.MemorySection.isVector ( String  path)

Checks if the specified path is a Vector.

If the path exists but is not a Vector, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a Vector and return appropriately.

Parameters
pathPath of the Vector to check.
Returns
Whether or not the specified path is a Vector.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 628 of file MemorySection.java.

628  {
629  Object val = get(path);
630  return val instanceof Vector;
631  }
void org.bukkit.configuration.MemorySection.set ( String  path,
Object  value 
)

Sets the specified path to the given value.

If value is null, the entry will be removed. Any existing entry will be replaced, regardless of what the new value is.

Some implementations may have limitations on what you may store. See their individual javadocs for details. No implementations should allow you to store Configurations or ConfigurationSections, please use createSection(java.lang.String) for that.

Parameters
pathPath of the object to set.
valueNew value to set the path to.

Implements org.bukkit.configuration.ConfigurationSection.

Definition at line 162 of file MemorySection.java.

References org.bukkit.configuration.ConfigurationSection.createSection(), org.bukkit.configuration.ConfigurationSection.getConfigurationSection(), org.bukkit.configuration.MemorySection.getRoot(), org.bukkit.configuration.Configuration.options(), and org.bukkit.configuration.ConfigurationSection.set().

162  {
163  Validate.notEmpty(path, "Cannot set to an empty path");
164 
165  Configuration root = getRoot();
166  if (root == null) {
167  throw new IllegalStateException("Cannot use section without a root");
168  }
169 
170  final char separator = root.options().pathSeparator();
171  // i1 is the leading (higher) index
172  // i2 is the trailing (lower) index
173  int i1 = -1, i2;
174  ConfigurationSection section = this;
175  while ((i1 = path.indexOf(separator, i2 = i1 + 1)) != -1) {
176  String node = path.substring(i2, i1);
177  ConfigurationSection subSection = section.getConfigurationSection(node);
178  if (subSection == null) {
179  section = section.createSection(node);
180  } else {
181  section = subSection;
182  }
183  }
184 
185  String key = path.substring(i2);
186  if (section == this) {
187  if (value == null) {
188  map.remove(key);
189  } else {
190  map.put(key, value);
191  }
192  } else {
193  section.set(key, value);
194  }
195  }

The documentation for this class was generated from the following file: