Class PredicateField<V>

java.lang.Object
studio.mevera.imperat.selector.field.AbstractField<V>
studio.mevera.imperat.selector.field.filters.PredicateField<V>
Type Parameters:
V - The type of the value that the filter field handles.
All Implemented Interfaces:
SelectionField<V>

public abstract class PredicateField<V> extends AbstractField<V>
The PredicateField interface extends the SelectionField interface to add filtering functionality based on a specific value. Implementing this interface allows defining a condition that can be used to filter entities.
  • Field Details

  • Constructor Details

    • PredicateField

      protected PredicateField(String name, studio.mevera.imperat.util.TypeWrap<V> type)
      Constructs an AbstractField instance with the specified name and type.
      Parameters:
      name - The name of the selection field.
      type - The type information of the value that this field handles, wrapped in a TypeWrap object.
  • Method Details

    • getCondition

      @NotNull protected abstract @NotNull EntityCondition getCondition(V value, studio.mevera.imperat.context.internal.Cursor<BukkitCommandSource> cursor, studio.mevera.imperat.context.CommandContext<BukkitCommandSource> context)
      Generates an EntityCondition based on the given value and command input stream. This method is intended to be implemented by subclasses to provide specific filtering conditions for entities.
      Parameters:
      value - The value used to generate the condition.
      cursor - The stream providing command input data.
      context - the context.
      Returns:
      The condition that will be used to filter entities based on the value and input data.
    • isApplicable

      public final boolean isApplicable(BukkitCommandSource sender, org.bukkit.entity.Entity entity, V value, studio.mevera.imperat.context.internal.Cursor<BukkitCommandSource> cursor, studio.mevera.imperat.context.CommandContext<BukkitCommandSource> ctx) throws studio.mevera.imperat.exception.CommandException
      Throws:
      studio.mevera.imperat.exception.CommandException