Methods

Save data

This method will be invoked on Save methods. The file argument is used for when you use Save to file , the ConfigurationWrapper is mostly used for change the path inside the same file, to allow different path for the data to save. You can create own instance if you want to set general path for your data.

protected abstract void saveDataToFile(@Nonnull final File file, @Nonnull final ConfigurationWrapper configurationWrapper);

Save

You have this two methods to choose from, when save the data to file and it will invoke Save data.

  • public void save();
  • public void save(final String fileToSave); 

Save to file

Save data directly to file and you also have the option to update the file after save if you want to keep commits.

  • Only save

    Only save the data to the file.

    public void saveToFile(final File file);
  • Save and keep the commits.

    This method will try to keep the commits.

    public void saveToFile(final File file, boolean updateData);

Load data

This method will be invoked on reload method. The argument is most useful when you have a list of files to save.

protected abstract void loadSettingsFromYaml(final File file);

Reload

Cache data from the file with this method and it will invoke Load data.

public void reload();

Remove file

This method is used for remove a specific file.

public boolean removeFile(final String fileName);

Configuration

Get the file configuration that get loaded with the file. Will only store latest loaded file instance, so only useful when you only load a single file.

public FileConfiguration getCustomConfig();

File

Get the loaded file. Will only store latest loaded file instance, so only useful when you only load a single file.

public File getCustomConfigFile();

Main folder

get the plugin's main folder.

public File getDataFolder();

Serialization

The methods to serialize and deserialize data from a file.

DeSerialize

The getData method allows for the retrieval of data from a file and the reconstruction of the corresponding ConfigurationSerializable object.

@Nullable
public <T extends ConfigurationSerializable> T getData(final String path, final Class<T> clazz);

Serialize

The setData method facilitates the serialization of data from a ConfigurationWrapper object to a file. This class allows you to set a path for each data entry individually, whether from a map or a cached list. It will then serialize the data into a format that can be saved to a file.

public void setData(@Nonnull final String path, @Nonnull final @Nonnull ConfigurationWrapper configuration); 

Last updated