TextComponent - Resolver (Function) — SkBee

Addon: SkBee · Category: Function · Since: 3.5.0

Syntax

resolver(placeholder: string, replacement: object, [parsable: boolean])

Description

Creates a tag resolver for replacements in mini message. `placeholder` = The string that will be replaced in the mini message. In the mini message itself this part needs to be surrounded by <>. See examples! `replacement` = A string/text component that will replace the first string. `parsable` = Whether the replacement should be parsed as mini message after being replaced. For servers that take in user inputs, this should be used with caution.

Examples

# Create a component
set {_t} to translate component of player's tool
add hover event showing player's tool to {_t}
# Use this component in the resolver to replace "<item>" in the mini message
set {_r} to resolver("item", {_t})
# setup the mini message with the replacement placeholder
set {_m} to mini message from "<rainbow> Hey guys check out my <item> aint she a beaut?" with {_r}
send component {_m}

on async chat:
	set {_chatColor} to resolver("chatcolor", raw ({chatcolor::%player%} ? raw "<gray>"), true)
	set async chat message to mini message from "<chatcolor>%async chat message%" with resolver {_chatColor}

View source