java.lang.Object
nl.mtvehicles.core.infrastructure.models.MTVConfig
Direct Known Subclasses:
DefaultConfig, MessagesConfig, SecretSettingsConfig, VehicleDataConfig, VehiclesConfig

public abstract class Config extends Object
Abstract class for plugin's configuration files
BEWARE! THIS IS IMPORTANT:
This class may be renamed (most probably to 'MTVConfig') in v2.5.0. Bear it in mind if you're using it in your addon.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.bukkit.configuration.file.FileConfiguration
    Configuration file
    protected ConfigType
    Type of the configuration file
  • Constructor Summary

    Constructors
    Constructor
    Description
    Config​(ConfigType configType)
    Basic setter
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.configuration.file.FileConfiguration
    Deprecated.
    New alternative methods have been created in the 'nl.mtvehicles.core.infrastructure.dataconfig' package.
    protected org.bukkit.configuration.file.FileConfiguration
    Get the file configuration (new method, protected - should be only used in config classes)
    void
    Reload configuration file (e.g.
    boolean
    Save the newly assigned values to the configuration file
    void
    Save the default configuration file
    void
    setConfigFile​(File configFile)
    Set the configuration file
    void
    setFileName​(String fileName)
    Set the name of the configuration file (e.g.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • configType

      protected final ConfigType configType
      Type of the configuration file
    • config

      protected org.bukkit.configuration.file.FileConfiguration config
      Configuration file
  • Constructor Details

    • Config

      public Config(ConfigType configType)
      Basic setter
      Parameters:
      configType - Type of the config
  • Method Details

    • reload

      public void reload()
      Reload configuration file (e.g. if you've just edited it in a text editor)
    • getConfig

      @Deprecated public org.bukkit.configuration.file.FileConfiguration getConfig()
      Deprecated.
      New alternative methods have been created in the 'nl.mtvehicles.core.infrastructure.dataconfig' package. Otherwise, getConfiguration() should be used instead.
      Get the file configuration
      Returns:
      Config as FileConfiguration
      See Also:
      getConfiguration()
    • getConfiguration

      protected org.bukkit.configuration.file.FileConfiguration getConfiguration()
      Get the file configuration (new method, protected - should be only used in config classes)
      Returns:
      Config as FileConfiguration
    • save

      public boolean save()
      Save the newly assigned values to the configuration file
      Returns:
      True if saving was successful
    • saveDefaultConfig

      public void saveDefaultConfig()
      Save the default configuration file
    • setFileName

      public void setFileName(String fileName)
      Set the name of the configuration file (e.g. 'messages/messages_en.yml')
      Parameters:
      fileName - Name of the configuration file
    • setConfigFile

      public void setConfigFile(File configFile)
      Set the configuration file
      Parameters:
      configFile - Configuration file