Files
TorchPlugins/LuckPerms.Torch/Extensions/KeyedConfigurationExtensions.cs
2023-11-10 20:17:46 +07:00

20 lines
559 B
C#

using java.lang;
using me.lucko.luckperms.common.config.generic;
using me.lucko.luckperms.common.config.generic.key;
namespace LuckPerms.Torch.Extensions;
internal 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
};
}
}