Introdução ao HOCON
HOCON (Human-Optimized Config Object Notation) is an easy-to-use configuration format. It is used by Sponge and
individual plugins utilizing SpongeAPI to store important data, such as configuration or player data. HOCON files
typically use the suffix .conf.
Componentes
uma
chaveé uma string que precede um valorum
valoré uma string, número, objeto, array, ou booleano que segue umachaveum
separador chave-valorsepara chaves de valores e pode ser um:ou=um
comentárioé prefixado com#ou//e serve normalmente para dar feedback ou instruções
Exemplo:
yellow-thing: "Sponge"
Nesse exemplo, a chave é yellow-thing, o valor é Sponge, e o separador chave-valor é :.
Trabalhando com HOCON
O HOCON é mais flexível que o formato JSON (JavaScript Object Notation) por existirem várias formas de escrever um HOCON válido. Abaixo há dois exemplos de um HOCON válido.
Exemplo #1:
player: {
name: "Steve",
level: 30
}
Exemplo #2:
player {
name = "Steve"
level = 30
}
In practice, it is best to follow the formatting conventions of the HOCON configuration you are editing. When editing a HOCON configuration for Sponge or an individual plugin utilizing SpongeAPI, the values are likely the only thing you will be changing unless otherwise specified.
Depurando sua configuração
Se uma configuração HOCON parecer não estar funcionando, aqui estão algumas dicas.
As chaves (pontuação) devem estar balanceadas
O número de aspas devem estar equilibradas
Quando há chaves duplicadas, a que aparece depois tem prioridade
Especificação
Mais informação sobre o formato HOCON pode ser encontrado aqui.