Files
TorchPlugins/LuckPerms.Torch/Extensions/KeyedConfigurationExtensions.cs
2023-11-09 19:47:20 +07:00

20 lines
557 B
C#

using java.lang;
using me.lucko.luckperms.common.config.generic;
using me.lucko.luckperms.common.config.generic.key;
namespace LuckPerms.Torch.Extensions;
public static class KeyedConfigurationExtensions
{
public static bool GetBoolean(this KeyedConfiguration config, ConfigKey key, bool defaultValue = default)
{
var value = config.get(key);
return value switch
{
bool boolValue => boolValue,
Boolean booleanValue => booleanValue.booleanValue(),
_ => defaultValue
};
}
}