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

feature: Expose tags and strict mode in MiniMessage #951

Merged
merged 1 commit into from
Aug 28, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,23 @@ public interface MiniMessage extends ComponentSerializer<Component, Component, S
return this.deserializeToTree(input, TagResolver.resolver(tagResolvers));
}

/**
* Returns if this MiniMessage instance is in strict mode.
*
* @return if the instance is in strict mode
* @see Builder#strict(boolean)
* @since 4.15.0
*/
boolean strict();

/**
* Returns the base tag resolver of this MiniMessage instance.
*
* @return the base tag resolver
* @since 4.15.0
*/
@NotNull TagResolver tags();

/**
* Creates a new {@link MiniMessage.Builder}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ private SerializableResolver serialResolver(final @Nullable TagResolver extraRes
return this.parser.stripTokens(this.newContext(input, tagResolver));
}

@Override
public boolean strict() {
return this.strict;
}

@Override
public @NotNull TagResolver tags() {
return this.parser.tagResolver;
}

private @NotNull ContextImpl newContext(final @NotNull String input, final @Nullable TagResolver resolver) {
requireNonNull(input, "input");
if (resolver == null) {
Expand Down