From 626861aa99c0821fec3a94dabb239a36a2e708ad Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Mon, 5 Nov 2018 23:27:03 +1000 Subject: [PATCH] Fixed serialisation of vectors. --- .../java/com/sk89q/util/yaml/YAMLNode.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java index e9fd96e16..0742c9ceb 100644 --- a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java +++ b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java @@ -20,6 +20,7 @@ package com.sk89q.util.yaml; import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector2; import com.sk89q.worldedit.math.Vector3; @@ -118,6 +119,25 @@ public class YAMLNode { out.put("y", vec.getY()); out.put("z", vec.getZ()); return out; + } else if (value instanceof BlockVector3) { + Map out = new LinkedHashMap<>(); + BlockVector3 vec = (BlockVector3) value; + out.put("x", vec.getBlockX()); + out.put("y", vec.getBlockY()); + out.put("z", vec.getBlockZ()); + return out; + } else if (value instanceof Vector2) { + Map out = new LinkedHashMap<>(); + Vector2 vec = (Vector2) value; + out.put("x", vec.getX()); + out.put("z", vec.getZ()); + return out; + } else if (value instanceof BlockVector2) { + Map out = new LinkedHashMap<>(); + BlockVector2 vec = (BlockVector2) value; + out.put("x", vec.getBlockX()); + out.put("z", vec.getBlockZ()); + return out; } return value;