All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.plotsquared.core.configuration.Configuration Maven / Gradle / Ivy

There is a newer version: 7.4.1
Show newest version
/*
 * PlotSquared, a land and world management plugin for Minecraft.
 * Copyright (C) IntellectualSites 
 * Copyright (C) IntellectualSites team and contributors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */
package com.plotsquared.core.configuration;

import java.util.Map;

/**
 * Represents a source of configurable options and settings.
 */
public interface Configuration extends ConfigurationSection {

    /**
     * Sets the default value of the given path as provided.
     * 

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

*

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

* * @param path Path of the value to set. * @param value Value to set the default to. * @throws IllegalArgumentException Thrown if path is null. */ @Override void addDefault(String path, Object value); /** * Sets the default values of the given paths as provided. *

If no source {@link Configuration} was provided as a default * collection, then a new {@link MemoryConfiguration} will be created to * hold the new default values.

* * @param defaults A map of Path->Values to add to defaults. * @throws IllegalArgumentException Thrown if defaults is null. */ void addDefaults(Map defaults); /** * Sets the default values of the given paths as provided. *

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

*

This method will not hold a reference to the specified Configuration, * nor will it automatically update if that Configuration ever changes. If * you check this, you should set the default source with {@link * #setDefaults(Configuration)}.

* * @param defaults A configuration holding a list of defaults to copy. * @throws IllegalArgumentException Thrown if defaults is null or this. */ void addDefaults(Configuration defaults); /** * Gets the source {@link Configuration} for this configuration. * *

If no configuration source was set, but default values were added, then * a {@link MemoryConfiguration} will be returned. If no source was set * and no defaults were set, then this method will return null.

* * @return Configuration source for default values, or null if none exist. */ Configuration getDefaults(); /** * Sets the source of all default values for this {@link Configuration}. * *

If a previous source was set, or previous default values were defined, * then they will not be copied to the new source.

* * @param defaults New source of default values for this configuration. * @throws IllegalArgumentException Thrown if defaults is null or this. */ void setDefaults(Configuration defaults); /** * Gets the {@link ConfigurationOptions} for this {@link Configuration}. *

All setters through this method are chainable.

* * @return Options for this configuration */ ConfigurationOptions options(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy