Record Class ChatComponentSnapshot
java.lang.Object
java.lang.Record
nl.pim16aap2.lightkeeper.framework.ChatComponentSnapshot
- Record Components:
json- Native component-codec JSON, retained verbatim.
Frozen native chat-component JSON with shared literal-text and effective-click interpretation.
Literal strings, component arrays and extra children are supported, including inherited click events. Translation keys, selectors, scores, keybinds and hover contents are not rendered as literal main-message text.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordFrozen literal text and its associated effective action. -
Constructor Summary
ConstructorsConstructorDescriptionChatComponentSnapshot(String json) Validates the immutable JSON input reference without decoding it eagerly. -
Method Summary
Modifier and TypeMethodDescriptionDecodes contiguous literal runs and their effective click actions.final booleanIndicates whether some other object is "equal to" this one.booleanhasClickableText(String fragment) Matches decoded literal text associated with an effective click event.final inthashCode()Returns a hash code value for this object.booleanhasRunCommand(String fragment, String command) Matches literal text and its exact run-command payload.booleanhasSuggestedCommand(String fragment, String command) Matches literal text and its exact suggest-command payload, preserving spaces.json()Returns the value of thejsonrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ChatComponentSnapshot
Validates the immutable JSON input reference without decoding it eagerly.
-
-
Method Details
-
clickRunCommand
- Returns:
- First run-command payload, or empty for absent actions or malformed input.
-
clickSuggestedCommand
- Returns:
- First suggest-command payload verbatim, including trailing spaces; empty for malformed input.
-
clickActions
Decodes contiguous literal runs and their effective click actions.Adjacent literal runs with the same action and payload are combined. Non-clickable text and opaque non-literal content prevent accidental association across unrelated portions of a message.
- Returns:
- Immutable literal click actions; textless style nodes may carry an empty text run.
- Throws:
IllegalArgumentException- When JSON or supported component structure cannot be decoded.
-
hasClickableText
Matches decoded literal text associated with an effective click event.- Parameters:
fragment- Nonempty literal text fragment.- Returns:
- Whether a matching clickable literal run exists.
-
hasRunCommand
Matches literal text and its exact run-command payload.- Parameters:
fragment- Nonempty literal text fragment.command- Exact command payload.- Returns:
- Whether the same effective click action matches both requirements.
-
hasSuggestedCommand
Matches literal text and its exact suggest-command payload, preserving spaces.- Parameters:
fragment- Nonempty literal text fragment.command- Exact suggested payload.- Returns:
- Whether the same effective click action matches both requirements.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
json
Returns the value of thejsonrecord component.- Returns:
- the value of the
jsonrecord component
-