net.minestom.server.command.builder.arguments.relative.ArgumentRelativeVec2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minestom-snapshots Show documentation
Show all versions of minestom-snapshots Show documentation
1.20.4 Lightweight Minecraft server
package net.minestom.server.command.builder.arguments.relative;
import net.minestom.server.coordinate.Vec;
import org.jetbrains.annotations.NotNull;
import java.util.function.Function;
/**
* Represents a {@link Vec} with 2 floating numbers (x;z) which can take relative coordinates.
*
* Example: -1.2 ~
*/
public class ArgumentRelativeVec2 extends ArgumentRelativeVec {
public ArgumentRelativeVec2(@NotNull String id) {
super(id, 2);
}
@Override
public String parser() {
return "minecraft:vec2";
}
@Override
public String toString() {
return String.format("RelativeVec2<%s>", getId());
}
@Override
Function getRelativeNumberParser() {
return Double::parseDouble;
}
@Override
Function getAbsoluteNumberParser() {
return Double::parseDouble;
}
}