类 ScoreComponent


  • public final class ScoreComponent
    extends BaseComponent
    This component displays the score based on a player score on the scoreboard.
    The name is the name of the player stored on the scoreboard, which may be a "fake" player. It can also be a target selector that must resolve to 1 target, and may target non-player entities.
    With a book, /tellraw, or /title, using the wildcard '*' in the place of a name or target selector will cause all players to see their own score in the specified objective.
    Signs cannot use the '*' wildcard
    These values are filled in by the server-side implementation.
    As of 1.12.2, a bug ( MC-56373 ) prevents full usage within hover events.
    • 构造器详细资料

      • ScoreComponent

        public ScoreComponent​(java.lang.String name,
                              java.lang.String objective)
        Creates a new score component with the specified name and objective.
        If not specifically set, value will default to an empty string; signifying that the scoreboard value should take precedence. If not null, nor empty, value will override any value found in the scoreboard.
        The value defaults to an empty string.
        参数:
        name - the name of the entity, or an entity selector, whose score should be displayed
        objective - the internal name of the objective the entity's score is attached to
      • ScoreComponent

        public ScoreComponent​(ScoreComponent original)
        Creates a score component from the original to clone it.
        参数:
        original - the original for the new score component
      • ScoreComponent

        public ScoreComponent​(java.lang.String name,
                              java.lang.String objective,
                              java.lang.String value)
    • 方法详细资料

      • toPlainText

        protected void toPlainText​(java.lang.StringBuilder builder)
      • toLegacyText

        protected void toLegacyText​(java.lang.StringBuilder builder)
      • getName

        public java.lang.String getName()
      • getObjective

        public java.lang.String getObjective()
      • getValue

        public java.lang.String getValue()
      • setName

        public void setName​(java.lang.String name)
      • setObjective

        public void setObjective​(java.lang.String objective)
      • setValue

        public void setValue​(java.lang.String value)
      • equals

        public boolean equals​(java.lang.Object o)
        覆盖:
        equals 在类中 BaseComponent
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
        覆盖:
        canEqual 在类中 BaseComponent