diff --git a/src/main/java/world/bentobox/bentobox/database/yaml/YamlDatabaseHandler.java b/src/main/java/world/bentobox/bentobox/database/yaml/YamlDatabaseHandler.java index f4e807506..80beba26c 100644 --- a/src/main/java/world/bentobox/bentobox/database/yaml/YamlDatabaseHandler.java +++ b/src/main/java/world/bentobox/bentobox/database/yaml/YamlDatabaseHandler.java @@ -210,7 +210,15 @@ public class YamlDatabaseHandler extends AbstractDatabaseHandler { if (!(Enum.class.isAssignableFrom(propertyDescriptor.getPropertyType()) && setTo == null)) { // Do not invoke null on Enums try { - method.invoke(instance, setTo); + // Floats need special handling because the database returns them as doubles + Type setType = propertyDescriptor.getWriteMethod().getGenericParameterTypes()[0]; + if (setType.getTypeName().equals("float")) { + double d = (double) setTo; + float f = (float)d; + method.invoke(instance, f); + } else { + method.invoke(instance, setTo); + } } catch (Exception e) { plugin.logError("Could not deserialize. Attempt by " + instance.getClass().getCanonicalName() + " " + method.getName() + " to set to " + setTo); plugin.logError("Error message is: " + e.getMessage());