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

dev.jorel.commandapi.arguments.SafeOverrideable Maven / Gradle / Ivy

There is a newer version: 9.5.3
Show newest version
package dev.jorel.commandapi.arguments;

import dev.jorel.commandapi.ChainableBuilder;

import java.util.function.Function;

public interface SafeOverrideable
/// @endcond
, Argument
/// @cond DOX
extends AbstractArgument
/// @endcond
, CommandSender> extends ChainableBuilder {
	// Links to methods in AbstractArgument (make sure they have the same signature)
	Impl replaceSuggestions(ArgumentSuggestions suggestions);

	Impl includeSuggestions(ArgumentSuggestions suggestions);


	// SafeOverrideableArgument info
	Function getMapper();


	/**
	 * Replaces the suggestions with a safe {@link SafeSuggestions} object. Use the
	 * static methods in {@link SafeSuggestions} to create safe suggestions.
	 *
	 * @param suggestions The safe suggestions to use
	 * @return the current argument
	 */
	default Impl replaceSafeSuggestions(SafeSuggestions suggestions) {
		return replaceSuggestions(suggestions.toSuggestions(getMapper()));
	}

	/**
	 * Includes the suggestions provided with the existing suggestions for this
	 * argument. Use the static methods in {@link SafeSuggestions} to create safe
	 * suggestions.
	 *
	 * @param suggestions The safe suggestions to use
	 * @return the current argument
	 */
	default Impl includeSafeSuggestions(SafeSuggestions suggestions) {
		return includeSuggestions(suggestions.toSuggestions(getMapper()));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy