Skip to content

Commit

Permalink
添加显示开关
Browse files Browse the repository at this point in the history
添加显示开关可以决定那种显示方式不显示
  • Loading branch information
stevei5mc committed Jun 15, 2024
1 parent f138732 commit dc5f890
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/cn/stevei5mc/autorestart/AutoRestartPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ public void onRun(int currentTick) {
for (Player player : getServer().getOnlinePlayers().values()) {
String title = "§c即将重启";
String subtitle = "§e本分支服即将在 §6{seconds} §e秒后重启";
player.sendTitle(title.replace("{seconds}",String.valueOf(timeLeft)), subtitle.replace("{seconds}",String.valueOf(timeLeft)), 0, 20, 0);
player.sendTip(subtitle.replace("{seconds}",String.valueOf(timeLeft)));
if (config.getBoolean("show_title")) {
player.sendTitle(title.replace("{seconds}",String.valueOf(timeLeft)), subtitle.replace("{seconds}",String.valueOf(timeLeft)), 0, 20, 0);
}
if (config.getBoolean("show_tip")) {
player.sendTip(subtitle.replace("{seconds}",String.valueOf(timeLeft)));
}
}
}
// 如果时间到了,重启服务器
Expand All @@ -57,6 +61,6 @@ public void onRun(int currentTick) {
}
}
}
}, 20, true); // 每秒运行一次 20tick=1s
}, 20, true); // 每20tick运行一次 20tick=1s
}
}

0 comments on commit dc5f890

Please sign in to comment.