Skip to content

Commit

Permalink
Fix teleporting away from a Course detection
Browse files Browse the repository at this point in the history
  • Loading branch information
A5H73Y committed Mar 3, 2023
1 parent ad5cb2e commit 9ce67e1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public void onPlayerDisconnect(PlayerQuitEvent event) {
*
* @param event PlayerTeleportEvent
*/
@EventHandler
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerTeleport(PlayerTeleportEvent event) {
Player player = event.getPlayer();

Expand All @@ -279,7 +279,7 @@ public void onPlayerTeleport(PlayerTeleportEvent event) {
World nextCheckpointWorld = session.getNextCheckpoint() != null
? session.getNextCheckpoint().getLocation().getWorld() : null;

if (event.getFrom().getWorld() != player.getWorld()
if (player.getWorld() != event.getTo().getWorld()
&& (nextCheckpointWorld == null || nextCheckpointWorld != event.getTo().getWorld())) {
if (parkour.getParkourConfig().isCourseEnforceWorldLeaveCourse()) {
parkour.getPlayerManager().leaveCourse(player, true);
Expand Down

0 comments on commit 9ce67e1

Please sign in to comment.