Skip to content

Commit cc4e0df

Browse files
committed
fixed conflicts with main branch
1 parent 490f385 commit cc4e0df

File tree

5 files changed

+28
-255
lines changed

5 files changed

+28
-255
lines changed

plugin/src/main/java/at/helpch/chatchat/placeholder/MiniPlaceholderImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public MiniPlaceholderImpl(
6969

7070
if (!shouldParsePlaceholderAPIPlaceholders) {
7171
return shouldAutoCloseTags
72-
? Placeholder.component(tagName, MessageUtils.parseToMiniMessage(message))
73-
: TagResolver.resolver(tagName, Tag.inserting(MessageUtils.parseToMiniMessage(message)));
72+
? Placeholder.component(tagName, MessageUtils.parseFromMiniMessage(message))
73+
: TagResolver.resolver(tagName, Tag.inserting(MessageUtils.parseFromMiniMessage(message)));
7474
}
7575

7676
if (isRelationalTag && recipient.isEmpty()) {

plugin/src/main/java/at/helpch/chatchat/processor/LocalToLocalMessageProcessor.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import at.helpch.chatchat.api.event.ChatChatEvent;
66
import at.helpch.chatchat.api.user.ChatUser;
77
import at.helpch.chatchat.api.user.User;
8+
import at.helpch.chatchat.placeholder.MiniPlaceholderContext;
89
import at.helpch.chatchat.user.ConsoleUser;
910
import at.helpch.chatchat.util.FormatUtils;
1011
import at.helpch.chatchat.util.ItemUtils;
@@ -63,7 +64,7 @@ public static boolean processLocalMessageEvent(
6364
sender.player(),
6465
chatTarget.player(),
6566
mentionResult.message(),
66-
plugin.miniPlaceholdersManager().compileTags(false, sender, target)
67+
plugin.miniPlaceholdersManager().compileTags(MiniPlaceholderContext.builder().inMessage(false).sender(sender).recipient(target).build())
6768
);
6869

6970
target.sendMessage(component);
@@ -87,7 +88,7 @@ public static boolean processLocalMessageEvent(
8788
chatEvent.format(),
8889
sender.player(),
8990
mentionResult.message(),
90-
plugin.miniPlaceholdersManager().compileTags(false, sender, target)
91+
plugin.miniPlaceholdersManager().compileTags(MiniPlaceholderContext.builder().inMessage(false).sender(sender).recipient(target).build())
9192
);
9293

9394
target.sendMessage(component);
@@ -115,7 +116,7 @@ public static boolean processLocalMessageEvent(
115116
sender.player(),
116117
sender.player(),
117118
mentionResult.message(),
118-
plugin.miniPlaceholdersManager().compileTags(false, sender, sender)
119+
plugin.miniPlaceholdersManager().compileTags(MiniPlaceholderContext.builder().inMessage(false).sender(sender).recipient(sender).build())
119120
);
120121

121122
sender.sendMessage(component);
@@ -161,7 +162,7 @@ public static boolean processLocalMessageEvent(
161162
);
162163
}
163164

164-
resolver.resolvers(plugin.miniPlaceholdersManager().compileTags(true, sender, recipient));
165+
resolver.resolvers(plugin.miniPlaceholdersManager().compileTags(MiniPlaceholderContext.builder().inMessage(true).sender(sender).recipient(recipient).build()));
165166

166167
return !sender.hasPermission(MessageProcessor.Constants.URL_PERMISSION)
167168
? MessageProcessor.Constants.USER_MESSAGE_MINI_MESSAGE.deserialize(message, resolver.build())

plugin/src/main/java/at/helpch/chatchat/processor/LocalToRemoteMessageProcessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import at.helpch.chatchat.api.channel.Channel;
55
import at.helpch.chatchat.api.event.ChatChatEvent;
66
import at.helpch.chatchat.api.user.ChatUser;
7+
import at.helpch.chatchat.placeholder.MiniPlaceholderContext;
78
import at.helpch.chatchat.user.ConsoleUser;
89
import at.helpch.chatchat.util.FormatUtils;
910
import at.helpch.chatchat.util.MessageUtils;
@@ -31,7 +32,7 @@ public static boolean processLocalMessageEvent(
3132
chatEvent.format(),
3233
sender.player(),
3334
parsedMessage,
34-
plugin.miniPlaceholdersManager().compileTags(false, sender, ConsoleUser.INSTANCE)
35+
plugin.miniPlaceholdersManager().compileTags(MiniPlaceholderContext.builder().inMessage(false).sender(sender).build())
3536
);
3637

3738
return plugin.remoteMessageSender().send(channel.name(), MessageUtils.parseToGson(component));

plugin/src/main/java/at/helpch/chatchat/processor/MessageProcessor.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.jetbrains.annotations.NotNull;
1515

1616
import java.util.Map;
17+
import java.util.Objects;
1718
import java.util.regex.Pattern;
1819

1920
public final class MessageProcessor {
@@ -29,14 +30,31 @@ public static boolean processMessageEvent(
2930
@NotNull final String message,
3031
final boolean async
3132
) {
33+
final var isMuted = plugin.hookManager()
34+
.muteHooks()
35+
.stream()
36+
.filter(Objects::nonNull)
37+
.anyMatch(hook -> hook.isMuted(sender));
38+
39+
if (isMuted) {
40+
return false;
41+
}
42+
3243
if (!validateRules(plugin, sender, message)) {
3344
return false;
3445
}
3546

3647
final var chatEvent = new ChatChatEvent(
3748
async,
3849
sender,
39-
FormatUtils.findFormat(sender.player(), channel, plugin.configManager().formats()),
50+
FormatUtils.findFormat(
51+
sender.player(),
52+
channel,
53+
plugin.configManager().formats(),
54+
plugin.configManager().extensions().addons().deluxeChatInversePriorities()
55+
),
56+
// TODO: 9/2/22 Process message for each recipient to add rel support inside the message itself.
57+
// Possibly even pass the minimessage string here instead of the processed component.
4058
LocalToLocalMessageProcessor.processMessage(plugin, sender, ConsoleUser.INSTANCE, message),
4159
channel,
4260
channel.targets(sender)

plugin/src/main/java/at/helpch/chatchat/util/MessageProcessor.java

Lines changed: 0 additions & 247 deletions
This file was deleted.

0 commit comments

Comments
 (0)