Core/src/de/joethei/core/api/utils/Direction.java

37 lines
638 B
Java

package de.joethei.core.api.utils;
public enum Direction
{
NORTH(1, 0),
SOUTH(-1, 0),
EAST(0, 1),
WEST(0, -1),
NORTHEAST(1, 1),
SOUTHEAST(-1, 1),
NORTHWEST(1, -1),
SOUTHWEST(-1, -1);
private int x;
private int z;
private Direction(int x, int z) { this.x = x;
this.z = z; }
public int getX()
{
return this.x;
}
public int getZ() {
return this.z;
}
public static Direction getDirection(String direction) {
for (Direction dir : values())
{
if (dir.name().equalsIgnoreCase(direction))
return dir;
}
return null;
}
}