mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-10-31 23:59:36 +01:00
Merge 0979af326d
into 1cac6b1165
This commit is contained in:
commit
e410adf829
@ -757,8 +757,6 @@ public class HerbalismManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
//If the ageable is NOT mature and the player is NOT using a hoe, abort
|
||||
|
||||
Player player = getPlayer();
|
||||
PlayerInventory playerInventory = player.getInventory();
|
||||
Material seed;
|
||||
@ -767,27 +765,21 @@ public class HerbalismManager extends SkillManager {
|
||||
case "carrots":
|
||||
seed = Material.matchMaterial("CARROT");
|
||||
break;
|
||||
|
||||
case "wheat":
|
||||
seed = Material.matchMaterial("WHEAT_SEEDS");
|
||||
break;
|
||||
|
||||
case "nether_wart":
|
||||
seed = Material.getMaterial("NETHER_WART");
|
||||
seed = Material.matchMaterial("NETHER_WART");
|
||||
break;
|
||||
|
||||
case "potatoes":
|
||||
seed = Material.matchMaterial("POTATO");
|
||||
break;
|
||||
|
||||
case "beetroots":
|
||||
seed = Material.matchMaterial("BEETROOT_SEEDS");
|
||||
break;
|
||||
|
||||
case "cocoa":
|
||||
seed = Material.matchMaterial("COCOA_BEANS");
|
||||
break;
|
||||
|
||||
case "torchflower":
|
||||
seed = Material.matchMaterial("TORCHFLOWER_SEEDS");
|
||||
break;
|
||||
@ -795,7 +787,6 @@ public class HerbalismManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
ItemStack seedStack = new ItemStack(seed);
|
||||
|
||||
if (ItemUtils.isAxe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand())
|
||||
@ -807,7 +798,8 @@ public class HerbalismManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!playerInventory.containsAtLeast(seedStack, 1)) {
|
||||
if (!playerInventory.contains(seedStack)) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Skills.NeedMore", StringUtils.getPrettyItemString(seed));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -815,12 +807,13 @@ public class HerbalismManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, blockState.getBlock()).isCancelled()) {
|
||||
if (EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, blockState.getBlock()).isCancelled()) {
|
||||
return false;
|
||||
} else {
|
||||
playerInventory.removeItem(seedStack);
|
||||
player.updateInventory(); // Needed until replacement available
|
||||
//Play sound
|
||||
playerInventory.removeItem(new ItemStack(seed, 1));
|
||||
|
||||
player.updateInventory();
|
||||
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_CONSUMED);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user