Fix ChatSnap not getting the filtered mesage

This commit is contained in:
Sam 2018-09-02 13:07:53 +01:00 committed by Alexander Meech
parent ca22992034
commit 2a34b99130

View File

@ -3,6 +3,8 @@ package mineplex.core.chatsnap;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import mineplex.core.chat.ChatChannel;
import mineplex.core.chat.event.FormatPlayerChatEvent;
import mineplex.core.message.MessageManager; import mineplex.core.message.MessageManager;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -60,7 +62,7 @@ public class SnapshotPlugin extends MiniPlugin
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerChat(AsyncPlayerChatEvent e) public void onPlayerChat(FormatPlayerChatEvent e)
{ {
if (_punish.GetClient(e.getPlayer().getName()).IsMuted()) if (_punish.GetClient(e.getPlayer().getName()).IsMuted())
{ {
@ -81,14 +83,14 @@ public class SnapshotPlugin extends MiniPlugin
return players.stream().map(_clientManager::getAccountId).collect(Collectors.toSet()); return players.stream().map(_clientManager::getAccountId).collect(Collectors.toSet());
} }
public SnapshotMessage createSnapshot(AsyncPlayerChatEvent e) public SnapshotMessage createSnapshot(FormatPlayerChatEvent e)
{ {
MessageType messageType = MessageType.CHAT; MessageType messageType = MessageType.CHAT;
int senderId = _clientManager.getAccountId(e.getPlayer()); int senderId = _clientManager.getAccountId(e.getPlayer());
Set<Integer> recipientIds = getAccountIds(e.getRecipients()); Set<Integer> recipientIds = getAccountIds(e.getRecipients());
recipientIds.remove(senderId); recipientIds.remove(senderId);
if (e.getFormat().contains("Party")) if (e.getChatChannel() == ChatChannel.PARTY)
{ {
messageType = MessageType.PARTY; messageType = MessageType.PARTY;
} }