Skip to content

About the formatted messages in chatbox #207

Answered by 0xadg
jebjordan asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not very familiar with Java, but there's a questionable code in ChatBoxPeripheral.java

public final MethodResult sendFormattedMessage(@Nonnull IArguments arguments) throws LuaException {
        return withChatOperation(ignored -> {
            String message = arguments.getString(0);
            IFormattableTextComponent component = ITextComponent.Serializer.fromJson(message);
            if (component == null)
                return MethodResult.of(null, "incorrect json");
            IFormattableTextComponent preparedMessage = new StringTextComponent(String.format(PREFIX_FORMAT, arguments.optString(1, AdvancedPeripheralsConfig.defaultChatBoxPrefix))).append(message);
            fo…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@SirEndii
Comment options

@SirEdvin
Comment options

@jebjordan
Comment options

Answer selected by SirEndii
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants