import * as mc from "@minecraft/server"

/** @param { mc.Player } player, @param { Objective } objective */
export function getScore(scoreboardIdentity, objective) {
    
    try {
        
        /** @type { mc.Scoreboard } */
        const score = mc.world.scoreboard()
        return score.getObjective(objective).getScore(scoreboardIdentity)
    
    
    } catch (error) {
        
        return 0
    
    
    }


}

/** @param { mc.Player } player, @param { Objective } objective */
export function setScore(player, objective, value) {
    
    player.runCommand("scoreboard players set @s " + objective + " " + value)


}
