diff --git a/build.gradle.kts b/build.gradle.kts index 69aa3dc..67e5a3b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { } group = "net.azisaba" -version = "6.7.0" +version = "6.7.1" java { toolchain.languageVersion.set(JavaLanguageVersion.of(8)) diff --git a/src/main/java/com/github/mori01231/lifecore/command/ScheduleRestartCommand.java b/src/main/java/com/github/mori01231/lifecore/command/ScheduleRestartCommand.java index ebe4e92..f69d6a3 100644 --- a/src/main/java/com/github/mori01231/lifecore/command/ScheduleRestartCommand.java +++ b/src/main/java/com/github/mori01231/lifecore/command/ScheduleRestartCommand.java @@ -17,6 +17,7 @@ public class ScheduleRestartCommand implements TabExecutor { private static final Map> ACTIONS = new HashMap<>(); private static final List tasks = new ArrayList<>(); + private static boolean whitelistWasOn = false; private final LifeCore plugin; public ScheduleRestartCommand(@NotNull LifeCore plugin) { @@ -77,6 +78,7 @@ public void execute(int seconds) { ENABLE_WHITELIST { @Override public void execute(int seconds) { + whitelistWasOn = Bukkit.hasWhitelist(); Bukkit.setWhitelist(true); } }, @@ -92,7 +94,10 @@ public void execute(int seconds) { SCHEDULE_SHUTDOWN_SERVER { @Override public void execute(int seconds) { - Bukkit.getScheduler().runTaskLater(LifeCore.getPlugin(LifeCore.class), Bukkit::shutdown, 20 * 60); + Bukkit.getScheduler().runTaskLater(LifeCore.getPlugin(LifeCore.class), () -> { + if (!whitelistWasOn) Bukkit.setWhitelist(false); + Bukkit.shutdown(); + }, 20 * 60); } }, ;