From 5f27a0eeec1aff21cddf830d6b2752b6d39ed6e4 Mon Sep 17 00:00:00 2001 From: qscbm187531 <1309635304@qq.com> Date: Fri, 2 Feb 2024 22:25:33 +0800 Subject: [PATCH] Update DodoOpenJava.java --- .../dodoopenjava/DodoOpenJava.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/minecraftchampions/dodoopenjava/DodoOpenJava.java b/src/main/java/io/github/minecraftchampions/dodoopenjava/DodoOpenJava.java index f748037e..5b96c0c3 100644 --- a/src/main/java/io/github/minecraftchampions/dodoopenjava/DodoOpenJava.java +++ b/src/main/java/io/github/minecraftchampions/dodoopenjava/DodoOpenJava.java @@ -1,6 +1,5 @@ package io.github.minecraftchampions.dodoopenjava; -import lombok.Getter; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; @@ -18,8 +17,7 @@ public class DodoOpenJava { private static final HashSet bots = new HashSet<>(); - @Getter - private static final Map logMap = new ConcurrentHashMap<>(); + public static final Map LOGGER_MAP = new ConcurrentHashMap<>(); /** * 新建 Bot @@ -37,6 +35,7 @@ public static synchronized Bot createBot(@NonNull String clientId, @NonNull Stri public static Set getBots() { return (HashSet) bots.clone(); } + /** * 卸载Bot @@ -66,12 +65,12 @@ public static void enableApiResultsLogger(Bot bot) { * @param authorization authorization */ public static void enableApiResultsLogger(String authorization) { - synchronized (logMap) { - if (logMap.containsKey(authorization)) { + synchronized (LOGGER_MAP) { + if (LOGGER_MAP.containsKey(authorization)) { log.warn("已经调用过DodoOpenJava#enableApiResultsLogger"); return; } - logMap.put(authorization, new ApiResultsLogger(authorization)); + LOGGER_MAP.put(authorization, new ApiResultsLogger(authorization)); } } @@ -90,8 +89,8 @@ public static void disableApiResultsLogger(Bot bot) { * @param authorization authorization */ public static void disableApiResultsLogger(String authorization) { - synchronized (logMap) { - logMap.remove(authorization); + synchronized (LOGGER_MAP) { + LOGGER_MAP.remove(authorization); } } }