Interface Condition

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Condition
A custom condition used with Conditional.

Conditions are created by the ServiceRegistry, so they can receive services, config classes, the plugin and its logger through their constructor. Each condition is evaluated at most once.

 public class EconomyEnabled implements Condition {
     private final EconomyConfig config;

     public EconomyEnabled(EconomyConfig config) {
         this.config = config;
     }

     @Override
     public boolean matches() {
         return config.isEnabled();
     }
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks whether the condition is met.
  • Method Details

    • matches

      boolean matches()
      Checks whether the condition is met.
      Returns:
      True if the annotated component should be active.