Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.frankheijden.serverutils.bukkit.reflection;

import com.google.common.primitives.Primitives;
import dev.frankheijden.minecraftreflection.ClassObject;
import dev.frankheijden.minecraftreflection.MinecraftReflection;
import dev.frankheijden.minecraftreflection.MinecraftReflectionVersion;
Expand Down Expand Up @@ -124,7 +125,12 @@ public static Object getConfigValue(Object config, String key) {
public static void setConfigValue(Object config, Object console, String getMethod, String setMethod,
String configMethod, String key) {
Object defaultValue = reflection.invoke(console, getMethod);
Object configValue = RPropertyManager.getReflection().invoke(config, configMethod, key, defaultValue);
reflection.invoke(console, setMethod, configValue);
Class<?> defaultValueClass = Primitives.unwrap(defaultValue.getClass());
Object configValue = RPropertyManager.getReflection().invoke(
config,
configMethod,
ClassObject.of(key),
ClassObject.of(defaultValueClass, defaultValue));
reflection.invoke(console, setMethod, ClassObject.of(defaultValueClass, configValue));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public static MinecraftReflection getReflection() {
}

public static Object newInstance(Object options) {
return ROptionSet.getReflection().newInstance(options);
return getReflection().newInstance(options);
}
}