From b3aa0b942f0327b65b125d423f0491a01a7ea358 Mon Sep 17 00:00:00 2001 From: MasterOfTheFish Date: Sat, 26 Feb 2022 00:50:15 -0500 Subject: [PATCH] Fixed teleporting error with player leaving wardrobe --- .../io/github/fisher2911/hmccosmetics/user/Wardrobe.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java index d42b4169..dba09f2d 100644 --- a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java +++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/Wardrobe.java @@ -136,7 +136,10 @@ public class Wardrobe extends User { this.cameraLocked = false; this.currentLocation = null; this.getPlayerArmor().clear(); - Bukkit.getScheduler().runTask(this.plugin, () -> viewer.teleport(settings.getLeaveLocation())); + Bukkit.getScheduler().runTask(this.plugin, () -> { + if (viewer == null || !viewer.isOnline()) return; + viewer.teleport(settings.getLeaveLocation()); + }); if (settings.isAlwaysDisplay()) { this.currentLocation = settings.getWardrobeLocation();