package eu.mhsl.minenet.minigames.command.privileged;

import eu.mhsl.minenet.minigames.command.PrivilegedCommand;
import eu.mhsl.minenet.minigames.message.type.ChatMessage;
import eu.mhsl.minenet.minigames.message.Icon;
import net.minestom.server.MinecraftServer;
import net.minestom.server.entity.Player;

public class RefreshCommandsCommand extends PrivilegedCommand {
    public RefreshCommandsCommand() {
        super("refreshCommands");

        setDefaultExecutor((sender, context) -> {
            MinecraftServer.getConnectionManager().getOnlinePlayers().forEach(Player::refreshCommands);
            new ChatMessage(Icon.SUCCESS).appendStatic("Updated command syntax!").send(sender);
        });
    }
}
