58 lines
1.7 KiB
Java
58 lines
1.7 KiB
Java
package me.unurled.raxen.commands.admin;
|
|
|
|
import static me.unurled.raxen.utils.Utils.colorString;
|
|
import static me.unurled.raxen.utils.Utils.log;
|
|
import static me.unurled.raxen.utils.Utils.noPerms;
|
|
|
|
import java.util.List;
|
|
import me.unurled.raxen.utils.Reload;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.command.TabExecutor;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
public class ReloadCommand implements TabExecutor {
|
|
|
|
@Override
|
|
public boolean onCommand(
|
|
@NotNull CommandSender sender,
|
|
@NotNull Command command,
|
|
@NotNull String msg,
|
|
@NotNull String[] args
|
|
) {
|
|
if (sender instanceof Player) {
|
|
Player player = (Player) sender;
|
|
if (!player.hasPermission("raxen.reload.cmd")) {
|
|
player.sendMessage(noPerms());
|
|
return true;
|
|
}
|
|
}
|
|
Reload.kickAll();
|
|
log(
|
|
colorString(
|
|
"<red>Server stopping!\n Using: /rlpl.\n Please wait a little bit."
|
|
)
|
|
);
|
|
new BukkitRunnable() {
|
|
@Override
|
|
public void run() {
|
|
Bukkit.getServer().shutdown();
|
|
}
|
|
}.runTaskLater(Bukkit.getPluginManager().getPlugin("Raxen"), 80L);
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public @Nullable List<String> onTabComplete(
|
|
@NotNull CommandSender sender,
|
|
@NotNull Command command,
|
|
@NotNull String alias,
|
|
@NotNull String[] args
|
|
) {
|
|
return null;
|
|
}
|
|
}
|