Interface MenuBackgroundValue

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 MenuBackgroundValue
A value an add-on lets menu background rules in guis.yml compare, the way the built-in world or game.players values are compared.

Server owners write it under the add-on's namespace, as namespace:name, with any of the usual comparisons. For a value registered as mystats:wins:

 - when: { mystats:wins: ">=100" }
 - when: { mystats:wins: "10..99" }
 - when: "mystats:wins >= 100 or mystats:title in [champion, legend]"
 - when: "mystats:veteran"                      the value is true
 

Numbers compare as numbers and everything else as text, ignoring case. A null value matches nothing, and a value that throws counts as not matching and is reported in the console once.

Since:
1.15.0
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Object
    value(@NotNull MenuConditionContext context)
    Gives the value for one viewer's menu.
  • Method Details

    • value

      @Nullable @Nullable Object value(@NotNull @NotNull MenuConditionContext context)
      Gives the value for one viewer's menu. Runs on the main thread.
      Parameters:
      context - the viewer, their menu and the moment
      Returns:
      the value, compared through its toString(); null when there is none