Repair command translations added

This commit is contained in:
Roch Blonndiaux 2023-05-30 14:36:59 +02:00
parent 516f286d66
commit ee6f79ac51
16 changed files with 60 additions and 28 deletions

View File

@ -76,6 +76,12 @@ public enum Message {
STATION_BIG_STACK("Amount Crafted: #size#"),
RECIPE_PREVIEW("Recipe Preview"),
UNABLE_TO_REPAIR("This item can't be repaired by this consumable!"),
// Commands
REPAIR_COMMAND_UNREPAIRABLE("The item you are holding can't be repaired.", "repair-command-unrepairable"),
REPAIR_COMMAND_SUCCESS("Successfully repaired the item you are holding.", "repair-command-success"),
;
private final String defaultMessage, path, actionBarConfigPath;

View File

@ -1,41 +1,40 @@
package net.Indyuce.mmoitems.command.mmoitems.item;
import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.command.api.CommandTreeNode;
import net.Indyuce.mmoitems.api.interaction.util.DurabilityItem;
import net.Indyuce.mmoitems.api.util.message.Message;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.interaction.util.DurabilityItem;
import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.command.api.CommandTreeNode;
public class RepairCommandTreeNode extends CommandTreeNode {
public RepairCommandTreeNode(CommandTreeNode parent) {
super(parent, "repair");
}
public RepairCommandTreeNode(CommandTreeNode parent) {
super(parent, "repair");
}
@Override
public CommandResult execute(CommandSender sender, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "This command is only for players.");
return CommandResult.FAILURE;
}
@Override
public CommandResult execute(CommandSender sender, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "This command is only for players.");
return CommandResult.FAILURE;
}
Player player = (Player) sender;
ItemStack stack = player.getInventory().getItemInMainHand();
NBTItem item = MythicLib.plugin.getVersion().getWrapper().getNBTItem(stack);
Player player = (Player) sender;
ItemStack stack = player.getInventory().getItemInMainHand();
NBTItem item = MythicLib.plugin.getVersion().getWrapper().getNBTItem(stack);
if (!item.hasTag("MMOITEMS_DURABILITY")) {
sender.sendMessage(MMOItems.plugin.getPrefix() + "The item you are holding can't be repaired.");
return CommandResult.FAILURE;
}
if (!item.hasTag("MMOITEMS_DURABILITY")) {
Message.REPAIR_COMMAND_UNREPAIRABLE.format(ChatColor.RED).send(player);
return CommandResult.FAILURE;
}
DurabilityItem durItem = new DurabilityItem(player, stack);
player.getInventory().setItemInMainHand(durItem.addDurability(durItem.getMaxDurability()).toItem());
DurabilityItem durItem = new DurabilityItem(player, stack);
player.getInventory().setItemInMainHand(durItem.addDurability(durItem.getMaxDurability()).toItem());
sender.sendMessage(MMOItems.plugin.getPrefix() + "Successfully repaired the item you are holding.");
return CommandResult.SUCCESS;
}
Message.REPAIR_COMMAND_SUCCESS.format(ChatColor.GREEN).send(player);
return CommandResult.SUCCESS;
}
}

View File

@ -51,3 +51,5 @@ crafting-queue-full: '合成队列已满.'
station-big-stack: '合成数量: #size#'
recipe-preview: '配方预览'
unable-to-repair: '这个物品不能被这个消耗品修复!'
repair-command-unrepairable: '你持有的物品无法修复。'
repair-command-success: '成功修复了你持有的物品。'

View File

@ -51,3 +51,5 @@ crafting-queue-full: '合成佇列已滿.'
station-big-stack: '製作數量: #size#'
recipe-preview: '配方預覽'
unable-to-repair: '此消耗品無法修復此物品!'
repair-command-unrepairable: '你持有的物品無法修復。'
repair-command-success: '成功修復了你持有的物品。'

View File

@ -51,3 +51,5 @@ crafting-queue-full: 'The crafting queue is currently full.'
station-big-stack: 'Amount Crafted: #size#'
recipe-preview: 'Recipe Preview'
unable-to-repair: 'This item can''t be repaired by this consumable!'
repair-command-unrepairable: 'The item you are holding can''t be repaired.'
repair-command-success: 'Successfully repaired the item you are holding.'

View File

@ -51,3 +51,5 @@ crafting-queue-full: 'La file d''artisanat est pleine.'
station-big-stack: 'Quantité fabriquée : #size#'
recipe-preview: 'Aperçu de la recette'
unable-to-repair: 'Cet objet ne peut pas être réparé par ce consommable!'
repair-command-unrepairable: 'L''objet que vous tenez ne peut pas être réparé.'
repair-command-success: 'Réparation réussie de l''objet que vous tenez.'

