mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
Merge pull request #2810 from DorCoMaNdO/master
Fix Shroom Thumb not removing the item held.
This commit is contained in:
commit
d26779bee9
@ -566,6 +566,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
/* SHROOM THUMB CHECK */
|
/* SHROOM THUMB CHECK */
|
||||||
else if (herbalismManager.canUseShroomThumb(blockState)) {
|
else if (herbalismManager.canUseShroomThumb(blockState)) {
|
||||||
|
event.setCancelled(true);
|
||||||
if (herbalismManager.processShroomThumb(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
if (herbalismManager.processShroomThumb(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,10 @@ public class HerbalismManager extends SkillManager {
|
|||||||
|
|
||||||
public boolean canUseShroomThumb(BlockState blockState) {
|
public boolean canUseShroomThumb(BlockState blockState) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
ItemStack item = player.getInventory().getItemInMainHand();
|
PlayerInventory inventory = player.getInventory();
|
||||||
Material itemType = item.getType();
|
Material itemType = inventory.getItemInMainHand().getType();
|
||||||
|
|
||||||
return item.getAmount() > 0 && (itemType == Material.RED_MUSHROOM || itemType == Material.BROWN_MUSHROOM) && BlockUtils.canMakeShroomy(blockState) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
|
return (itemType == Material.BROWN_MUSHROOM || itemType == Material.RED_MUSHROOM) && inventory.contains(Material.BROWN_MUSHROOM, 1) && inventory.contains(Material.RED_MUSHROOM, 1) && BlockUtils.canMakeShroomy(blockState) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseHylianLuck() {
|
public boolean canUseHylianLuck() {
|
||||||
@ -272,12 +272,12 @@ public class HerbalismManager extends SkillManager {
|
|||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
PlayerInventory playerInventory = player.getInventory();
|
PlayerInventory playerInventory = player.getInventory();
|
||||||
|
|
||||||
if (!playerInventory.contains(Material.BROWN_MUSHROOM)) {
|
if (!playerInventory.contains(Material.BROWN_MUSHROOM, 1)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(Material.BROWN_MUSHROOM)));
|
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(Material.BROWN_MUSHROOM)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!playerInventory.contains(Material.RED_MUSHROOM)) {
|
if (!playerInventory.contains(Material.RED_MUSHROOM, 1)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(Material.RED_MUSHROOM)));
|
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(Material.RED_MUSHROOM)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!playerInventory.containsAtLeast(seed, 1)) {
|
if (!playerInventory.contains(seed, 1)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user