fix: ensure TeleportationException is sent

This commit is contained in:
William committed 2024-08-22 14:11:02 +01:00
1 parent c1b0ebe93c
commit dda75564f4
1 file changed
+5 -1
@@ -23,6 +23,7 @@ import lombok.Getter;
import net.william278.huskhomes.HuskHomes; import net.william278.huskhomes.HuskHomes;
import net.william278.huskhomes.user.CommandUser; import net.william278.huskhomes.user.CommandUser;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class TeleportationException extends IllegalStateException { public class TeleportationException extends IllegalStateException {
@@ -36,7 +37,10 @@ public class TeleportationException extends IllegalStateException {
this.plugin = plugin; 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) { switch (type) {
case TELEPORTER_NOT_FOUND -> plugin.getLocales() case TELEPORTER_NOT_FOUND -> plugin.getLocales()
.getLocale("error_player_not_found", args) .getLocale("error_player_not_found", args)