Skip to content

Commit

Permalink
Chat: do minimessage conversion deeper in
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 10, 2023
1 parent 2ef0d5a commit 5ed8c68
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -2,6 +2,7 @@

import com.denizenscript.denizen.objects.EntityTag;
import com.denizenscript.denizen.tags.BukkitTagContext;
import com.denizenscript.denizen.utilities.PaperAPITools;
import com.denizenscript.denizencore.utilities.debugging.Debug;
import com.denizenscript.denizen.utilities.Settings;
import com.denizenscript.denizencore.scripts.ScriptEntry;
Expand Down Expand Up @@ -66,7 +67,7 @@ else if (context.size() <= 1) {
// Send chat to target
String text = TagManager.tag(Settings.chatToTargetFormat(), new BukkitTagContext(entry));
for (Talkable entity : context) {
entity.talkTo(context, text, this);
entity.talkTo(context, PaperAPITools.instance.convertTextToMiniMessage(text), this);
}
// Check if bystanders hear targeted chat
if (context.isBystandersEnabled()) {
Expand All @@ -88,7 +89,7 @@ else if (context.size() <= 1) {
// Send chat to targets
String text = TagManager.tag(Settings.chatToTargetFormat(), new BukkitTagContext(entry));
for (Talkable entity : context) {
entity.talkTo(context, text, this);
entity.talkTo(context, PaperAPITools.instance.convertTextToMiniMessage(text), this);
}
if (context.isBystandersEnabled()) {
String[] format = Settings.chatMultipleTargetsFormat().split("%target%");
Expand Down Expand Up @@ -154,7 +155,7 @@ private void talkToBystanders(Talkable talkable, String text, DenizenSpeechConte
// Found a nearby LivingEntity, make it Talkable and
// talkNear it if 'should_talk'
if (shouldTalk) {
new TalkableEntity(bystander).talkNear(context, text, this);
new TalkableEntity(bystander).talkNear(context, PaperAPITools.instance.convertTextToMiniMessage(text), this);
}
}
}
Expand Down
Expand Up @@ -2,7 +2,6 @@

import com.denizenscript.denizen.objects.NPCTag;
import com.denizenscript.denizen.objects.PlayerTag;
import com.denizenscript.denizen.utilities.PaperAPITools;
import com.denizenscript.denizen.utilities.Utilities;
import com.denizenscript.denizencore.exceptions.InvalidArgumentsRuntimeException;
import com.denizenscript.denizencore.scripts.commands.generator.*;
Expand Down Expand Up @@ -108,7 +107,7 @@ public static void autoExecute(ScriptEntry scriptEntry,
if (chatRange == -1) {
chatRange = Settings.chatBystandersRange();
}
DenizenSpeechContext context = new DenizenSpeechContext(PaperAPITools.instance.convertTextToMiniMessage(message), scriptEntry, chatRange);
DenizenSpeechContext context = new DenizenSpeechContext(message, scriptEntry, chatRange);
if (!targets.isEmpty()) {
for (EntityTag ent : targets) {
context.addRecipient(ent.getBukkitEntity());
Expand Down

0 comments on commit 5ed8c68

Please sign in to comment.