Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a method by which to create raw replacements. #657

Merged
merged 1 commit into from Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -55,6 +55,18 @@ public interface Placeholder<T> extends Replacement<T> {
return new PlaceholderImpl<>(key, Objects.requireNonNull(value, "value"));
}

/**
* Creates a placeholder that inserts a raw string, ignoring any MiniMessage tags present.
*
* @param key the key
* @param value the replacement
* @return the placeholder
* @since 4.10.0
*/
static @NotNull Placeholder<Component> raw(final @NotNull String key, final @NotNull String value) {
return Placeholder.component(key, Component.text(value));
}

/**
* Creates a replacement that inserts a component.
*
Expand Down
Expand Up @@ -51,6 +51,17 @@ public interface Replacement<T> extends Examinable {
return new ReplacementImpl<>(Objects.requireNonNull(miniMessage, "miniMessage"));
}

/**
* Creates a replacement that inserts a raw string, ignoring any MiniMessage tags present.
*
* @param raw the string
* @return the replacement
* @since 4.10.0
*/
static @NotNull Replacement<Component> raw(final @NotNull String raw) {
return Replacement.component(Component.text(raw));
}

/**
* Creates a replacement that inserts a component.
*
Expand Down