Skip to content

Commit

Permalink
Merge pull request #951 from KyoriPowered/feature/expose-tag-resolver
Browse files Browse the repository at this point in the history
feature: Expose tags and strict mode in `MiniMessage`
  • Loading branch information
zml2008 authored Aug 28, 2023
2 parents 5d4aef3 + 716b37d commit 08d6b5b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
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

0 comments on commit 08d6b5b

Please sign in to comment.