mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-14 11:45:52 -07:00
Add a MaterialChoice constructor to accept Tag constants
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Tag;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,6 +50,17 @@ public interface RecipeChoice extends Predicate<ItemStack>, Cloneable {
|
|||||||
this(Arrays.asList(choices));
|
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) {
|
public MaterialChoice(@NotNull List<Material> choices) {
|
||||||
Preconditions.checkArgument(choices != null, "choices");
|
Preconditions.checkArgument(choices != null, "choices");
|
||||||
Preconditions.checkArgument(!choices.isEmpty(), "Must have at least one choice");
|
Preconditions.checkArgument(!choices.isEmpty(), "Must have at least one choice");
|
||||||
|
Reference in New Issue
Block a user