
org.bukkit.command.defaults.StopCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of walk-server Show documentation
Show all versions of walk-server Show documentation
A spigot fork to kotlin structure and news.
package org.bukkit.command.defaults;
import com.google.common.collect.ImmutableList;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.List;
@Deprecated
public class StopCommand extends VanillaCommand {
public StopCommand() {
super("stop");
this.description = "Stops the server with optional reason";
this.usageMessage = "/stop [reason]";
this.setPermission("bukkit.command.stop");
}
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
Command.broadcastCommandMessage(sender, "Stopping the server..");
Bukkit.shutdown();
String reason = this.createString(args, 0);
if (StringUtils.isNotEmpty(reason)) {
for (Player player : Bukkit.getOnlinePlayers()) {
player.kickPlayer(reason);
}
}
return true;
}
@Override
public List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
Validate.notNull(sender, "Sender cannot be null");
Validate.notNull(args, "Arguments cannot be null");
Validate.notNull(alias, "Alias cannot be null");
return ImmutableList.of();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy