From 564e1eb5fac193fcfb499830338ee8d089f29174 Mon Sep 17 00:00:00 2001 From: Sodium-Aluminate Date: Fri, 8 Dec 2023 01:21:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E6=9C=BA=E6=97=B6=E5=8F=91tg=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/de/strifel/VTools/ServerCloser.java | 7 +++++-- src/main/java/de/strifel/VTools/listeners/TGBridge.java | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/strifel/VTools/ServerCloser.java b/src/main/java/de/strifel/VTools/ServerCloser.java index 894afef..fe9a3c4 100644 --- a/src/main/java/de/strifel/VTools/ServerCloser.java +++ b/src/main/java/de/strifel/VTools/ServerCloser.java @@ -66,7 +66,10 @@ public class ServerCloser { boolean httpSuccess = false; for (int i = 0; i < 3; i++) { httpSuccess = executeAzure(); - if (httpSuccess) break; + if (httpSuccess) { + TGBridge.log("关机命令发送成功,正在关闭 pymcd。"); + break; + } } if (!httpSuccess) { TGBridge.error("服务器关机 http 请求失效,服务器可能没有正常关闭。"); @@ -134,7 +137,7 @@ public class ServerCloser { plugin.logger.info("ServerCloser: 即将关机。"); close(); } else { - plugin.logger.error("ServerCloser: 定时器到点时发现服务器有人。这不应发生,因为定时器本应该被打断。"); + plugin.logger.error("ServerCloser: 定时器到点时发现服务器有人。这不应发生,因为定时器本应该被打断。"); TGBridge.error("ServerCloser: #bug @NaAlOH4 定时器到点时发现服务器有人。这不应发生,因为定时器本应该被打断。"); } closeServerTimer.cancel(); diff --git a/src/main/java/de/strifel/VTools/listeners/TGBridge.java b/src/main/java/de/strifel/VTools/listeners/TGBridge.java index 7d8c6f3..01003dc 100644 --- a/src/main/java/de/strifel/VTools/listeners/TGBridge.java +++ b/src/main/java/de/strifel/VTools/listeners/TGBridge.java @@ -310,6 +310,9 @@ public class TGBridge { public static void error(String context) { INSTANCE.outbound("*" + MarkdownString.escapeStr(context) + "*", ParseMode.MarkdownV2); } + public static void log(String context) { + INSTANCE.outbound("_" + MarkdownString.escapeStr(context) + "_", ParseMode.MarkdownV2); + } protected void outbound(String content) {outbound(content, (ParseMode) null);}