diff options
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandrepair.java')
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandrepair.java | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java index d6bcad464..50c6ac7af 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java @@ -1,12 +1,10 @@ package com.earth2me.essentials.commands; -import com.earth2me.essentials.ChargeException; -import com.earth2me.essentials.IUser; -import com.earth2me.essentials.Trade; -import com.earth2me.essentials.User; -import com.earth2me.essentials.Util; +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.*; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.inventory.ItemStack; @@ -32,9 +30,9 @@ public class Commandrepair extends EssentialsCommand final ItemStack item = user.getItemInHand(); if (item == null) { - throw new Exception(Util.i18n("repairInvalidType")); + throw new Exception(_("repairInvalidType")); } - final String itemName = item.getType().toString().toLowerCase(); + final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH); final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess); charge.isAffordableFor(user); @@ -43,22 +41,25 @@ public class Commandrepair extends EssentialsCommand charge.charge(user); - user.sendMessage(Util.format("repair", itemName.replace('_', ' '))); + user.sendMessage(_("repair", itemName.replace('_', ' '))); } else if (args[0].equalsIgnoreCase("all")) { final List<String> repaired = new ArrayList<String>(); repairItems(user.getInventory().getContents(), user, repaired); - repairItems(user.getInventory().getArmorContents(), user, repaired); + if (user.isAuthorized("essentials.repair.armor")) + { + repairItems(user.getInventory().getArmorContents(), user, repaired); + } if (repaired.isEmpty()) { - throw new Exception(Util.format("repairNone")); + throw new Exception(_("repairNone")); } else { - user.sendMessage(Util.format("repair", Util.joinList(repaired))); + user.sendMessage(_("repair", Util.joinList(repaired))); } } @@ -73,12 +74,12 @@ public class Commandrepair extends EssentialsCommand final Material material = Material.getMaterial(item.getTypeId()); if (material.isBlock() || material.getMaxDurability() < 0) { - throw new Exception(Util.i18n("repairInvalidType")); + throw new Exception(_("repairInvalidType")); } if (item.getDurability() == 0) { - throw new Exception(Util.i18n("repairAlreadyFixed")); + throw new Exception(_("repairAlreadyFixed")); } item.setDurability((short)0); @@ -92,7 +93,7 @@ public class Commandrepair extends EssentialsCommand { continue; } - final String itemName = item.getType().toString().toLowerCase(); + final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH); final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess); try { |