From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers Date: Thu, 24 Nov 2022 23:45:57 +0100 Subject: [PATCH] Do not log empty message warnings License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) Gale - https://galemc.org diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 2da5284b446d3dd72fcac38e0bc77db99f265567..71478e620198f373ad92cf40a49ecbfb14fd326e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -194,6 +194,7 @@ import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions; +import org.apache.commons.lang3.StringUtils; import org.galemc.gale.configuration.GaleGlobalConfiguration; import org.slf4j.Logger; @@ -2522,7 +2523,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // CraftBukkit start String s = message.signedContent(); if (s.isEmpty()) { - ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send an empty message"); + if (GaleGlobalConfiguration.get().logToConsole.chat.emptyMessageWarning) ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send an empty message"); // Gale - do not log empty message warnings } else if (this.getCraftPlayer().isConversing()) { final String conversationInput = s; this.server.processQueue.add(new Runnable() { diff --git a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java index 56aa01dfbfc0817b71315322ed3f676bd62ad825..8ef64ac15626633ecdba555b39a20da11d917b65 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleGlobalConfiguration.java @@ -53,5 +53,10 @@ public class GaleGlobalConfiguration extends ConfigurationPart { public boolean invalidStatistics = true; // Gale - EMC - do not log invalid statistics + public Chat chat; + public class Chat extends ConfigurationPart { + public boolean emptyMessageWarning = false; // Gale - do not log empty message warnings + } + } }