Core/src/main/java/eu/univento/core/api/utils/Direction.java

41 lines
734 B
Java

/*
* Copyright (c) 2017 univento.eu - All rights reserved
* You are not allowed to use, distribute or modify this code
*/
package eu.univento.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 final int x;
private final int z;
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;
}
}