Make connection error toggleable.

This commit is contained in:
xIsm4 2022-04-26 15:42:59 +02:00
parent 396e163fdf
commit 8bd7462b9d

View File

@ -0,0 +1,56 @@
From 887dde9d8163212432a974a65b8c433eb4f3dca5 Mon Sep 17 00:00:00 2001
From: xIsm4 <minelatinsoporte@gmail.com>
Date: Tue, 26 Apr 2022 15:41:57 +0200
Subject: [PATCH] Make connection error toggleable
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
index d2fa6216..625df19c 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
@@ -201,6 +201,8 @@ public class FlameCordConfiguration extends FlameConfig {
private boolean loggerDump = false;
@Getter
private boolean loggerHaProxy = false;
+ @Getter
+ private boolean loggerDetailedConnection = false;
public FlameCordConfiguration(final ConfigurationProvider configurationProvider) {
try {
@@ -236,7 +238,8 @@ public class FlameCordConfiguration extends FlameConfig {
this.loggerInitialhandler = setIfUnexistant("logger.initialhandler", this.loggerInitialhandler, configuration);
this.loggerExceptions = setIfUnexistant("logger.exceptions", this.loggerExceptions, configuration);
this.loggerDump = setIfUnexistant("logger.dump", this.loggerDump, configuration);
- this.loggerHaProxy = setIfUnexistant("logger.haproxy", this.loggerHaProxy, configuration);
+ this.loggerHaProxy = setIfUnexistant("logger.haproxy", this.loggerHaProxy, configuration);
+ this.loggerDetailedConnection = setIfUnexistant("logger.detailed-connect-errors", this.loggerDetailedConnection, configuration);
configurationProvider.save(configuration, configurationFile);
} catch (final IOException e) {
diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
index c3e9d24b..6131d7ea 100644
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
@@ -4,6 +4,7 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Multimap;
+import dev._2lstudios.flamecord.FlameCord;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
@@ -399,7 +400,10 @@ public final class UserConnection implements ProxiedPlayer
private String connectionFailMessage(Throwable cause)
{
- bungee.getLogger().log(Level.WARNING, "Error occurred processing connection for " + this.name + " " + Util.exception( cause, false )); // Waterfall
+ //FlameCord - Allow for toggle the logging of connection failures
+ if(FlameCord.getInstance().getFlameCordConfiguration().isLoggerDetailedConnection()) {
+ bungee.getLogger().log(Level.WARNING, "Error occurred processing connection for " + this.name + " " + Util.exception(cause, false)); // Waterfall
+ }
return ""; // Waterfall
}
--
2.34.1.windows.1