View File

@ -51,3 +51,5 @@ crafting-queue-full: 'The crafting queue is currently full.'
station-big-stack: 'Amount Crafted: #size#'
recipe-preview: 'Recipe Preview'
unable-to-repair: 'This item can''t be repaired by this consumable!'
repair-command-unrepairable: 'The item you are holding can''t be repaired.'
repair-command-success: 'Successfully repaired the item you are holding.'

View File

@ -50,4 +50,5 @@ crafting-canceled: 'You cancelled a crafting recipe.'
crafting-queue-full: 'The crafting queue is currently full.'
station-big-stack: 'Amount Crafted: #size#'
recipe-preview: 'Recipe Preview'
unable-to-repair: 'This item can''t be repaired by this consumable!'
repair-command-unrepairable: 'The item you are holding can''t be repaired.'
repair-command-success: 'Successfully repaired the item you are holding.'

View File

@ -51,3 +51,5 @@ crafting-queue-full: 'The crafting queue is currently full.'
station-big-stack: 'Amount Crafted: #size#'
recipe-preview: 'Recipe Preview'
unable-to-repair: 'This item can''t be repaired by this consumable!'
repair-command-unrepairable: 'The item you are holding can''t be repaired.'
repair-command-success: 'Successfully repaired the item you are holding.'

View File

@ -51,3 +51,5 @@ crafting-queue-full: 'Kolejka wytwarzania jest obecnie pełna.'
station-big-stack: 'Wytworzona ilość: #size#'
recipe-preview: 'Podgląd przepisu'
unable-to-repair: 'Ten przedmiot nie może zostać naprawiony przez ten materiał!'
repair-command-unrepairable: 'Przedmiotu, który trzymasz''nie można naprawić.'
repair-command-success: 'Pomyślnie naprawiono przedmiot, który trzymasz.'

View File

@ -51,3 +51,5 @@ crafting-queue-full: 'The crafting queue is currently full.'
station-big-stack: 'Amount Crafted: #size#'
recipe-preview: 'Recipe Preview'
unable-to-repair: 'This item can''t be repaired by this consumable!'
repair-command-unrepairable: 'Предмет, который вы держите, не может быть отремонтирован.'
repair-command-success: 'Успешно отремонтирован предмет, который вы держите.'

View File

@ -51,3 +51,5 @@ crafting-queue-full: 'La cola de elaboración está actualmente llena.'
station-big-stack: 'Cantidad elaborada: #size#'
recipe-preview: 'Vista previa de la receta'
unable-to-repair: '¡Este item no puede ser reparado por este consumible!'
repair-command-unrepairable: 'El objeto que tienes no puede repararse.'
repair-command-success: 'Se reparó con éxito el objeto que tienes en la mano.'

View File

@ -51,3 +51,5 @@ crafting-queue-full: 'The crafting queue is currently full.'
station-big-stack: 'Amount Crafted: #size#'
recipe-preview: 'Recipe Preview'
unable-to-repair: 'This item can''t be repaired by this consumable!'
repair-command-unrepairable: 'รายการที่คุณถืออยู่ไม่สามารถซ่อมแซมได้'
repair-command-success: 'ซ่อมแซมรายการที่คุณถืออยู่สำเร็จแล้ว'

View File

@ -51,3 +51,5 @@ crafting-queue-full: 'Üretim sırası şu an dolu.'
station-big-stack: 'Üretilen Miktar: #size#'
recipe-preview: 'Tarif Önizlemesi'
unable-to-repair: 'Bu eşyayı bununla tamir edemezsiniz!'
repair-command-unrepairable: 'Tuttuğunuz öğe tamir edilemez.'
repair-command-success: 'Tuttuğunuz öğe başarıyla onarıldı.'

View File

@ -51,3 +51,5 @@ crafting-queue-full: 'Hàng đợi chế tạo hiện đã đầy.'
station-big-stack: 'Số lượng Crafted: #size#'
recipe-preview: 'Xem trước công thức'
unable-to-repair: 'Vật phẩm này không thể được sửa chữa bằng vật phẩm này!'
repair-command-unrepairable: 'Không thể sửa chữa vật phẩm bạn đang giữ.'
repair-command-success: 'Sửa chữa thành công vật phẩm bạn đang giữ.'

View File

@ -51,3 +51,5 @@ crafting-queue-full: 'The crafting queue is currently full.'
station-big-stack: 'Amount Crafted: #size#'
recipe-preview: 'Recipe Preview'
unable-to-repair: 'This item can''t be repaired by this consumable!'
repair-command-unrepairable: 'The item you are holding can''t be repaired.'
repair-command-success: 'Successfully repaired the item you are holding.'