Skip to content

Commit

Permalink
Add TELEPORT_PLAYER action
Browse files Browse the repository at this point in the history
  • Loading branch information
JNNGL committed Jul 11, 2023
1 parent 82876d7 commit 646fc93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/net/elytrium/limbohub/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,11 @@ public enum Type {
SEND_MESSAGE,
OPEN_MENU,
CONNECT_TO_SERVER,
KICK_PLAYER
KICK_PLAYER,
TELEPORT_PLAYER
}

@Comment("Available values: DO_NOTHING, CLOSE_MENU, SEND_MESSAGE, OPEN_MENU, CONNECT_TO_SERVER, KICK_PLAYER")
@Comment("Available values: DO_NOTHING, CLOSE_MENU, SEND_MESSAGE, OPEN_MENU, CONNECT_TO_SERVER, KICK_PLAYER, TELEPORT_PLAYER")
public Type TYPE = Type.DO_NOTHING;
@Comment({
"Depends on action type:",
Expand All @@ -353,7 +354,8 @@ public enum Type {
"SEND_MESSAGE: Message to send, lines should be separated with {NL}.",
"OPEN_MENU: Menu ID",
"CONNECT_TO_SERVER: Server name (as in velocity.toml).",
"KICK_PLAYER: Kick reason"
"KICK_PLAYER: Kick reason",
"TELEPORT_PLAYER: Coordinates in \"x y z yaw pitch\" format."
})
public String DATA = "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ private void handleAction(Settings.MAIN.ACTION action) {
this.proxyPlayer.disconnect(LimboHub.getSerializer().deserialize(action.DATA));
break;

case TELEPORT_PLAYER:
String[] data = action.DATA.split(" ");
this.player.teleport(
Double.parseDouble(data[0]), Double.parseDouble(data[1]), Double.parseDouble(data[2]),
Float.parseFloat(data[3]), Float.parseFloat(data[4])
);
break;

default:
throw new IllegalStateException();
}
Expand Down

0 comments on commit 646fc93

Please sign in to comment.