diff --git a/src/main/java/net/coreprotect/config/Config.java b/src/main/java/net/coreprotect/config/Config.java index f8b96cb..bf481e3 100644 --- a/src/main/java/net/coreprotect/config/Config.java +++ b/src/main/java/net/coreprotect/config/Config.java @@ -43,6 +43,7 @@ public class Config extends Language { public String LANGUAGE; public boolean HOVER_EVENTS; public boolean DATABASE_LOCK; + public boolean LOG_CANCELLED_CHAT; public boolean HOPPER_FILTER_META; public boolean MYSQL; public boolean CHECK_UPDATES; @@ -180,6 +181,7 @@ public class Config extends Language { private void readValues() { this.HOVER_EVENTS = this.getBoolean("hover-events", true); this.DATABASE_LOCK = this.getBoolean("database-lock", true); + this.LOG_CANCELLED_CHAT = this.getBoolean("log-cancelled-chat", true); this.HOPPER_FILTER_META = this.getBoolean("hopper-filter-meta", false); this.DONATION_KEY = this.getString("donation-key"); this.MYSQL = this.getBoolean("use-mysql"); diff --git a/src/main/java/net/coreprotect/listener/player/PlayerChatListener.java b/src/main/java/net/coreprotect/listener/player/PlayerChatListener.java index 3e38907..5eae623 100644 --- a/src/main/java/net/coreprotect/listener/player/PlayerChatListener.java +++ b/src/main/java/net/coreprotect/listener/player/PlayerChatListener.java @@ -19,6 +19,10 @@ public final class PlayerChatListener extends Queue implements Listener { } Player player = event.getPlayer(); + if (event.isCancelled() && !Config.getConfig(player.getWorld()).LOG_CANCELLED_CHAT) { + return; + } + if (!message.startsWith("/") && Config.getConfig(player.getWorld()).PLAYER_MESSAGES) { long timestamp = System.currentTimeMillis() / 1000L; Queue.queuePlayerChat(player, message, timestamp); diff --git a/src/main/java/net/coreprotect/paper/listener/PaperChatListener.java b/src/main/java/net/coreprotect/paper/listener/PaperChatListener.java index e21cbff..0b41412 100644 --- a/src/main/java/net/coreprotect/paper/listener/PaperChatListener.java +++ b/src/main/java/net/coreprotect/paper/listener/PaperChatListener.java @@ -20,6 +20,10 @@ public final class PaperChatListener extends Queue implements Listener { } Player player = event.getPlayer(); + if (event.isCancelled() && !Config.getConfig(player.getWorld()).LOG_CANCELLED_CHAT) { + return; + } + if (!message.startsWith("/") && Config.getConfig(player.getWorld()).PLAYER_MESSAGES) { long timestamp = System.currentTimeMillis() / 1000L; Queue.queuePlayerChat(player, message, timestamp);