Interface Criteria


public interface Criteria
Represents a scoreboard criteria, either custom or built-in to the Minecraft server, used to keep track of and manually or automatically change scores on a scoreboard.

While this class outlines constants for standard criteria, see statistic(Statistic) (and its overloads) to create instances for statistically-backed criteria.

  • Field Details

    • DUMMY

      static final Criteria DUMMY
      The dummy criteria. Not changed by the server.
    • TRIGGER

      static final Criteria TRIGGER
      The trigger criteria. Changed when a player runs the /trigger command for an objective.
    • DEATH_COUNT

      static final Criteria DEATH_COUNT
      Increments automatically when a player dies.
    • PLAYER_KILL_COUNT

      static final Criteria PLAYER_KILL_COUNT
      Increments automatically when a player kills another player.
    • TOTAL_KILL_COUNT

      static final Criteria TOTAL_KILL_COUNT
      Increments automatically when a player kills another living entity.
    • HEALTH

      static final Criteria HEALTH
      Mirrors the player's health points (0 for no health, 20 for maximum default health).
    • FOOD

      static final Criteria FOOD
      Mirrors the player's food points (0 for no food, 20 for maximum food).
    • AIR

      static final Criteria AIR
      Mirrors the player's air supply (0 for no air, 300 for maximum air).
    • ARMOR

      static final Criteria ARMOR
      Mirrors the player's armor points (0 for no armor, 20 for maximum armor).
    • XP

      static final Criteria XP
      Mirrors the player's experience points.
    • LEVEL

      static final Criteria LEVEL
      Mirrors the player's experience level.
    • TEAM_KILL_BLACK

      static final Criteria TEAM_KILL_BLACK
      Increments automatically when a player kills another player on the black team.
    • TEAM_KILL_DARK_BLUE

      static final Criteria TEAM_KILL_DARK_BLUE
      Increments automatically when a player kills another player on the dark blue team.
    • TEAM_KILL_DARK_GREEN

      static final Criteria TEAM_KILL_DARK_GREEN
      Increments automatically when a player kills another player on the dark green team.
    • TEAM_KILL_DARK_AQUA

      static final Criteria TEAM_KILL_DARK_AQUA
      Increments automatically when a player kills another player on the dark aqua team.
    • TEAM_KILL_DARK_RED

      static final Criteria TEAM_KILL_DARK_RED
      Increments automatically when a player kills another player on the dark red team.
    • TEAM_KILL_DARK_PURPLE

      static final Criteria TEAM_KILL_DARK_PURPLE
      Increments automatically when a player kills another player on the dark purple team.
    • TEAM_KILL_GOLD

      static final Criteria TEAM_KILL_GOLD
      Increments automatically when a player kills another player on the gold team.
    • TEAM_KILL_GRAY

      static final Criteria TEAM_KILL_GRAY
      Increments automatically when a player kills another player on the gray team.
    • TEAM_KILL_DARK_GRAY

      static final Criteria TEAM_KILL_DARK_GRAY
      Increments automatically when a player kills another player on the dark gray team.
    • TEAM_KILL_BLUE

      static final Criteria TEAM_KILL_BLUE
      Increments automatically when a player kills another player on the blue team.
    • TEAM_KILL_GREEN

      static final Criteria TEAM_KILL_GREEN
      Increments automatically when a player kills another player on the green team.
    • TEAM_KILL_AQUA

      static final Criteria TEAM_KILL_AQUA
      Increments automatically when a player kills another player on the aqua team.
    • TEAM_KILL_RED

      static final Criteria TEAM_KILL_RED
      Increments automatically when a player kills another player on the red team.
    • TEAM_KILL_LIGHT_PURPLE

      static final Criteria TEAM_KILL_LIGHT_PURPLE
      Increments automatically when a player kills another player on the light purple team.
    • TEAM_KILL_YELLOW

      static final Criteria TEAM_KILL_YELLOW
      Increments automatically when a player kills another player on the yellow team.
    • TEAM_KILL_WHITE

      static final Criteria TEAM_KILL_WHITE
      Increments automatically when a player kills another player on the white team.
    • KILLED_BY_TEAM_BLACK

      static final Criteria KILLED_BY_TEAM_BLACK
      Increments automatically when a player is killed by a player on the black team.
    • KILLED_BY_TEAM_DARK_BLUE

      static final Criteria KILLED_BY_TEAM_DARK_BLUE
      Increments automatically when a player is killed by a player on the dark blue team.
    • KILLED_BY_TEAM_DARK_GREEN

      static final Criteria KILLED_BY_TEAM_DARK_GREEN
      Increments automatically when a player is killed by a player on the dark green team.
    • KILLED_BY_TEAM_DARK_AQUA

      static final Criteria KILLED_BY_TEAM_DARK_AQUA
      Increments automatically when a player is killed by a player on the dark aqua team.
    • KILLED_BY_TEAM_DARK_RED

      static final Criteria KILLED_BY_TEAM_DARK_RED
      Increments automatically when a player is killed by a player on the dark red team.
    • KILLED_BY_TEAM_DARK_PURPLE

      static final Criteria KILLED_BY_TEAM_DARK_PURPLE
      Increments automatically when a player is killed by a player on the dark purple team.
    • KILLED_BY_TEAM_GOLD

      static final Criteria KILLED_BY_TEAM_GOLD
      Increments automatically when a player is killed by a player on the gold team.
    • KILLED_BY_TEAM_GRAY

      static final Criteria KILLED_BY_TEAM_GRAY
      Increments automatically when a player is killed by a player on the gray team.
    • KILLED_BY_TEAM_DARK_GRAY

      static final Criteria KILLED_BY_TEAM_DARK_GRAY
      Increments automatically when a player is killed by a player on the dark gray team.
    • KILLED_BY_TEAM_BLUE

      static final Criteria KILLED_BY_TEAM_BLUE
      Increments automatically when a player is killed by a player on the blue team.
    • KILLED_BY_TEAM_GREEN

      static final Criteria KILLED_BY_TEAM_GREEN
      Increments automatically when a player is killed by a player on the green team.
    • KILLED_BY_TEAM_AQUA

      static final Criteria KILLED_BY_TEAM_AQUA
      Increments automatically when a player is killed by a player on the aqua team.
    • KILLED_BY_TEAM_RED

      static final Criteria KILLED_BY_TEAM_RED
      Increments automatically when a player is killed by a player on the red team.
    • KILLED_BY_TEAM_LIGHT_PURPLE

      static final Criteria KILLED_BY_TEAM_LIGHT_PURPLE
      Increments automatically when a player is killed by a player on the light purple team.
    • KILLED_BY_TEAM_YELLOW

      static final Criteria KILLED_BY_TEAM_YELLOW
      Increments automatically when a player is killed by a player on the yellow team.
    • KILLED_BY_TEAM_WHITE

      static final Criteria KILLED_BY_TEAM_WHITE
      Increments automatically when a player is killed by a player on the white team.
  • Method Details

    • getName

      @NotNull String getName()
      Get the name of this criteria (its unique id).
      Returns:
      the name
    • isReadOnly

      boolean isReadOnly()
      Get whether or not this criteria is read only. If read only, scoreboards with this criteria cannot have their scores changed.
      Returns:
      true if read only, false otherwise
    • getDefaultRenderType

      @NotNull RenderType getDefaultRenderType()
      Get the RenderType used by default for this criteria.
      Returns:
      the default render type
    • statistic

      @NotNull static Criteria statistic(@NotNull Statistic statistic, @NotNull Material material)
      Get a Criteria for the specified statistic pertaining to blocks or items.

      This method expects a Statistic of Statistic.Type.BLOCK or Statistic.Type.ITEM and the Material matching said type (e.g. BLOCK statistics require materials where Material.isBlock() is true). This acts as a convenience to create more complex compound criteria such as those that increment on block breaks, or item uses. An example would be Criteria.statistic(Statistic.CRAFT_ITEM, Material.STICK), returning a Criteria representing "minecraft.crafted:minecraft.stick" which will increment when the player crafts a stick.

      If the provided statistic does not require additional data, statistic(Statistic) is called and returned instead.

      This method provides no guarantee that any given criteria exists on the vanilla server.

      Parameters:
      statistic - the statistic for which to get a criteria
      material - the relevant material
      Returns:
      the criteria
      Throws:
      IllegalArgumentException - if Statistic.getType() is anything other than Statistic.Type.BLOCK or Statistic.Type.ITEM
      IllegalArgumentException - if Statistic.getType() is Statistic.Type.BLOCK, but Material.isBlock() is false
      IllegalArgumentException - if Statistic.getType() is Statistic.Type.ITEM, but Material.isItem() is false
    • statistic

      @NotNull static Criteria statistic(@NotNull Statistic statistic, @NotNull EntityType entityType)
      Get a Criteria for the specified statistic pertaining to an entity type.

      This method expects a Statistic of Statistic.Type.ENTITY. This acts as a convenience to create more complex compound criteria such as being killed by a specific entity type. An example would be Criteria.statistic(Statistic.KILL_ENTITY, EntityType.CREEPER), returning a Criteria representing "minecraft.killed:minecraft.creeper" which will increment when the player kills a creepers.

      If the provided statistic does not require additional data, statistic(Statistic) is called and returned instead.

      This method provides no guarantee that any given criteria exists on the vanilla server.

      Parameters:
      statistic - the statistic for which to get a criteria
      entityType - the relevant entity type
      Returns:
      the criteria
      Throws:
      IllegalArgumentException - if Statistic.getType() is not Statistic.Type.ENTITY
    • statistic

      @NotNull static Criteria statistic(@NotNull Statistic statistic)
      Get a Criteria for the specified statistic.

      An example would be Criteria.statistic(Statistic.FLY_ONE_CM), returning a Criteria representing "minecraft.custom:minecraft.aviate_one_cm" which will increment when the player flies with an elytra.

      This method provides no guarantee that any given criteria exists on the vanilla server. All statistics are accepted, however some may not operate as expected if additional data is required. For block/item-related statistics, see statistic(Statistic, Material), and for entity-related statistics, see statistic(Statistic, EntityType)

      Parameters:
      statistic - the statistic for which to get a criteria
      Returns:
      the criteria
    • create

      @NotNull static Criteria create(@NotNull String name)
      Get (or create) a new Criteria by its name.
      Parameters:
      name - the criteria name
      Returns:
      the created criteria