Compatibility changes for Portals directions.

This commit is contained in:
Eric Stokes 2011-07-24 16:30:56 -06:00
parent 61e917a60f
commit d9530061ff

View File

@ -1,9 +1,24 @@
package com.onarandombox.utils; package com.onarandombox.utils;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.BlockFace;
public class LocationManipulation { public class LocationManipulation {
private static Map<String, Integer> orientationInts = new HashMap<String, Integer>();
static {
orientationInts.put("n", 0);
orientationInts.put("nw", 45);
orientationInts.put("w", 90);
orientationInts.put("sw", 135);
orientationInts.put("s", 180);
orientationInts.put("se", 225);
orientationInts.put("e", 270);
orientationInts.put("ne", 315);
}
/** /**
* Convert a Location into a Colon separated string to allow us to store it in text. * Convert a Location into a Colon separated string to allow us to store it in text.
@ -86,4 +101,11 @@ public class LocationManipulation {
return dir; return dir;
} }
public static float getYaw(String orientation) {
if (orientationInts.containsKey(orientation)) {
return (orientationInts.get(orientation) + 90) % 360;
}
return 0;
}
} }