diff --git a/src/main/java/org/spongepowered/api/data/MemoryDataView.java b/src/main/java/org/spongepowered/api/data/MemoryDataView.java index 083e8c5a1ec..c11c585401f 100644 --- a/src/main/java/org/spongepowered/api/data/MemoryDataView.java +++ b/src/main/java/org/spongepowered/api/data/MemoryDataView.java @@ -239,13 +239,13 @@ public DataView set(DataQuery path, Object value) { if (value instanceof DataView) { checkArgument(value != this, "Cannot set a DataView to itself."); copyDataView(path, (DataView) value); - } else if (value instanceof CatalogType) { - return set(path, ((CatalogType) value).getId()); - } else if (value instanceof DataSerializable) { + }else if (value instanceof DataSerializable) { DataContainer valueContainer = ((DataSerializable) value).toContainer(); checkArgument(!(valueContainer).equals(this), "Cannot insert self-referencing DataSerializable"); copyDataView(path, valueContainer); - } else { + } else if (value instanceof CatalogType) { + return set(path, ((CatalogType) value).getId()); + } else { List parts = path.getParts(); if (parts.size() > 1) { String subKey = parts.get(0); @@ -791,7 +791,10 @@ public Optional getSerializable(DataQuery path, checkNotNull(clazz, "clazz"); DataManager manager = Sponge.getDataManager(); if (clazz.isAssignableFrom(CatalogType.class)) { - return (Optional) getCatalogType(path, ((Class) clazz)); + final Optional catalog = (Optional) getCatalogType(path, ((Class) clazz)); + if (catalog.isPresent()) { + return catalog; + } } Optional optional = getUnsafeView(path);