From 054e78a2c9322b1ea6d37824f5fd178798dddcad Mon Sep 17 00:00:00 2001 From: tastybento Date: Mon, 20 Apr 2026 15:22:15 -0700 Subject: [PATCH] feat: make 'hand' keyword localizable in donate/value commands; sync locales - Add island.donate.hand.keyword locale key (en-US: "hand") so each language can provide its own word for the hand subcommand arg - IslandDonateCommand: accept both English "hand" and the localized keyword; tab-complete shows the localized keyword - IslandValueCommand: same localizable keyword for HAND arg and tab-complete - All 16 non-English locales: add island.donate.hand.keyword (translated) and island.donate.invalid-item (translated) - uk.yml: fully translate donate section (parameters, description, all messages) and update value command parameters/description Co-Authored-By: Claude Sonnet 4.6 --- .../level/commands/IslandDonateCommand.java | 14 +++++-- .../level/commands/IslandValueCommand.java | 5 ++- src/main/resources/locales/cs.yml | 2 + src/main/resources/locales/de.yml | 2 + src/main/resources/locales/en-US.yml | 1 + src/main/resources/locales/es.yml | 2 + src/main/resources/locales/fr.yml | 2 + src/main/resources/locales/hu.yml | 2 + src/main/resources/locales/id.yml | 2 + src/main/resources/locales/ko.yml | 2 + src/main/resources/locales/lv.yml | 2 + src/main/resources/locales/nl.yml | 2 + src/main/resources/locales/pl.yml | 2 + src/main/resources/locales/pt.yml | 2 + src/main/resources/locales/ru.yml | 2 + src/main/resources/locales/tr.yml | 2 + src/main/resources/locales/uk.yml | 41 ++++++++++--------- src/main/resources/locales/vi.yml | 2 + src/main/resources/locales/zh-CN.yml | 2 + .../commands/IslandDonateCommandTest.java | 1 + .../commands/IslandValueCommandTest.java | 4 +- 21 files changed, 69 insertions(+), 27 deletions(-) diff --git a/src/main/java/world/bentobox/level/commands/IslandDonateCommand.java b/src/main/java/world/bentobox/level/commands/IslandDonateCommand.java index 37e1f28..fa76d70 100644 --- a/src/main/java/world/bentobox/level/commands/IslandDonateCommand.java +++ b/src/main/java/world/bentobox/level/commands/IslandDonateCommand.java @@ -60,8 +60,8 @@ public boolean execute(User user, String label, List args) { return false; } - // Handle "hand" subcommand - if (!args.isEmpty() && "hand".equalsIgnoreCase(args.get(0))) { + // Handle "hand" subcommand (accepts English "hand" or the localized keyword) + if (!args.isEmpty() && isHandKeyword(user, args.get(0))) { return handleHandDonation(user, island, args); } @@ -145,10 +145,11 @@ private void performHandDonation(User user, Island island, Material material, in @Override public Optional> tabComplete(User user, String alias, List args) { String lastArg = !args.isEmpty() ? args.get(args.size() - 1) : ""; + String handKeyword = user.getTranslation("island.donate.hand.keyword"); if (args.size() <= 1) { - return Optional.of(Util.tabLimit(List.of("hand"), lastArg)); + return Optional.of(Util.tabLimit(List.of(handKeyword), lastArg)); } - if (args.size() == 2 && "hand".equalsIgnoreCase(args.get(0)) && user.isPlayer()) { + if (args.size() == 2 && isHandKeyword(user, args.get(0)) && user.isPlayer()) { int held = user.getPlayer().getInventory().getItemInMainHand().getAmount(); if (held > 0) { return Optional.of(Util.tabLimit(List.of(String.valueOf(held)), lastArg)); @@ -156,4 +157,9 @@ public Optional> tabComplete(User user, String alias, List } return Optional.of(List.of()); } + + private boolean isHandKeyword(User user, String arg) { + String localized = user.getTranslation("island.donate.hand.keyword"); + return "hand".equalsIgnoreCase(arg) || localized.equalsIgnoreCase(arg); + } } diff --git a/src/main/java/world/bentobox/level/commands/IslandValueCommand.java b/src/main/java/world/bentobox/level/commands/IslandValueCommand.java index c4011f7..92141ff 100644 --- a/src/main/java/world/bentobox/level/commands/IslandValueCommand.java +++ b/src/main/java/world/bentobox/level/commands/IslandValueCommand.java @@ -60,7 +60,8 @@ public boolean execute(User user, String label, List args) { } String arg = args.get(0); - if ("HAND".equalsIgnoreCase(arg)) { + String handKeyword = user.getTranslation("island.donate.hand.keyword"); + if ("HAND".equalsIgnoreCase(arg) || handKeyword.equalsIgnoreCase(arg)) { executeHandCommand(user); return true; } @@ -158,7 +159,7 @@ public Optional> tabComplete(User user, String alias, List List options = new ArrayList<>( Arrays.stream(Material.values()).filter(Material::isBlock).map(Material::name).map(String::toLowerCase).toList()); - options.add("HAND"); + options.add(user.getTranslation("island.donate.hand.keyword")); return Optional.of(Util.tabLimit(options, lastArg)); } diff --git a/src/main/resources/locales/cs.yml b/src/main/resources/locales/cs.yml index 9e7e836..35ec78b 100644 --- a/src/main/resources/locales/cs.yml +++ b/src/main/resources/locales/cs.yml @@ -53,6 +53,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Darovat lze pouze bloky s nakonfigurovanou hodnotou úrovně." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -62,6 +63,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "ruka" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/de.yml b/src/main/resources/locales/de.yml index 2adfc2f..b05dab9 100644 --- a/src/main/resources/locales/de.yml +++ b/src/main/resources/locales/de.yml @@ -54,6 +54,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Es können nur Blöcke mit einem konfigurierten Levelwert gespendet werden." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -63,6 +64,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "hand" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/en-US.yml b/src/main/resources/locales/en-US.yml index 08f3835..ff81550 100755 --- a/src/main/resources/locales/en-US.yml +++ b/src/main/resources/locales/en-US.yml @@ -68,6 +68,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "hand" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/es.yml b/src/main/resources/locales/es.yml index 47f583c..0d93e3f 100644 --- a/src/main/resources/locales/es.yml +++ b/src/main/resources/locales/es.yml @@ -51,6 +51,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Solo se pueden donar bloques con un valor de nivel configurado." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -60,6 +61,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "mano" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/fr.yml b/src/main/resources/locales/fr.yml index 27a1bd8..e1265d1 100644 --- a/src/main/resources/locales/fr.yml +++ b/src/main/resources/locales/fr.yml @@ -53,6 +53,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Seuls les blocs avec une valeur de niveau configurée peuvent être donnés." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -62,6 +63,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "main" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/hu.yml b/src/main/resources/locales/hu.yml index afff3ef..7be400a 100644 --- a/src/main/resources/locales/hu.yml +++ b/src/main/resources/locales/hu.yml @@ -54,6 +54,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Csak konfigurált szintértékkel rendelkező blokkok adományozhatók." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -63,6 +64,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "kez" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/id.yml b/src/main/resources/locales/id.yml index f0c6574..539666b 100644 --- a/src/main/resources/locales/id.yml +++ b/src/main/resources/locales/id.yml @@ -51,6 +51,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Hanya blok dengan nilai level yang dikonfigurasi yang dapat didonasikan." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -60,6 +61,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "tangan" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/ko.yml b/src/main/resources/locales/ko.yml index 6cbb516..f846737 100644 --- a/src/main/resources/locales/ko.yml +++ b/src/main/resources/locales/ko.yml @@ -54,6 +54,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "설정된 레벨 값이 있는 블록만 기부할 수 있습니다." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -63,6 +64,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "hand" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/lv.yml b/src/main/resources/locales/lv.yml index 5792196..7ec2474 100644 --- a/src/main/resources/locales/lv.yml +++ b/src/main/resources/locales/lv.yml @@ -54,6 +54,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Var ziedot tikai blokus ar konfigurētu līmeņa vērtību." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -63,6 +64,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "roka" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/nl.yml b/src/main/resources/locales/nl.yml index 6fe42e4..324b896 100644 --- a/src/main/resources/locales/nl.yml +++ b/src/main/resources/locales/nl.yml @@ -51,6 +51,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Alleen blokken met een geconfigureerde niveauwaarde kunnen worden gedoneerd." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -60,6 +61,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "hand" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/pl.yml b/src/main/resources/locales/pl.yml index a40d8fc..da6ad80 100644 --- a/src/main/resources/locales/pl.yml +++ b/src/main/resources/locales/pl.yml @@ -51,6 +51,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Można darować tylko bloki ze skonfigurowaną wartością poziomu." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -60,6 +61,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "reka" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/pt.yml b/src/main/resources/locales/pt.yml index 844402b..57fbabe 100644 --- a/src/main/resources/locales/pt.yml +++ b/src/main/resources/locales/pt.yml @@ -54,6 +54,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Apenas blocos com um valor de nível configurado podem ser doados." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -63,6 +64,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "mao" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/ru.yml b/src/main/resources/locales/ru.yml index 6150490..2dc53da 100644 --- a/src/main/resources/locales/ru.yml +++ b/src/main/resources/locales/ru.yml @@ -54,6 +54,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Можно жертвовать только блоки с настроенным значением уровня." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -63,6 +64,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "рука" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/tr.yml b/src/main/resources/locales/tr.yml index 1be47bb..689f9b8 100644 --- a/src/main/resources/locales/tr.yml +++ b/src/main/resources/locales/tr.yml @@ -58,6 +58,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Yalnızca yapılandırılmış seviye değerine sahip bloklar bağışlanabilir." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -67,6 +68,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "el" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/uk.yml b/src/main/resources/locales/uk.yml index 8bf009b..9ac33d3 100644 --- a/src/main/resources/locales/uk.yml +++ b/src/main/resources/locales/uk.yml @@ -45,24 +45,26 @@ island: in-progress: " Розрахунок рівня острова триває..." time-out: " Розрахунок рівня тривав занадто довго. Будь-ласка спробуйте пізніше." donate: - parameters: "[hand [amount]]" - description: "donate blocks to permanently raise island level" - must-be-on-island: "You must be on your island to donate blocks." - no-permission: "You do not have permission to donate blocks on this island." - no-value: "That block has no level value." - invalid-amount: "Invalid amount. Use a positive number." - empty: "There are no valid blocks to donate." - cancelled: "Donation cancelled. Items returned." - success: "Donated [number] blocks for [points] points! These points are permanent." - confirm: "Confirm - Items will be DESTROYED!" - cancel: "Cancel - Return Items" - gui-title: "Donate Blocks" - gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" - preview: "Points to add: [points]|These items will be destroyed!" + parameters: "[рука [кількість]]" + description: "пожертвувати блоки для постійного підвищення рівня острова" + must-be-on-island: "Щоб пожертвувати блоки, ви повинні бути на своєму острові." + no-permission: "У вас немає дозволу жертвувати блоки на цьому острові." + no-value: "Цей блок не має значення рівня." + invalid-amount: "Недійсна кількість. Використовуйте позитивне число." + invalid-item: "Можна жертвувати лише блоки з налаштованим значенням рівня." + empty: "Немає дійсних блоків для пожертвування." + cancelled: "Пожертвування скасовано. Предмети повернуто." + success: "Пожертвовано [number] блоків за [points] очок! Ці очки є постійними." + confirm: "Підтвердити — Предмети будуть ЗНИЩЕНІ!" + cancel: "Скасувати — Повернути предмети" + gui-title: "Пожертвувати блоки" + gui-info: "Пожертвуйте блоки своєму острову|Пожертвовано: [points] очок|Увага: пожертвувані предмети|знищуються і не можуть бути повернуті!" + preview: "Очок буде додано: [points]|Ці предмети будуть знищені!" hand: - success: "Donated [number] x [material] for [points] permanent points!" - not-block: "You must be holding a placeable block to donate." - confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." + keyword: "рука" + success: "Пожертвовано [number] x [material] за [points] постійних очок!" + not-block: "Ви повинні тримати блок, який можна розмістити." + confirm-prompt: "Буде ЗНИЩЕНО [number] x [material] за [points] постійних очок." top: description: показати першу десятку gui-title: "& Десятка Кращих" @@ -92,9 +94,8 @@ protection: level: commands: value: - parameters: "[hand|]" - description: показує значення блоків. Додайте 'hand' в кінці, щоб відобразити - значення предмета в руках. + parameters: "[рука|<матеріал>]" + description: показує значення блоків. Додайте 'рука' в кінці, щоб відобразити значення предмета в руках. gui: titles: top: " Топ островів" diff --git a/src/main/resources/locales/vi.yml b/src/main/resources/locales/vi.yml index 2c0451e..6d27ce2 100644 --- a/src/main/resources/locales/vi.yml +++ b/src/main/resources/locales/vi.yml @@ -57,6 +57,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "Chỉ có thể quyên góp các khối có giá trị cấp độ được cấu hình." empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -66,6 +67,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "tay" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/main/resources/locales/zh-CN.yml b/src/main/resources/locales/zh-CN.yml index 522a0ed..1901208 100644 --- a/src/main/resources/locales/zh-CN.yml +++ b/src/main/resources/locales/zh-CN.yml @@ -49,6 +49,7 @@ island: no-permission: "You do not have permission to donate blocks on this island." no-value: "That block has no level value." invalid-amount: "Invalid amount. Use a positive number." + invalid-item: "只能捐赠具有配置等级值的方块。" empty: "There are no valid blocks to donate." cancelled: "Donation cancelled. Items returned." success: "Donated [number] blocks for [points] points! These points are permanent." @@ -58,6 +59,7 @@ island: gui-info: "Donate blocks to your island|Currently donated: [points] points|Warning: donated items are|destroyed and cannot be returned!" preview: "Points to add: [points]|These items will be destroyed!" hand: + keyword: "hand" success: "Donated [number] x [material] for [points] permanent points!" not-block: "You must be holding a placeable block to donate." confirm-prompt: "About to DESTROY [number] x [material] for [points] permanent points." diff --git a/src/test/java/world/bentobox/level/commands/IslandDonateCommandTest.java b/src/test/java/world/bentobox/level/commands/IslandDonateCommandTest.java index e7f63fc..bb1f195 100644 --- a/src/test/java/world/bentobox/level/commands/IslandDonateCommandTest.java +++ b/src/test/java/world/bentobox/level/commands/IslandDonateCommandTest.java @@ -64,6 +64,7 @@ public void setUp() throws Exception { when(user.getTranslation(anyString())).thenAnswer(i -> i.getArgument(0, String.class)); when(user.getTranslation(anyString(), anyString(), anyString())).thenAnswer(i -> i.getArgument(0, String.class)); when(user.getTranslation(anyString(), anyString(), anyString(), anyString(), anyString())).thenAnswer(i -> i.getArgument(0, String.class)); + when(user.getTranslation("island.donate.hand.keyword")).thenReturn("hand"); when(user.getLocation()).thenReturn(location); when(player.getInventory()).thenReturn(inventory); diff --git a/src/test/java/world/bentobox/level/commands/IslandValueCommandTest.java b/src/test/java/world/bentobox/level/commands/IslandValueCommandTest.java index 3c8b4fa..a693cb1 100644 --- a/src/test/java/world/bentobox/level/commands/IslandValueCommandTest.java +++ b/src/test/java/world/bentobox/level/commands/IslandValueCommandTest.java @@ -7,6 +7,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -68,6 +69,7 @@ public void setUp() throws Exception { when(user.getTranslation(anyString())).thenAnswer(i -> i.getArgument(0, String.class)); when(user.getTranslation(anyString(), anyString(), anyString())).thenAnswer(i -> i.getArgument(0, String.class)); when(user.getTranslation(anyString(), anyString(), anyString(), anyString(), anyString())).thenAnswer(i -> i.getArgument(0, String.class)); + when(user.getTranslation("island.donate.hand.keyword")).thenReturn("hand"); when(user.getTranslationOrNothing(anyString())).thenReturn(""); when(player.getInventory()).thenReturn(inventory); @@ -109,7 +111,7 @@ public void testExecuteTooManyArgsShowsHelp() { public void testExecuteUnknownMaterial() { assertTrue(cmd.execute(user, "value", List.of("NOTAMATERIAL"))); // Sends unknown-item message via Utils.sendMessage - verify(user).getTranslation(anyString()); // translation called for unknown item message + verify(user, times(2)).getTranslation(anyString()); // keyword lookup + unknown item message } @Test