mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
2.2 compiles again :)
This commit is contained in:
parent
df6386ec2f
commit
7f94f3833d
@ -2,6 +2,7 @@ package com.gmail.nossr50.config.hocon.serializers;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.items.BukkitMMOItem;
|
import com.gmail.nossr50.datatypes.items.BukkitMMOItem;
|
||||||
import com.gmail.nossr50.datatypes.items.MMOItem;
|
import com.gmail.nossr50.datatypes.items.MMOItem;
|
||||||
|
import com.gmail.nossr50.util.nbt.RawNBT;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
import ninja.leaping.configurate.ValueType;
|
import ninja.leaping.configurate.ValueType;
|
||||||
@ -15,6 +16,7 @@ public class ItemStackSerializer implements TypeSerializer<MMOItem<?>> {
|
|||||||
|
|
||||||
private static final String ITEM_MINECRAFT_NAME = "Item-Name";
|
private static final String ITEM_MINECRAFT_NAME = "Item-Name";
|
||||||
private static final String AMOUNT = "Amount";
|
private static final String AMOUNT = "Amount";
|
||||||
|
private static final String NBT = "NBT";
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
@ -38,7 +40,13 @@ public class ItemStackSerializer implements TypeSerializer<MMOItem<?>> {
|
|||||||
amount = 1;
|
amount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BukkitMMOItem(itemIdentifier, amount);
|
RawNBT rawNBT = null;
|
||||||
|
|
||||||
|
if(itemNode.getNode(NBT).getValueType() != ValueType.NULL) {
|
||||||
|
rawNBT = value.getNode(NBT).getValue(TypeToken.of(RawNBT.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BukkitMMOItem(itemIdentifier, amount, rawNBT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -46,6 +54,7 @@ public class ItemStackSerializer implements TypeSerializer<MMOItem<?>> {
|
|||||||
ConfigurationNode itemNode = value.getNode(ITEM_MINECRAFT_NAME);
|
ConfigurationNode itemNode = value.getNode(ITEM_MINECRAFT_NAME);
|
||||||
value.getNode(ITEM_MINECRAFT_NAME).setValue(obj.getNamespaceKey());
|
value.getNode(ITEM_MINECRAFT_NAME).setValue(obj.getNamespaceKey());
|
||||||
itemNode.getNode(AMOUNT).setValue(obj.getItemAmount());
|
itemNode.getNode(AMOUNT).setValue(obj.getItemAmount());
|
||||||
|
itemNode.getNode(NBT).setValue(obj.getRawNBT());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user