Skip to content

Item Predicate

Returns Predicate<ItemStack>, which players can specify with this syntax: <item_id>[<list of components>]. For more information: https://minecraft.wiki/w/Argument_types#minecraft:item_predicate. Example:

Java
new StellarCommand("isItem")
    .addItemArgument("item")
    .addExecution(Player.class, context -> {
        Predicate<Block> predicate = context.getArgument<Predicate<ItemStack>("item")
        boolean isItem = predicate.test(new ItemStack(material))
        context.getSender().sendMessage(isItem)
    });
Argument Parser

Item Predicate Argument

Released under the MIT License.