package me.km.snuviscript.commands;

import me.hammerle.snuviscript.code.ScriptManager;
import me.km.permissions.Permissions;
import net.minecraft.entity.Entity;

public class PermissionCommands {
    public static void registerFunctions(ScriptManager sm, Permissions perms) {
        sm.registerConsumer("perm.clear", (sc, in) -> perms.clear());
        sm.registerConsumer("perm.registergroup", (sc, in) -> perms.register(in[0].getInt(sc), in[1].getString(sc)));
        sm.registerConsumer("perm.registerplayer", (sc, in) -> {
            perms.register(CommandUtils.getUUID(in[0].get(sc)), in[1].getInt(sc));
        });
        sm.registerFunction("perm.unregisterplayer", (sc, in) -> perms.unregister(CommandUtils.getUUID(in[0].get(sc)), in[1].getInt(sc)));
        sm.registerFunction("perm.has", (sc, in) -> perms.has((Entity) in[0].get(sc), in[1].getString(sc)));
    }
}
