mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
changes the dev asked for
This commit is contained in:
parent
b34e658a69
commit
0979af326d
@ -798,8 +798,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for seeds in both the main hand and off-hand
|
if (!playerInventory.contains(seedStack)) {
|
||||||
if (!(playerInventory.containsAtLeast(seedStack, 1) || playerInventory.getItemInOffHand().getType() == seed)) {
|
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Skills.NeedMore", StringUtils.getPrettyItemString(seed));
|
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Skills.NeedMore", StringUtils.getPrettyItemString(seed));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -808,20 +807,13 @@ public class HerbalismManager extends SkillManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the SubSkillEvent before removing items
|
|
||||||
if (EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, blockState.getBlock()).isCancelled()) {
|
if (EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, blockState.getBlock()).isCancelled()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// Remove seed from the appropriate inventory slot (main hand or off-hand)
|
playerInventory.removeItem(new ItemStack(seed, 1));
|
||||||
if (playerInventory.getItemInMainHand().getType() == seed) {
|
|
||||||
playerInventory.removeItem(new ItemStack(seed, 1));
|
|
||||||
} else if (playerInventory.getItemInOffHand().getType() == seed) {
|
|
||||||
playerInventory.getItemInOffHand().setAmount(playerInventory.getItemInOffHand().getAmount() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.updateInventory(); // Needed until replacement available
|
player.updateInventory();
|
||||||
|
|
||||||
// Play sound
|
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_CONSUMED);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_CONSUMED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user