Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/main/java/de/j/stationofdoom/cmd/VoteRestartCMD.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public class VoteRestartCMD implements BasicCommand {
private final ArrayList<Player> votedPlayers = new ArrayList<>();
public static boolean restarting = false;

/**
* Handles a player-issued restart vote command: opens or joins a vote, broadcasts voting prompts, and triggers a server restart when unanimous.
*
* If no vote is active, marks the vote active and broadcasts a global notice and clickable vote prompts. If a vote is active, records the caller's vote or informs them they already voted. When every online player has voted, starts a countdown that broadcasts remaining seconds, then kicks all players with a restart message, invokes shutdown hooks, and restarts the server.
*
* @param commandSourceStack the command invocation context (expected to contain a Player sender)
* @param strings the command arguments (unused)
*/
@Override
public void execute(@NotNull CommandSourceStack commandSourceStack, @NotNull String[] strings) {
assert commandSourceStack.getSender() instanceof Player;
Expand Down Expand Up @@ -87,4 +95,4 @@ public void run() {
public boolean canUse(@NotNull CommandSender sender) {
return sender instanceof Player;
}
}
}