Add EntityPose as deserializable
This commit is contained in:
parent
35ad450bc3
commit
93fdb30227
@ -6,6 +6,7 @@ import com.google.gson.internal.LinkedTreeMap;
|
|||||||
import me.libraryaddict.disguise.disguisetypes.*;
|
import me.libraryaddict.disguise.disguisetypes.*;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
import me.libraryaddict.disguise.utilities.params.ParamInfoManager;
|
import me.libraryaddict.disguise.utilities.params.ParamInfoManager;
|
||||||
|
import me.libraryaddict.disguise.utilities.params.types.ParamInfoEnum;
|
||||||
import me.libraryaddict.disguise.utilities.params.types.custom.ParamInfoParticle;
|
import me.libraryaddict.disguise.utilities.params.types.custom.ParamInfoParticle;
|
||||||
import me.libraryaddict.disguise.utilities.parser.DisguiseParseException;
|
import me.libraryaddict.disguise.utilities.parser.DisguiseParseException;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -73,6 +74,8 @@ public class SerializerFlagWatcher implements JsonDeserializer<FlagWatcher>, Jso
|
|||||||
} else if (entry.getValue() instanceof String) {
|
} else if (entry.getValue() instanceof String) {
|
||||||
if (index.getDefault() instanceof WrappedParticle) {
|
if (index.getDefault() instanceof WrappedParticle) {
|
||||||
entry.setValue(((ParamInfoParticle) ParamInfoManager.getParamInfo(WrappedParticle.class)).fromString((String) entry.getValue()));
|
entry.setValue(((ParamInfoParticle) ParamInfoManager.getParamInfo(WrappedParticle.class)).fromString((String) entry.getValue()));
|
||||||
|
} else if (index.getDefault() instanceof EntityPose) {
|
||||||
|
entry.setValue(((ParamInfoEnum) ParamInfoManager.getParamInfo(EntityPose.class)).fromString((String) entry.getValue()));
|
||||||
}
|
}
|
||||||
} else if (entry.getValue() instanceof LinkedTreeMap) { // If it's deserialized incorrectly as a map
|
} else if (entry.getValue() instanceof LinkedTreeMap) { // If it's deserialized incorrectly as a map
|
||||||
// If the default value is not VillagerData
|
// If the default value is not VillagerData
|
||||||
|
@ -26,7 +26,7 @@ public class ParamInfoEnum extends ParamInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object fromString(String string) throws DisguiseParseException {
|
public Object fromString(String string) throws DisguiseParseException {
|
||||||
string = string.replace("_", "");
|
string = string.replace("_", "");
|
||||||
|
|
||||||
for (Map.Entry<String, Object> entry : getValues().entrySet()) {
|
for (Map.Entry<String, Object> entry : getValues().entrySet()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user