Added hidden "log-cancelled-chat" option (default: true) (#154)

This commit is contained in:
Intelli 2022-02-10 20:49:10 -07:00
parent b1c2795289
commit 21eefff53f
3 changed files with 10 additions and 0 deletions

View File

@ -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");

View File

@ -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);

View File

@ -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);