mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Check durability before repairMaterial
This commit is contained in:
parent
063169328f
commit
ae6c479b30
@ -91,6 +91,14 @@ public class RepairManager extends SkillManager {
|
|||||||
byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
|
byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
|
||||||
ItemStack toRemove = new MaterialData(repairMaterial, repairMaterialMetadata).toItemStack(1);
|
ItemStack toRemove = new MaterialData(repairMaterial, repairMaterialMetadata).toItemStack(1);
|
||||||
|
|
||||||
|
short startDurability = item.getDurability();
|
||||||
|
|
||||||
|
// Do not repair if at full durability
|
||||||
|
if (startDurability <= 0) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if they have the proper material to repair with
|
// Check if they have the proper material to repair with
|
||||||
if (!inventory.contains(repairMaterial)) {
|
if (!inventory.contains(repairMaterial)) {
|
||||||
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial));
|
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial));
|
||||||
@ -103,14 +111,6 @@ public class RepairManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
short startDurability = item.getDurability();
|
|
||||||
|
|
||||||
// Do not repair if at full durability
|
|
||||||
if (startDurability <= 0) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not repair stacked items
|
// Do not repair stacked items
|
||||||
if (item.getAmount() != 1) {
|
if (item.getAmount() != 1) {
|
||||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.StackedItems"));
|
player.sendMessage(LocaleLoader.getString("Repair.Skills.StackedItems"));
|
||||||
|
Loading…
Reference in New Issue
Block a user