Skip to content

Commit

Permalink
feat: turn off whitelist if it was off
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed Sep 14, 2023
1 parent ab9f18e commit e810570
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "net.azisaba"
version = "6.7.0"
version = "6.7.1"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
public class ScheduleRestartCommand implements TabExecutor {
private static final Map<Integer, Set<Action>> ACTIONS = new HashMap<>();
private static final List<BukkitTask> tasks = new ArrayList<>();
private static boolean whitelistWasOn = false;
private final LifeCore plugin;

public ScheduleRestartCommand(@NotNull LifeCore plugin) {
Expand Down Expand Up @@ -77,6 +78,7 @@ public void execute(int seconds) {
ENABLE_WHITELIST {
@Override
public void execute(int seconds) {
whitelistWasOn = Bukkit.hasWhitelist();
Bukkit.setWhitelist(true);
}
},
Expand All @@ -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);
}
},
;
Expand Down

0 comments on commit e810570

Please sign in to comment.