Interface Condition


  • @NonExtendable
    public interface Condition
    Command condition.
    • Method Detail

      • test

        boolean test​(@NotNull
                     @NotNull Context context)
        Condition test.
        Parameters:
        context - Command execution context.
        Returns:
        true if condition passed, otherwise false.
      • getErrorMessage

        @NotNull
        default @NotNull Optional<net.kyori.adventure.text.Component> getErrorMessage()
        Get error message.
        Returns:
        error message if available, otherwise null.
      • of

        @NotNull
        static @NotNull Condition of​(@NotNull
                                     @NotNull Predicate<Context> test)
        Create new condition.
        Parameters:
        test - Command condition test.
        Returns:
        new condition.
      • of

        @NotNull
        static @NotNull Condition of​(@NotNull
                                     @NotNull Predicate<Context> test,
                                     @NotNull
                                     @NotNull net.kyori.adventure.text.Component errorMessage)
        Create new condition with an error message.
        Parameters:
        test - Command condition test.
        errorMessage - Error message component.
        Returns:
        new condition.