1
0
Fork 0
forked from mc/VTools

关机时发tg消息

This commit is contained in:
Sodium-Aluminate 2023-12-08 01:21:23 +08:00
parent 0c17f2cd80
commit 564e1eb5fa
2 changed files with 8 additions and 2 deletions

View file

@ -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();

View file

@ -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);}