From 11b10e285778dd0014b6c9d3bc06a5eb4f62301f Mon Sep 17 00:00:00 2001 From: Tim203 Date: Sat, 17 Apr 2021 17:39:08 +0200 Subject: [PATCH] Allow skin uploader to log messages instead of closing the connection --- .../floodgate/util/WebsocketEventType.java | 3 ++- .../connector/skin/FloodgateSkinUploader.java | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/org/geysermc/floodgate/util/WebsocketEventType.java b/common/src/main/java/org/geysermc/floodgate/util/WebsocketEventType.java index 1527f2360..1025fcdba 100644 --- a/common/src/main/java/org/geysermc/floodgate/util/WebsocketEventType.java +++ b/common/src/main/java/org/geysermc/floodgate/util/WebsocketEventType.java @@ -30,7 +30,8 @@ public enum WebsocketEventType { SUBSCRIBERS_COUNT, ADDED_TO_QUEUE, SKIN_UPLOADED, - CREATOR_DISCONNECTED; + CREATOR_DISCONNECTED, + LOG_MESSAGE; public static final WebsocketEventType[] VALUES = values(); diff --git a/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java b/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java index d61d3b632..243685188 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java +++ b/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java @@ -128,6 +128,23 @@ public final class FloodgateSkinUploader { PluginMessageUtils.sendMessage(session, getSkinChannel(), bytes); } break; + case LOG_MESSAGE: + String logMessage = node.get("message").asText(); + switch (node.get("priority").asInt()) { + case -1: + logger.debug("Got debug message from skin uploader: " + logMessage); + break; + case 0: + logger.info("Got info message from skin uploader: " +logMessage); + break; + case 1: + logger.error("Got error message from skin uploader: " + logMessage); + break; + default: + logger.info(logMessage); + break; + } + break; } } catch (Exception e) { logger.error("Error while receiving a message", e);