Class AbstractFileAttributeConfiguration

java.lang.Object
fr.prodrivers.bukkit.commons.configuration.AbstractAttributeConfiguration
fr.prodrivers.bukkit.commons.configuration.file.AbstractFileAttributeConfiguration
Direct Known Subclasses:
Configuration, FileAttributeConfiguration

public abstract class AbstractFileAttributeConfiguration extends AbstractAttributeConfiguration
Field-based, Bukkit's FileConfiguration backed configuration framework for Prodrivers plugins. AbstractFileAttributeConfiguration extends AbstractAttributeConfiguration to uses Bukkit's own FileConfiguration class as a storage. It provides all the required configuration actions, and most logic for loading, saving and saving defaults. In your constructor, after super(), you have to provide a valid FileConfiguration instance in the configuration field. Override save()/saveDefault() to account for your FileConfiguration saving (set is already handled). Override reload() to account for your FileConfiguration reload. Keep in mind that, in both cases, the super method have to be called before doing any saving on your own. ExcludedFromConfiguration annotation allows specific fields not to be used by the field processor. As with every AbstractAttributeConfiguration derivative, init() have to be called immediately after constructing the object.
  • Constructor Details

    • AbstractFileAttributeConfiguration

      public AbstractFileAttributeConfiguration()
  • Method Details

    • filterFieldName

      public static String filterFieldName(String fieldName)
      Field name fitler. Allows to translate from field name to configuration path. Default behavior is to replace every "_" with ".", meaning that every "_" will actually separate into sub-fields.
      Parameters:
      fieldName - Field name
      Returns:
      Filtered field name
    • getConfiguration

      public org.bukkit.configuration.file.FileConfiguration getConfiguration()
      Get the underlying FileConfiguration instance.
      Returns:
      FileConfiguration instance