Skip to content

Commit

Permalink
Attempt to fix the teleport command.
Browse files Browse the repository at this point in the history
  • Loading branch information
KingRainbow44 committed Jul 24, 2022
1 parent 818bfb8 commit 41ec231
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ public void execute(Player sender, Player targetPlayer, List<String> args) {

Position target_pos = new Position(x, y, z);
PlayerTeleportEvent event = new PlayerTeleportEvent(targetPlayer, PlayerTeleportEvent.TeleportType.COMMAND,
targetPlayer.getPos(), target_pos);
targetPlayer.getPosition(), target_pos);
event.call();

boolean result = !event.isCanceled() || targetPlayer.getWorld().transferPlayerToScene(targetPlayer, sceneId, event.getDestination());
// Return if event was cancelled.
if(event.isCanceled()) {
return;
}

boolean result = targetPlayer.getWorld().transferPlayerToScene(targetPlayer, sceneId, event.getDestination());
if (!result) {
CommandHandler.sendMessage(sender, translate(sender, "commands.teleport.exists_error"));
} else {
Expand Down

0 comments on commit 41ec231

Please sign in to comment.