From dda75564f4078f179cf4da348d70816cfdac99ab Mon Sep 17 00:00:00 2001 From: William Date: Thu, 22 Aug 2024 14:11:02 +0100 Subject: [PATCH] fix: ensure TeleportationException is sent --- .../huskhomes/teleport/TeleportationException.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/net/william278/huskhomes/teleport/TeleportationException.java b/common/src/main/java/net/william278/huskhomes/teleport/TeleportationException.java index 4f329949..7f727974 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/TeleportationException.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/TeleportationException.java @@ -23,6 +23,7 @@ import lombok.Getter; import net.william278.huskhomes.HuskHomes; import net.william278.huskhomes.user.CommandUser; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class TeleportationException extends IllegalStateException { @@ -36,7 +37,10 @@ public class TeleportationException extends IllegalStateException { this.plugin = plugin; } - public void displayMessage(@NotNull CommandUser user, @NotNull String... args) { + public void displayMessage(@Nullable CommandUser user, @NotNull String... args) { + if (user == null) { + user = plugin.getConsole(); + } switch (type) { case TELEPORTER_NOT_FOUND -> plugin.getLocales() .getLocale("error_player_not_found", args)