From 006fe56d189303b88a8285e5e607ea3baf87a8d7 Mon Sep 17 00:00:00 2001 From: Ben Woo <30431861+benwoo1110@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:41:39 +0800 Subject: [PATCH] Fix edge case where PlayerTeleportEvent getTo is null --- .../MultiverseCore/listeners/MVPlayerListener.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java index e025aa95..0dbe76a3 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java @@ -169,6 +169,10 @@ public class MVPlayerListener implements Listener { if (event.isCancelled()) { return; } + if (event.getTo() == null) { + Logging.fine("Player '" + event.getPlayer().getName() + "' is teleporting to a null location!"); + return; + } Player teleportee = event.getPlayer(); CommandSender teleporter = teleportee; String teleporterName = MultiverseCore.getPlayerTeleporter(teleportee.getName()); @@ -284,6 +288,7 @@ public class MVPlayerListener implements Listener { } // The adjust should have happened much earlier. if (event.getTo() == null) { + Logging.fine("Player '" + event.getPlayer().getName() + "' is portaling to NULL location."); return; } MultiverseWorld fromWorld = this.worldManager.getMVWorld(event.getFrom().getWorld().getName());