Permalink
Browse files

Fixed serialisation of vectors.

  • Loading branch information...
me4502 committed Nov 5, 2018
1 parent 4e4ed6c commit 626861aa99c0821fec3a94dabb239a36a2e708ad
Showing with 20 additions and 0 deletions.
  1. +20 −0 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 @@ private Object prepareSerialization(Object value) {
out.put("y", vec.getY());
out.put("z", vec.getZ());
return out;
} else if (value instanceof BlockVector3) {
Map<String, Integer> 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<String, Double> 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<String, Integer> out = new LinkedHashMap<>();
BlockVector2 vec = (BlockVector2) value;
out.put("x", vec.getBlockX());
out.put("z", vec.getBlockZ());
return out;
}
return value;

0 comments on commit 626861a

Please sign in to comment.