From 386ea57bbb9153bc24d99050b1f7866315574c61 Mon Sep 17 00:00:00 2001 From: William Date: Thu, 30 May 2024 00:21:21 +0100 Subject: [PATCH] fix: misleading error thrown expending free home slots, close #614 --- .../huskhomes/util/ValidationException.java | 11 ++++++++--- common/src/main/resources/locales/bg-bg.yml | 1 + common/src/main/resources/locales/de-de.yml | 1 + common/src/main/resources/locales/en-gb.yml | 1 + common/src/main/resources/locales/es-es.yml | 1 + common/src/main/resources/locales/fr-fr.yml | 1 + common/src/main/resources/locales/it-it.yml | 1 + common/src/main/resources/locales/ja-jp.yml | 1 + common/src/main/resources/locales/ko-kr.yml | 1 + common/src/main/resources/locales/pl-pl.yml | 1 + common/src/main/resources/locales/pt-br.yml | 1 + common/src/main/resources/locales/ru-ru.yml | 1 + common/src/main/resources/locales/tr-tr.yml | 1 + common/src/main/resources/locales/uk-ua.yml | 1 + common/src/main/resources/locales/zh-cn.yml | 1 + common/src/main/resources/locales/zh-tw.yml | 1 + 16 files changed, 23 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/net/william278/huskhomes/util/ValidationException.java b/common/src/main/java/net/william278/huskhomes/util/ValidationException.java index 0688555e..1ce3c9c3 100644 --- a/common/src/main/java/net/william278/huskhomes/util/ValidationException.java +++ b/common/src/main/java/net/william278/huskhomes/util/ValidationException.java @@ -56,15 +56,20 @@ public class ValidationException extends IllegalArgumentException { case DESCRIPTION_INVALID_LENGTH -> plugin.getLocales() .getLocale("error_home_description_length", args) .ifPresent(viewer::sendMessage); - case NOT_ENOUGH_HOME_SLOTS, REACHED_MAX_HOMES -> plugin.getLocales() + case REACHED_MAX_HOMES -> plugin.getLocales() .getLocale("error_set_home_maximum_homes", Integer.toString(plugin.getManager().homes() - .getMaxHomes(viewer instanceof OnlineUser user ? user : null))) + .getMaxHomes(viewer instanceof OnlineUser user ? user : null))) + .ifPresent(viewer::sendMessage); + case NOT_ENOUGH_HOME_SLOTS -> plugin.getLocales() + .getLocale("error_set_home_not_enough_slots", + Integer.toString(plugin.getManager().homes() + .getFreeHomes(viewer instanceof OnlineUser user ? user : null))) .ifPresent(viewer::sendMessage); case REACHED_MAX_PUBLIC_HOMES -> plugin.getLocales() .getLocale("error_edit_home_maximum_public_homes", Integer.toString(plugin.getManager().homes() - .getMaxPublicHomes(viewer instanceof OnlineUser user ? user : null))) + .getMaxPublicHomes(viewer instanceof OnlineUser user ? user : null))) .ifPresent(viewer::sendMessage); default -> { // Do nothing (silently handle validation errors) diff --git a/common/src/main/resources/locales/bg-bg.yml b/common/src/main/resources/locales/bg-bg.yml index 66817e40..0c3fc083 100644 --- a/common/src/main/resources/locales/bg-bg.yml +++ b/common/src/main/resources/locales/bg-bg.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Грешка:](#ff3300) [Не можахме да открием публичен дом притежаван от %1% наречен %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Грешка:](#ff3300) [Можете да поставяте максимум до %1% домове!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[Error:](#ff3300) [The spawn position has not been set.](#ff7e5e)' error_no_teleport_requests: '[Error:](#ff3300) [You do not have a pending teleport request.](#ff7e5e)' error_teleport_warmup_stand_still: '[Error:](#ff3300) [You must be standing still before starting a teleport!](#ff7e5e)' diff --git a/common/src/main/resources/locales/de-de.yml b/common/src/main/resources/locales/de-de.yml index 849b299d..7a4df554 100644 --- a/common/src/main/resources/locales/de-de.yml +++ b/common/src/main/resources/locales/de-de.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Fehler:](#ff3300) [Es wurde kein öffentliches Home von %1% namens "%2%" gefunden.](#ff7e5e)' error_set_home_maximum_homes: '[Fehler:](#ff3300) [Du darfst nicht mehr als %1% Home(s) setzen!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[Fehler:](#ff3300) [Es wurde keine Spawn-Position festgelegt.](#ff7e5e)' error_no_teleport_requests: '[Fehler:](#ff3300) [Du hast keine ausstehenden Teleportanfragen.](#ff7e5e)' error_teleport_warmup_stand_still: '[Fehler:](#ff3300) [Du musst stillstehen, bevor du eine Teleportation startest!](#ff7e5e)' diff --git a/common/src/main/resources/locales/en-gb.yml b/common/src/main/resources/locales/en-gb.yml index 790a7b6f..5b0d7fda 100644 --- a/common/src/main/resources/locales/en-gb.yml +++ b/common/src/main/resources/locales/en-gb.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Error:](#ff3300) [Could not find a public home owned by %1% called %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Error:](#ff3300) [You can only set a maximum of %1% homes!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[Error:](#ff3300) [The spawn position has not been set.](#ff7e5e)' error_no_teleport_requests: '[Error:](#ff3300) [You do not have a pending teleport request.](#ff7e5e)' error_teleport_warmup_stand_still: '[Error:](#ff3300) [You must be standing still before starting a teleport!](#ff7e5e)' diff --git a/common/src/main/resources/locales/es-es.yml b/common/src/main/resources/locales/es-es.yml index a87ba578..e549f69e 100644 --- a/common/src/main/resources/locales/es-es.yml +++ b/common/src/main/resources/locales/es-es.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Error:](#ff3300) [No se ha podido encontrar una casa pública propiedad de %1% llamada %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Error:](#ff3300) [Sólo se puede establecer un máximo de %1% casas!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[Error:](#ff3300) [La posición del spawn no ha sido fijada.](#ff7e5e)' error_no_teleport_requests: '[Error:](#ff3300) [No tienes solicitudes de teletransporte pendientes.](#ff7e5e)' error_teleport_warmup_stand_still: '[Error:](#ff3300) [Debes estar quieto ¡antes de iniciar un teletransporte!](#ff7e5e)' diff --git a/common/src/main/resources/locales/fr-fr.yml b/common/src/main/resources/locales/fr-fr.yml index 93e9d187..d6a1c057 100644 --- a/common/src/main/resources/locales/fr-fr.yml +++ b/common/src/main/resources/locales/fr-fr.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Erreur :](#ff3300) [L''home %2% posseder par %1% est introuvable.](#ff7e5e)' error_set_home_maximum_homes: '[Erreur :](#ff3300) [Vous ne pouvez avoir qu''un maximum de %1% homes !](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[Erreur :](#ff3300) [La position du spawn n''a pas été définit.](#ff7e5e)' error_no_teleport_requests: '[Erreur :](#ff3300) [Vous n''avez aucune demande de téléportation actuellement.](#ff7e5e)' error_teleport_warmup_stand_still: '[Erreur :](#ff3300) [Vous nez devez plus bouger lors d''une téléportation !](#ff7e5e)' diff --git a/common/src/main/resources/locales/it-it.yml b/common/src/main/resources/locales/it-it.yml index 31e1425f..f24a6a29 100644 --- a/common/src/main/resources/locales/it-it.yml +++ b/common/src/main/resources/locales/it-it.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Errore:](#ff3300) [Non trovo la home di %1% chiamata %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Errore:](#ff3300) [Puoi impostare un massimo di %1% home!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[Errore:](#ff3300) [Il punto di spawn non è impostato.](#ff7e5e)' error_no_teleport_requests: '[Errore:](#ff3300) [Non hai richieste di teletrasporto in sospeso.](#ff7e5e)' error_teleport_warmup_stand_still: '[Errore:](#ff3300) [Devi attendere e non muoverti mentre ti teletrasporti!](#ff7e5e)' diff --git a/common/src/main/resources/locales/ja-jp.yml b/common/src/main/resources/locales/ja-jp.yml index ea06cd2f..0ca13592 100644 --- a/common/src/main/resources/locales/ja-jp.yml +++ b/common/src/main/resources/locales/ja-jp.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[エラー:](#ff3300) [%1% が所有するパブリックホーム %2% は見つかりませんでした。](#ff7e5e)' error_set_home_maximum_homes: '[エラー:](#ff3300) [最大で %1% までしかホームを設定できません!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[エラー:](#ff3300) [スポーン位置がまだ設定されていません。](#ff7e5e)' error_no_teleport_requests: '[エラー:](#ff3300) [保留中のテレポートリクエストはありません。](#ff7e5e)' error_teleport_warmup_stand_still: '[エラー:](#ff3300) [テレポートを開始する前に静止している必要があります!](#ff7e5e)' diff --git a/common/src/main/resources/locales/ko-kr.yml b/common/src/main/resources/locales/ko-kr.yml index d330306a..d0550c8b 100644 --- a/common/src/main/resources/locales/ko-kr.yml +++ b/common/src/main/resources/locales/ko-kr.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[오류:](#ff3300) [%1%님이 소유한 공용 집 %2%를 찾을 수 없습니다.](#ff7e5e)' error_set_home_maximum_homes: '[오류:](#ff3300) [%1%개 이상의 집을 생성할 수 없습니다!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[오류:](#ff3300) [스폰 위치가 아직 지정되지 않았습니다.](#ff7e5e)' error_no_teleport_requests: '[오류:](#ff3300) [수락할 이동 요청이 없습니다.](#ff7e5e)' error_teleport_warmup_stand_still: '[오류:](#ff3300) [이동을 요청하려면 서 있어야 합니다!](#ff7e5e)' diff --git a/common/src/main/resources/locales/pl-pl.yml b/common/src/main/resources/locales/pl-pl.yml index eaf95a25..b2ff76ee 100644 --- a/common/src/main/resources/locales/pl-pl.yml +++ b/common/src/main/resources/locales/pl-pl.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Błąd:](#ff3300) [Nie można znaleźć domu publicznego należącego do %1% o nazwie %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Błąd:](#ff3300) [Możesz ustawić maksymalnie %1% domów!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[Błąd:](#ff3300) [Pozycja spawnu nie została jeszcze ustawiona.](#ff7e5e)' error_no_teleport_requests: '[Błąd:](#ff3300) [Nie masz oczekujących prośb o teleportację.](#ff7e5e)' error_teleport_warmup_stand_still: '[Błąd:](#ff3300) [Musisz stać w miejscu przed rozpoczęciem teleportacji!](#ff7e5e)' diff --git a/common/src/main/resources/locales/pt-br.yml b/common/src/main/resources/locales/pt-br.yml index 88155c8e..ecc69519 100644 --- a/common/src/main/resources/locales/pt-br.yml +++ b/common/src/main/resources/locales/pt-br.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Erro:](#ff3300) [Não foi possível encontrar uma casa pública de %1% chamada %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Erro:](#ff3300) [Você só pode definir no máximo %1% casas!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[Erro:](#ff3300) [A posição de spawn não foi definida.](#ff7e5e)' error_no_teleport_requests: '[Erro:](#ff3300) [Você não tem um pedido de teleporte pendente.](#ff7e5e)' error_teleport_warmup_stand_still: '[Erro:](#ff3300) [Você deve ficar parado antes de iniciar um teleporte!](#ff7e5e)' diff --git a/common/src/main/resources/locales/ru-ru.yml b/common/src/main/resources/locales/ru-ru.yml index 71f375bb..081fbcaa 100644 --- a/common/src/main/resources/locales/ru-ru.yml +++ b/common/src/main/resources/locales/ru-ru.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Ошибка:](#ff3300) [Невозможно найти публичный дом, принадлежащий %1%, с именем %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Ошибка:](#ff3300) [Вы можете установить максимум %1% домов!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[Ошибка:](#ff3300) [Позиция спавна не установлена.](#ff7e5e)' error_no_teleport_requests: '[Ошибка:](#ff3300) [У вас нет ожидающего запроса на телепортацию.](#ff7e5e)' error_teleport_warmup_stand_still: '[Ошибка:](#ff3300) [Перед началом телепортации вы должны стоять на месте!](#ff7e5e)' diff --git a/common/src/main/resources/locales/tr-tr.yml b/common/src/main/resources/locales/tr-tr.yml index 83df531c..794ac155 100644 --- a/common/src/main/resources/locales/tr-tr.yml +++ b/common/src/main/resources/locales/tr-tr.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Hata:](#ff3300) [%1% tarafından sahip olunan, %2% adında bir herkese açık ev bulunamadı.](#ff7e5e)' error_set_home_maximum_homes: '[Hata:](#ff3300) [En fazla %1% ev ayarlayabilirsiniz!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[Hata:](#ff3300) [Spawn konumu ayarlanmadı.](#ff7e5e)' error_no_teleport_requests: '[Hata:](#ff3300) [Bekleyen bir ışınlanma isteğiniz yok.](#ff7e5e)' error_teleport_warmup_stand_still: '[Hata:](#ff3300) [Işınlanmaya başlamadan önce hareketsiz duruyor olmalısınız!](#ff7e5e)' diff --git a/common/src/main/resources/locales/uk-ua.yml b/common/src/main/resources/locales/uk-ua.yml index 5d3249d8..3b9af198 100644 --- a/common/src/main/resources/locales/uk-ua.yml +++ b/common/src/main/resources/locales/uk-ua.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Помилка:](#ff3300) [Не знайдено домівку гравця %1% з назвою %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Помилка:](#ff3300) [Максимальна кількість твоїх домівок: %1%](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[Error:](#ff3300) [The spawn position has not been set.](#ff7e5e)' error_no_teleport_requests: '[Error:](#ff3300) [You do not have a pending teleport request.](#ff7e5e)' error_teleport_warmup_stand_still: '[Error:](#ff3300) [You must be standing still before starting a teleport!](#ff7e5e)' diff --git a/common/src/main/resources/locales/zh-cn.yml b/common/src/main/resources/locales/zh-cn.yml index e3f3d006..9e3abef0 100644 --- a/common/src/main/resources/locales/zh-cn.yml +++ b/common/src/main/resources/locales/zh-cn.yml @@ -145,6 +145,7 @@ locales: error_unknown_public_home: '[Error:](#ff3300) [找不到名为"%1%"的公共家.](#ff7e5e)' error_public_home_invalid: '[错误:](#ff3300) [%1% 没有 %2% 公共家.](#ff7e5e)' error_set_home_maximum_homes: '[错误:](#ff3300) [最多可以设置 %1% 个家!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[错误:](#ff3300) [重生点尚未设置](#ff7e5e)' error_no_teleport_requests: '[错误:](#ff3300) [你没有待处理的传送请求](#ff7e5e)' error_teleport_warmup_stand_still: '[错误:](#ff3300) [在传送时你不能移动!](#ff7e5e)' diff --git a/common/src/main/resources/locales/zh-tw.yml b/common/src/main/resources/locales/zh-tw.yml index 2b0d3d3c..49f360e6 100644 --- a/common/src/main/resources/locales/zh-tw.yml +++ b/common/src/main/resources/locales/zh-tw.yml @@ -145,6 +145,7 @@ error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[錯誤:](#ff3300) [沒有在 %1% 名下找到名為 %2% 的公開傳點.](#ff7e5e)' error_set_home_maximum_homes: '[錯誤:](#ff3300) [最多可以設置 %1% 個家!](#ff7e5e)' + error_set_home_not_enough_slots: '[Error:](#ff3300) [You have used all %1% of your free home slots!](#ff7e5e)' error_spawn_not_set: '[錯誤:](#ff3300) [重生點尚未設置.](#ff7e5e)' error_no_teleport_requests: '[錯誤:](#ff3300) [您沒有待處理的傳送請求.](#ff7e5e)' error_teleport_warmup_stand_still: '[錯誤:](#ff3300) [在傳送時您不能移動!](#ff7e5e)'