configmanager: temp fix to prevent plugin-hub crashes
This commit is contained in:
@@ -27,7 +27,7 @@ object ProjectVersions {
|
|||||||
const val launcherVersion = "2.2.0"
|
const val launcherVersion = "2.2.0"
|
||||||
const val rlVersion = "1.8.5"
|
const val rlVersion = "1.8.5"
|
||||||
|
|
||||||
const val openosrsVersion = "4.15.7"
|
const val openosrsVersion = "4.15.8"
|
||||||
|
|
||||||
const val rsversion = 201
|
const val rsversion = 201
|
||||||
const val cacheversion = 165
|
const val cacheversion = 165
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.lang.reflect.Proxy;
|
import java.lang.reflect.Proxy;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.AtomicMoveNotSupportedException;
|
import java.nio.file.AtomicMoveNotSupportedException;
|
||||||
@@ -417,6 +418,11 @@ public class ConfigManager
|
|||||||
return getConfiguration(groupName, null, key, clazz);
|
return getConfiguration(groupName, null, key, clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> Object getConfiguration(String groupName, String key, Type clazz)
|
||||||
|
{
|
||||||
|
return getConfiguration(groupName, null, key, clazz);
|
||||||
|
}
|
||||||
|
|
||||||
public <T> T getRSProfileConfiguration(String groupName, String key, Class<T> clazz)
|
public <T> T getRSProfileConfiguration(String groupName, String key, Class<T> clazz)
|
||||||
{
|
{
|
||||||
String rsProfileKey = this.rsProfileKey;
|
String rsProfileKey = this.rsProfileKey;
|
||||||
@@ -428,6 +434,23 @@ public class ConfigManager
|
|||||||
return getConfiguration(groupName, rsProfileKey, key, clazz);
|
return getConfiguration(groupName, rsProfileKey, key, clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> T getConfiguration(String groupName, String profile, String key, Type clazz)
|
||||||
|
{
|
||||||
|
String value = getConfiguration(groupName, profile, key);
|
||||||
|
if (!Strings.isNullOrEmpty(value))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return (T) stringToObject(value, (Class<?>) clazz);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.warn("Unable to unmarshal {} ", getWholeKey(groupName, profile, key), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public <T> T getConfiguration(String groupName, String profile, String key, Class<T> clazz)
|
public <T> T getConfiguration(String groupName, String profile, String key, Class<T> clazz)
|
||||||
{
|
{
|
||||||
String value = getConfiguration(groupName, profile, key);
|
String value = getConfiguration(groupName, profile, key);
|
||||||
|
|||||||
Reference in New Issue
Block a user