Added new Configuration classes

This commit is contained in:
Dinnerbone
2011-09-19 20:36:44 +01:00
committed by Nathan Adams
parent 4155a42406
commit 55f405f4a8
31 changed files with 3454 additions and 9 deletions

View File

@@ -1,13 +1,15 @@
package org.bukkit.util;
import java.util.Map;
import org.bukkit.configuration.serialization.SerializableAs;
/**
* A vector with a hash function that floors the X, Y, Z components, a la
* BlockVector in WorldEdit. BlockVectors can be used in hash sets and
* hash maps. Be aware that BlockVectors are mutable, but it is important
* that BlockVectors are never changed once put into a hash set or hash map.
*
* @author sk89q
*/
@SerializableAs("BlockVector")
public class BlockVector extends Vector {
/**
@@ -109,4 +111,22 @@ public class BlockVector extends Vector {
v.z = z;
return v;
}
public static BlockVector deserialize(Map<String, Object> args) {
double x = 0;
double y = 0;
double z = 0;
if (args.containsKey("x")) {
x = (Double)args.get("x");
}
if (args.containsKey("y")) {
y = (Double)args.get("y");
}
if (args.containsKey("z")) {
z = (Double)args.get("z");
}
return new BlockVector(x, y, z);
}
}