mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-11 18:02:04 +01:00
Merge branch 'master' of github.com:khobbits/Essentials
This commit is contained in:
commit
5a1ea77019
@ -45,22 +45,23 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
String itemName = item.getType().toString().toLowerCase().replace('_', ' ');
|
String itemName = item.getType().toString().toLowerCase().replace('_', ' ');
|
||||||
|
charge(user);
|
||||||
user.sendMessage(Util.format("repair", itemName));
|
user.sendMessage(Util.format("repair", itemName));
|
||||||
}
|
}
|
||||||
else if (args[0].equalsIgnoreCase("all"))
|
else if (args[0].equalsIgnoreCase("all"))
|
||||||
{
|
{
|
||||||
StringBuilder itemList = new StringBuilder();
|
StringBuilder itemList = new StringBuilder();
|
||||||
itemList.append(repairItems(user.getInventory().getContents()));
|
itemList.append(repairItems(user.getInventory().getContents()));
|
||||||
|
|
||||||
String armor = repairItems(user.getInventory().getArmorContents());
|
String armor = repairItems(user.getInventory().getArmorContents());
|
||||||
|
|
||||||
if(armor.length() > 0)
|
if (armor.length() > 0)
|
||||||
{
|
{
|
||||||
if(itemList.length() > 0)
|
if (itemList.length() > 0)
|
||||||
{
|
{
|
||||||
itemList.append(", ");
|
itemList.append(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
itemList.append(armor);
|
itemList.append(armor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
charge(user);
|
||||||
user.sendMessage(Util.format("repair", itemList.toString()));
|
user.sendMessage(Util.format("repair", itemList.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,15 +90,15 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("repairInvalidType"));
|
throw new Exception(Util.i18n("repairInvalidType"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getDurability() == 0)
|
if (item.getDurability() == 0)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("repairAlreadyFixed"));
|
throw new Exception(Util.i18n("repairAlreadyFixed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
item.setDurability((short)0);
|
item.setDurability((short)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String repairItems(ItemStack[] items)
|
private String repairItems(ItemStack[] items)
|
||||||
{
|
{
|
||||||
StringBuilder itemList = new StringBuilder();
|
StringBuilder itemList = new StringBuilder();
|
||||||
|
Loading…
Reference in New Issue
Block a user