Skip to content
Snippets Groups Projects
Commit 9e523da1 authored by Yazawazi's avatar Yazawazi Committed by GitHub
Browse files

tp with relative coordinates

parent 0c4d9754
Branches
Tags
No related merge requests found
...@@ -24,9 +24,36 @@ public class TelePortCommand implements CommandHandler { ...@@ -24,9 +24,36 @@ public class TelePortCommand implements CommandHandler {
} }
try { try {
float x = Float.parseFloat(args.get(0)); float x = 0f;
float y = Float.parseFloat(args.get(1)); float y = 0f;
float z = Float.parseFloat(args.get(2)); float z = 0f;
if (args.get(0).contains("~")) {
if (args.get(0).equals("~")) {
x = sender.getPos().getX();
} else {
x = Float.parseFloat(args.get(0).replace("~", "")) + sender.getPos().getX();
}
} else {
x = Float.parseFloat(args.get(0));
}
if (args.get(1).contains("~")) {
if (args.get(1).equals("~")) {
y = sender.getPos().getY();
} else {
y = Float.parseFloat(args.get(1).replace("~", "")) + sender.getPos().getY();
}
} else {
y = Float.parseFloat(args.get(1));
}
if (args.get(2).contains("~")) {
if (args.get(2).equals("~")) {
z = sender.getPos().getZ();
} else {
z = Float.parseFloat(args.get(2).replace("~", "")) + sender.getPos().getZ();
}
} else {
z = Float.parseFloat(args.get(2));
}
int sceneId = sender.getSceneId(); int sceneId = sender.getSceneId();
if (args.size() == 4){ if (args.size() == 4){
sceneId = Integer.parseInt(args.get(3)); sceneId = Integer.parseInt(args.get(3));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment