package jesse.keeblarcraft.Utils;

import com.mojang.brigadier.context.CommandContext;

import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;

public class PlayerChecks {
    public static Boolean HasPermission(CommandContext<ServerCommandSource> context) {
        if (context.getSource().isExecutedByPlayer() && HasPermission(context.getSource().getPlayer())) {
            return true;
        } else {
            return false;
        }
    }

    public static Boolean HasPermission(ServerPlayerEntity player) {
        if (player.hasPermissionLevel(4)) {
            return true;
        } else {
            player.sendMessage(Text.of("You do not have permission to use this command."));
            return false;
        }
    }
}
