Added Bedwars
Added ConfigurationHandler for games Further progress
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package eu.mhsl.minenet.minigames.util;
|
||||
|
||||
import net.minestom.server.item.Material;
|
||||
|
||||
public class MaterialUtil {
|
||||
public static Material fromString(String name, Material def) {
|
||||
return Material.values().stream().filter(material -> material.name().equals(name)).findFirst().orElse(def);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,26 @@
|
||||
package eu.mhsl.minenet.minigames.util;
|
||||
|
||||
import net.minestom.server.coordinate.Pos;
|
||||
|
||||
import java.util.InputMismatchException;
|
||||
|
||||
public class Position {
|
||||
public static final double PIXEL = 0.0625;
|
||||
|
||||
public static Pos getPosFromCommaSeparated(String input) {
|
||||
String[] coordinates = input.split(",");
|
||||
if(coordinates.length < 3) throw new InputMismatchException("Coordinates have to contain at least x, y and z");
|
||||
float x = Float.parseFloat(coordinates[0]);
|
||||
float y = Float.parseFloat(coordinates[1]);
|
||||
float z = Float.parseFloat(coordinates[2]);
|
||||
|
||||
if(coordinates.length > 4) {
|
||||
float yaw = Float.parseFloat(coordinates[3]);
|
||||
float pitch = Float.parseFloat(coordinates[4]);
|
||||
|
||||
return new Pos(x, y, z, yaw, pitch);
|
||||
}
|
||||
|
||||
return new Pos(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user