From aa26d311bf625348cfa8c0d52350079a42b5e222 Mon Sep 17 00:00:00 2001 From: gravitylow Date: Wed, 29 Jan 2014 15:49:56 -0500 Subject: [PATCH] Fix yaml language configurations returning string lists --- .../config/holders/yaml/YamlLangHolder.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/gravitydevelopment/anticheat/config/holders/yaml/YamlLangHolder.java b/src/main/java/net/gravitydevelopment/anticheat/config/holders/yaml/YamlLangHolder.java index 10ee77c..0b0f04d 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/config/holders/yaml/YamlLangHolder.java +++ b/src/main/java/net/gravitydevelopment/anticheat/config/holders/yaml/YamlLangHolder.java @@ -24,6 +24,8 @@ import net.gravitydevelopment.anticheat.config.ConfigurationFile; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; +import java.sql.PreparedStatement; +import java.sql.SQLException; import java.util.List; public class YamlLangHolder extends ConfigurationFile implements InvocationHandler { @@ -63,6 +65,20 @@ public class YamlLangHolder extends ConfigurationFile implements InvocationHandl } public Object invoke(Object proxy, Method method, Object[] args) { - return new ConfigValue(method.getName()).getValue(); + String key = method.getName(); + + if (method.getReturnType() == List.class) { + ConfigValue> value = new ConfigValue>(key); + if (value.getValue() != null) { + return value.getValue(); + } + } else { + ConfigValue value = new ConfigValue(key); + if (value.getValue() != null) { + return value.getValue(); + } + } + AntiCheat.getPlugin().getLogger().severe("The lang value " + key + " couldn't be found."); + return "Language error. See console for details."; } }