Giter Site home page Giter Site logo

Comments (12)

Xujiayao avatar Xujiayao commented on June 30, 2024

I don't understand your issue. Please use images to elaborate further, thx.

from discord-mc-chat.

ImUrX avatar ImUrX commented on June 30, 2024

Intended Styled Chat behaviour:
javaw_GUnj89ngZk
javaw_EOiaRByAZP

Styled Chat behaviour with this mod:
javaw_wgTCsPAPEB

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 30, 2024

Ok, I will add a exclude list in the next version.

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 30, 2024

Hello!

Did you add a custom emoji called table to your Discord server? I'm confused about the :table: being highlighted in your screenshot.

Also, by "Styled Chat emoji" do you mean the Fabric mod Patbox/StyledChat?

from discord-mc-chat.

ImUrX avatar ImUrX commented on June 30, 2024

Did you add a custom emoji called table to your Discord server? I'm confused about the :table: being highlighted in your screenshot.

So what happens is that all :text: is ignored discord emoji or not by StyledChat when this mod is on.
Example, there is a :pos: emoji which gets replaced by your coordinates (so 100 64 -200) by StyledChat. But when this mod is on, the message just says :pos: with white color like it's normal text

Also, by "Styled Chat emoji" do you mean the Fabric mod Patbox/StyledChat?
Yes

Yes, I made the issue here because I thought chat text wasn't reaching the StyledChat mod so I deduced the problem was here.

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 30, 2024

May I take a look at your StyledChat config? I installed StyledChat but it didn't work.

Normally :table: should not be highlighted by MCDC because it is not an emoji name. So your Discord server has added a custom emote called :table:?

from discord-mc-chat.

ImUrX avatar ImUrX commented on June 30, 2024

what happens when you say :table:

from discord-mc-chat.

ImUrX avatar ImUrX commented on June 30, 2024

Alright, I understand it's because you cancel the function and it never reaches StyledChat's @Redirect

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 30, 2024

I just used the example config given by the author and it works fine. The situation is the same as your screenshot, except that :table: is not highlighted.

Alright, I understand it's because you cancel the function and it never reaches StyledChat's @Redirect

In this case, I guess there does not seem to have a solution to this problem?

from discord-mc-chat.

ImUrX avatar ImUrX commented on June 30, 2024

Yes there is, why cancel it to make mods incompatible where you can conditionally cancel it.

You could also use StyledChat's API

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 30, 2024
private void handleMessage(TextStream.Message message) {
	if (this.player.getClientChatVisibility() == ChatVisibility.HIDDEN) {
		this.sendPacket(new GameMessageS2CPacket((new TranslatableText("chat.disabled.options")).formatted(Formatting.RED), MessageType.SYSTEM, Util.NIL_UUID));
	} else {
		this.player.updateLastActionTime();
		String string = message.getRaw();
		if (string.startsWith("/")) {
			this.executeCommand(string);
		} else {
			String string2 = message.getFiltered();
			Text text = string2.isEmpty() ? null : new TranslatableText("chat.type.text", new Object[]{this.player.getDisplayName(), string2});
			Text text2 = new TranslatableText("chat.type.text", new Object[]{this.player.getDisplayName(), string});
			this.server.getPlayerManager().broadcast(text2, (player) -> {
				return this.player.shouldFilterMessagesSentTo(player) ? text : text2;
			}, MessageType.CHAT, this.player.getUuid());
		}

		this.messageCooldown += 20;
		if (this.messageCooldown > 200 && !this.server.getPlayerManager().isOperator(this.player.getGameProfile())) {
			this.disconnect(new TranslatableText("disconnect.spam"));
		}
	}
}

This is the target method void handleMessage(Message message) of both mods.

this.server.getPlayerManager().broadcast(text2, (player) -> {
	return this.player.shouldFilterMessagesSentTo(player) ? text : text2;
}, MessageType.CHAT, this.player.getUuid());

You can see that this method sends a message to all players. Both mods have modified the message, which is why we either redirect or inject and cancel the callback, and both have the same effect that makes the original method not send the original message to all players. If this is not done, the message will be sent twice.

As for the API, I don't think it's taken into consideration as not everyone uses this mod.

If I make a message modification switch, there will be no @ mention and emoji highlighting when it is off. That has to be decided which one to choose I think.

from discord-mc-chat.

Xujiayao avatar Xujiayao commented on June 30, 2024

I made a message modification switch in the latest commit. There will be no @mentions and emoji highlighting when it is off, but this gives you the opportunity to keep incompatible mods (like FTB Ranks and StyledChat). You have to decide which one to choose for the time being.

from discord-mc-chat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.