diff --git a/src/main/java/io/wdsj/asw/event/ASWChatPassEvent.java b/src/main/java/io/wdsj/asw/event/ASWChatPassEvent.java deleted file mode 100644 index 66568b5..0000000 --- a/src/main/java/io/wdsj/asw/event/ASWChatPassEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -package io.wdsj.asw.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.jetbrains.annotations.NotNull; - -/** - * This event is fired when a chat message is not being determined sensitive by the plugin. - */ -public class ASWChatPassEvent extends Event { - private final Player player; - private final String originalMessage; - private static final HandlerList handlers = new HandlerList(); - - public ASWChatPassEvent(Player player, String originalMessage, boolean isAsync) { - super(isAsync); - this.player = player; - this.originalMessage = originalMessage; - } - - /** - * Get the player who triggers the event. - * @return The player who triggers the event. - */ - public Player getPlayer() { - return this.player; - } - - /** - * Get the original message (Which is not being processed by the plugin) - * @return the message - */ - public String getOriginalMessage() { - return this.originalMessage; - } - - - public @NotNull HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} diff --git a/src/main/java/io/wdsj/asw/listener/packet/ASWPacketListener.java b/src/main/java/io/wdsj/asw/listener/packet/ASWPacketListener.java index f30fc39..4c18b05 100644 --- a/src/main/java/io/wdsj/asw/listener/packet/ASWPacketListener.java +++ b/src/main/java/io/wdsj/asw/listener/packet/ASWPacketListener.java @@ -9,7 +9,6 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientChatCommand; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientChatMessage; import io.wdsj.asw.AdvancedSensitiveWords; -import io.wdsj.asw.event.ASWChatPassEvent; import io.wdsj.asw.event.ASWFilterEvent; import io.wdsj.asw.event.EventType; import io.wdsj.asw.setting.PluginMessages; @@ -79,8 +78,6 @@ public void onPacketReceive(PacketReceiveEvent event) { long endTime = System.currentTimeMillis(); addProcessStatistic(endTime, startTime); return; - } else if (settingsManager.getProperty(PluginSettings.ENABLE_API)){ - getScheduler().runTask(() -> Bukkit.getPluginManager().callEvent(new ASWChatPassEvent(player, originalMessage, false))); } // Context check diff --git a/src/main/java/io/wdsj/asw/listener/packet/ProtocolLibListener.java b/src/main/java/io/wdsj/asw/listener/packet/ProtocolLibListener.java index 2d297b2..b62fcde 100644 --- a/src/main/java/io/wdsj/asw/listener/packet/ProtocolLibListener.java +++ b/src/main/java/io/wdsj/asw/listener/packet/ProtocolLibListener.java @@ -1,7 +1,6 @@ package io.wdsj.asw.listener.packet; import io.wdsj.asw.AdvancedSensitiveWords; -import io.wdsj.asw.event.ASWChatPassEvent; import io.wdsj.asw.event.ASWFilterEvent; import io.wdsj.asw.event.EventType; import io.wdsj.asw.setting.PluginMessages; @@ -75,9 +74,8 @@ public void onPacketReceiving(@NotNull com.comphenix.protocol.events.PacketEvent long endTime = System.currentTimeMillis(); addProcessStatistic(endTime, startTime); return; - } else if (settingsManager.getProperty(PluginSettings.ENABLE_API)) { - getScheduler().runTask(() -> Bukkit.getPluginManager().callEvent(new ASWChatPassEvent(player, message, false))); } + // Context check if (settingsManager.getProperty(PluginSettings.CHAT_CONTEXT_CHECK) && isNotCommand(message)) { ChatContext.addMessage(player, message);