mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-21 15:54:45 +01:00
Add a MaterialChoice constructor to accept Tag constants
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
1f963a1ee2
commit
ed414d7d7c
1 changed files with 12 additions and 0 deletions
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
|
@ -49,6 +50,17 @@ public interface RecipeChoice extends Predicate<ItemStack>, Cloneable {
|
|||
this(Arrays.asList(choices));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a MaterialChoice with the current values of the specified
|
||||
* tag.
|
||||
*
|
||||
* @param choices the tag
|
||||
*/
|
||||
public MaterialChoice(@NotNull Tag<Material> choices) {
|
||||
Preconditions.checkArgument(choices != null, "choices");
|
||||
this.choices = new ArrayList<>(choices.getValues());
|
||||
}
|
||||
|
||||
public MaterialChoice(@NotNull List<Material> choices) {
|
||||
Preconditions.checkArgument(choices != null, "choices");
|
||||
Preconditions.checkArgument(!choices.isEmpty(), "Must have at least one choice");
|
||||
|
|
Loading…
Add table
Reference in a new issue