Skip to content

Commit

Permalink
Keeps view same direction
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Jan 10, 2021
1 parent f2a4713 commit 52f7efb
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public void onVehicleMove(VehicleMoveEvent e) {

@EventHandler(priority = EventPriority.NORMAL)
public void onProtectionRangeChange(IslandProtectionRangeChangeEvent e) {

// Cleans up barrier blocks that were on old range
e.getIsland().getPlayersOnIsland().forEach(player -> hideBarrier(User.getInstance(player)));
}
Expand Down Expand Up @@ -157,7 +156,10 @@ private void teleportPlayer(Player p) {
Vector unitVector = i.getCenter().toVector().subtract(p.getLocation().toVector()).normalize()
.multiply(new Vector(1,0,1));
p.setVelocity(new Vector (0,0,0));
Util.teleportAsync(p, p.getLocation().toVector().add(unitVector).toLocation(p.getWorld()), TeleportCause.PLUGIN);
Location to = p.getLocation().toVector().add(unitVector).toLocation(p.getWorld());
to.setPitch(p.getLocation().getPitch());
to.setYaw(p.getLocation().getYaw());
Util.teleportAsync(p, to, TeleportCause.PLUGIN);
});
}

Expand Down

0 comments on commit 52f7efb

Please sign in to comment.