Skip to content

Commit

Permalink
fixed conflicts with main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
BlitzOffline committed Jul 11, 2023
1 parent 490f385 commit cc4e0df
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 255 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public MiniPlaceholderImpl(

if (!shouldParsePlaceholderAPIPlaceholders) {
return shouldAutoCloseTags
? Placeholder.component(tagName, MessageUtils.parseToMiniMessage(message))
: TagResolver.resolver(tagName, Tag.inserting(MessageUtils.parseToMiniMessage(message)));
? Placeholder.component(tagName, MessageUtils.parseFromMiniMessage(message))
: TagResolver.resolver(tagName, Tag.inserting(MessageUtils.parseFromMiniMessage(message)));
}

if (isRelationalTag && recipient.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import at.helpch.chatchat.api.event.ChatChatEvent;
import at.helpch.chatchat.api.user.ChatUser;
import at.helpch.chatchat.api.user.User;
import at.helpch.chatchat.placeholder.MiniPlaceholderContext;
import at.helpch.chatchat.user.ConsoleUser;
import at.helpch.chatchat.util.FormatUtils;
import at.helpch.chatchat.util.ItemUtils;
Expand Down Expand Up @@ -63,7 +64,7 @@ public static boolean processLocalMessageEvent(
sender.player(),
chatTarget.player(),
mentionResult.message(),
plugin.miniPlaceholdersManager().compileTags(false, sender, target)
plugin.miniPlaceholdersManager().compileTags(MiniPlaceholderContext.builder().inMessage(false).sender(sender).recipient(target).build())
);

target.sendMessage(component);
Expand All @@ -87,7 +88,7 @@ public static boolean processLocalMessageEvent(
chatEvent.format(),
sender.player(),
mentionResult.message(),
plugin.miniPlaceholdersManager().compileTags(false, sender, target)
plugin.miniPlaceholdersManager().compileTags(MiniPlaceholderContext.builder().inMessage(false).sender(sender).recipient(target).build())
);

target.sendMessage(component);
Expand Down Expand Up @@ -115,7 +116,7 @@ public static boolean processLocalMessageEvent(
sender.player(),
sender.player(),
mentionResult.message(),
plugin.miniPlaceholdersManager().compileTags(false, sender, sender)
plugin.miniPlaceholdersManager().compileTags(MiniPlaceholderContext.builder().inMessage(false).sender(sender).recipient(sender).build())
);

sender.sendMessage(component);
Expand Down Expand Up @@ -161,7 +162,7 @@ public static boolean processLocalMessageEvent(
);
}

resolver.resolvers(plugin.miniPlaceholdersManager().compileTags(true, sender, recipient));
resolver.resolvers(plugin.miniPlaceholdersManager().compileTags(MiniPlaceholderContext.builder().inMessage(true).sender(sender).recipient(recipient).build()));

return !sender.hasPermission(MessageProcessor.Constants.URL_PERMISSION)
? MessageProcessor.Constants.USER_MESSAGE_MINI_MESSAGE.deserialize(message, resolver.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import at.helpch.chatchat.api.channel.Channel;
import at.helpch.chatchat.api.event.ChatChatEvent;
import at.helpch.chatchat.api.user.ChatUser;
import at.helpch.chatchat.placeholder.MiniPlaceholderContext;
import at.helpch.chatchat.user.ConsoleUser;
import at.helpch.chatchat.util.FormatUtils;
import at.helpch.chatchat.util.MessageUtils;
Expand Down Expand Up @@ -31,7 +32,7 @@ public static boolean processLocalMessageEvent(
chatEvent.format(),
sender.player(),
parsedMessage,
plugin.miniPlaceholdersManager().compileTags(false, sender, ConsoleUser.INSTANCE)
plugin.miniPlaceholdersManager().compileTags(MiniPlaceholderContext.builder().inMessage(false).sender(sender).build())
);

return plugin.remoteMessageSender().send(channel.name(), MessageUtils.parseToGson(component));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.jetbrains.annotations.NotNull;

import java.util.Map;
import java.util.Objects;
import java.util.regex.Pattern;

public final class MessageProcessor {
Expand All @@ -29,14 +30,31 @@ public static boolean processMessageEvent(
@NotNull final String message,
final boolean async
) {
final var isMuted = plugin.hookManager()
.muteHooks()
.stream()
.filter(Objects::nonNull)
.anyMatch(hook -> hook.isMuted(sender));

if (isMuted) {
return false;
}

if (!validateRules(plugin, sender, message)) {
return false;
}

final var chatEvent = new ChatChatEvent(
async,
sender,
FormatUtils.findFormat(sender.player(), channel, plugin.configManager().formats()),
FormatUtils.findFormat(
sender.player(),
channel,
plugin.configManager().formats(),
plugin.configManager().extensions().addons().deluxeChatInversePriorities()
),
// TODO: 9/2/22 Process message for each recipient to add rel support inside the message itself.
// Possibly even pass the minimessage string here instead of the processed component.
LocalToLocalMessageProcessor.processMessage(plugin, sender, ConsoleUser.INSTANCE, message),
channel,
channel.targets(sender)
Expand Down
247 changes: 0 additions & 247 deletions plugin/src/main/java/at/helpch/chatchat/util/MessageProcessor.java

This file was deleted.

0 comments on commit cc4e0df

Please sign in to comment.