/*
 * This file is part of SpongeAPI, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.spongepowered.api.util.metric;

import org.spongepowered.api.Sponge;
import org.spongepowered.api.plugin.PluginContainer;

/**
 * Provides information about whether a server has granted permission for
 * server metric data to be transmitted on a per plugin basis.
 *
 * <p>This manager is {@code @Inject}able into plugin classes.</p>
 */
public interface MetricsConfigManager {

    /**
     * Gets whether permission for third-party metrics gathering has been
     * granted for a specific plugin (or the global permission if the plugin
     * has not got a specific permission or lack thereof).
     *
     * <p>The value returned from this <em>should not be stored</em>. As the
     * configuration/permission can be updated at any time, it is best to
     * check this each time metrics collection is due to occur.</p>
     *
     * @param container The {@link PluginContainer} to check for permission for
     * @return true if metrics gathering plugins have permission to gather
     *         data about this plugin
     */
    boolean areMetricsEnabled(final PluginContainer container);

    /**
     * Gets whether permission for third-party metrics gathering has been
     * granted for a specific plugin (or the global permission if the plugin
     * has not got a specific permission or lack thereof).
     *
     * <p>The value returned from this <em>should not be stored</em>. As the
     * configuration/permission can be updated at any time, it is best to
     * check this each time server metric collection is due to occur.</p>
     *
     * @param plugin The plugin object (annotated with
     *               {@link org.spongepowered.api.plugin.Plugin})
     * @throws IllegalArgumentException if the supplied object is not a plugin
     *                                  object
     * @return true if metrics gathering plugins have permission to gather
     *         data about this plugin
     */
    default boolean areMetricsEnabled(final Object plugin) throws IllegalArgumentException {
        return this.areMetricsEnabled(Sponge.getPluginManager().fromInstance(plugin)
                .orElseThrow(() -> new IllegalArgumentException("The supplied object is not a plugin object.")));
    }

}

@@ -1377,16 +1377,60 @@
 ntainer;
+%0Aimport org.spongepowered.api.util.Tristate;
 %0A%0A/**%0A *
@@ -2327,24 +2327,40 @@
 gin%0A     */%0A
+    @Deprecated%0A
     boolean 
@@ -3233,24 +3233,40 @@
 gin%0A     */%0A
+    @Deprecated%0A
     default 
@@ -3552,10 +3552,1308 @@
 %0A    %7D%0A%0A
+    /**%0A     * Gets the current %3Cem%3Eglobal%3C/em%3E state of collection. The collection state determines%0A     * how data collection should be handled.%0A     *%0A     * Global state determines how an undefined state for a specific plugin should be handled.%0A     * If a plugin has a state specified then it will override the global state.%0A     *%0A     * %7B@link Tristate#TRUE%7D Permits data collection%0A     * %7B@link Tristate#FALSE%7D Disallows data collection, this has been explicitly set%0A     * %7B@link Tristate#UNDEFINED%7D Disallows data collection, this is set by default%0A     *%0A     * @return The global state of collection%0A     */%0A    Tristate getGlobalCollectionState();%0A%0A    /**%0A     * Gets the current state of collection for the specified plugin. The collection state%0A     * determines how data collection should be handled.%0A     *%0A     * %7B@link Tristate#TRUE%7D Permits data collection%0A     * %7B@link Tristate#FALSE%7D Disallows data collection, this has been explicitly set%0A     * %7B@link Tristate#UNDEFINED%7D Inherit from %7B@link MetricsConfigManager#getGlobalCollectionState()%7D, this is set by default%0A     *%0A     * @param container The %7B@link org.spongepowered.api.plugin.PluginContainer%7D%0A     * @return The current collection state%0A     */%0A    Tristate getCollectionState(final PluginContainer container);%0A
 %7D%0A

Introduce Metrics Collection States (#2018)