diff --git a/common/src/main/java/net/draycia/carbon/common/listeners/IgnoreHandler.java b/common/src/main/java/net/draycia/carbon/common/listeners/IgnoreHandler.java
new file mode 100644
index 00000000..9792d334
--- /dev/null
+++ b/common/src/main/java/net/draycia/carbon/common/listeners/IgnoreHandler.java
@@ -0,0 +1,42 @@
+/*
+ * CarbonChat
+ *
+ * Copyright (c) 2021 Josua Parks (Vicarious)
+ * Contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package net.draycia.carbon.common.listeners;
+
+import com.google.inject.Inject;
+import net.draycia.carbon.api.CarbonChat;
+import net.draycia.carbon.api.events.CarbonChatEvent;
+import net.draycia.carbon.api.users.CarbonPlayer;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+
+@DefaultQualifier(NonNull.class)
+public class IgnoreHandler {
+
+ @Inject
+ public IgnoreHandler(
+ final CarbonChat carbonChat
+ ) {
+ carbonChat.eventHandler().subscribe(CarbonChatEvent.class, 0, false, event -> {
+ event.recipients().removeIf(entry -> entry instanceof CarbonPlayer carbonPlayer &&
+ carbonPlayer.ignoring(event.sender()));
+ });
+ }
+
+}
diff --git a/common/src/main/java/net/draycia/carbon/common/util/ListenerUtils.java b/common/src/main/java/net/draycia/carbon/common/util/ListenerUtils.java
index b54d3207..2b7f149f 100644
--- a/common/src/main/java/net/draycia/carbon/common/util/ListenerUtils.java
+++ b/common/src/main/java/net/draycia/carbon/common/util/ListenerUtils.java
@@ -22,6 +22,7 @@ package net.draycia.carbon.common.util;
import com.google.inject.Injector;
import java.util.List;
import net.draycia.carbon.common.listeners.DeafenHandler;
+import net.draycia.carbon.common.listeners.IgnoreHandler;
import net.draycia.carbon.common.listeners.ItemLinkHandler;
import net.draycia.carbon.common.listeners.MuteHandler;
@@ -31,8 +32,8 @@ public final class ListenerUtils {
}
- public static final List> LISTENER_CLASSES = List.of(DeafenHandler.class, ItemLinkHandler.class,
- MuteHandler.class);
+ public static final List> LISTENER_CLASSES = List.of(DeafenHandler.class, IgnoreHandler.class,
+ ItemLinkHandler.class, MuteHandler.class);
public static void registerCommonListeners(final Injector injector) {
for (final var listenerClass : LISTENER_CLASSES) {