mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-19 08:55:26 +01:00
Fixed bug with repairing wooden tools.
This commit is contained in:
parent
a2d5b97467
commit
6fffe10c32
@ -8,7 +8,8 @@ Key:
|
|||||||
- Removal
|
- Removal
|
||||||
|
|
||||||
Version 1.3.05-dev
|
Version 1.3.05-dev
|
||||||
+
|
= Fixed bug with repairing wooden tools
|
||||||
|
! Changed Tree Feller to account for ability durability loss but not leaves.
|
||||||
|
|
||||||
Version 1.3.04
|
Version 1.3.04
|
||||||
+ Added McMMOPlayerRepairEvent for API usage - fires after completion of a repair.
|
+ Added McMMOPlayerRepairEvent for API usage - fires after completion of a repair.
|
||||||
|
@ -206,7 +206,7 @@ public class HUDmmo {
|
|||||||
*
|
*
|
||||||
* @param sPlayer Player to initialize XP bar for
|
* @param sPlayer Player to initialize XP bar for
|
||||||
*/
|
*/
|
||||||
private void initializeXpBarDisplayStandard(SpoutPlayer sPlayer) {
|
public void initializeXpBarDisplayStandard(SpoutPlayer sPlayer) {
|
||||||
if (LoadProperties.xpbar) {
|
if (LoadProperties.xpbar) {
|
||||||
xpbar = new GenericTexture();
|
xpbar = new GenericTexture();
|
||||||
|
|
||||||
|
@ -426,6 +426,7 @@ public class Repair {
|
|||||||
public static void repairItem(Player player, ItemStack item, ItemStack repairMaterial) {
|
public static void repairItem(Player player, ItemStack item, ItemStack repairMaterial) {
|
||||||
short initialDurability = item.getDurability();
|
short initialDurability = item.getDurability();
|
||||||
short newDurability = getRepairAmount(item, player);
|
short newDurability = getRepairAmount(item, player);
|
||||||
|
PlayerInventory inventory = player.getInventory();
|
||||||
|
|
||||||
McMMOPlayerRepairCheckEvent preEvent = new McMMOPlayerRepairCheckEvent(player, (short) (initialDurability - newDurability), repairMaterial, item);
|
McMMOPlayerRepairCheckEvent preEvent = new McMMOPlayerRepairCheckEvent(player, (short) (initialDurability - newDurability), repairMaterial, item);
|
||||||
Bukkit.getPluginManager().callEvent(preEvent);
|
Bukkit.getPluginManager().callEvent(preEvent);
|
||||||
@ -434,7 +435,12 @@ public class Repair {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getInventory().removeItem(repairMaterial);
|
if (repairMaterial.getType().equals(Material.WOOD)) {
|
||||||
|
removeWood(inventory);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
inventory.removeItem(repairMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
/* Handle the enchants */
|
/* Handle the enchants */
|
||||||
if (LoadProperties.mayLoseEnchants && !mcPermissions.getInstance().arcaneBypass(player)) {
|
if (LoadProperties.mayLoseEnchants && !mcPermissions.getInstance().arcaneBypass(player)) {
|
||||||
@ -472,4 +478,16 @@ public class Repair {
|
|||||||
PP.togglePlacedAnvil();
|
PP.togglePlacedAnvil();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes wood from a player's inventory on repair. Needed due to wood having multiple possible data values.
|
||||||
|
*
|
||||||
|
* @param inventory The inventory to remove wood from
|
||||||
|
*/
|
||||||
|
private static void removeWood(PlayerInventory inventory) {
|
||||||
|
//TODO: Make this less hackish once there's a better way to do it...
|
||||||
|
int slot = inventory.first(Material.WOOD);
|
||||||
|
ItemStack item = inventory.getItem(slot);
|
||||||
|
item.setAmount(item.getAmount() - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user