Skip to content

Commit

Permalink
Fix edge case where PlayerTeleportEvent getTo is null
Browse files Browse the repository at this point in the history
  • Loading branch information
benwoo1110 committed Aug 12, 2024
1 parent 17129f6 commit 006fe56
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ public void playerTeleport(PlayerTeleportEvent event) {
if (event.isCancelled()) {
return;
}
if (event.getTo() == null) {
Logging.fine("Player '" + event.getPlayer().getName() + "' is teleporting to a null location!");

Check warning on line 173 in src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java

View workflow job for this annotation

GitHub Actions / checkstyle / checkstyle

[checkstyle] reported by reviewdog 🐶 The String "Player '" appears 12 times in the file. Raw Output: /github/workspace/./src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java:173:26: warning: The String "Player '" appears 12 times in the file. (com.puppycrawl.tools.checkstyle.checks.coding.MultipleStringLiteralsCheck)
return;
}
Player teleportee = event.getPlayer();
CommandSender teleporter = teleportee;
String teleporterName = MultiverseCore.getPlayerTeleporter(teleportee.getName());
Expand Down Expand Up @@ -284,6 +288,7 @@ public void playerPortal(PlayerPortalEvent event) {
}
// 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());
Expand Down

0 comments on commit 006fe56

Please sign in to comment.