mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Merge pull request #3788 from LogGits/patch-5
Herbalism compatibility with PlayerAnimationEvent
This commit is contained in:
commit
307b807b38
@ -29,6 +29,8 @@ import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@ -757,16 +759,17 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
FakePlayerAnimationEvent fakeSwing = new FakePlayerAnimationEvent(event.getPlayer()); //PlayerAnimationEvent compat
|
||||
if (herbalismManager.canGreenThumbBlock(blockState)) {
|
||||
Bukkit.getPluginManager().callEvent(fakeSwing);
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.WHEAT_SEEDS, heldItem.getAmount() - 1));
|
||||
|
||||
if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
||||
blockState.update(true);
|
||||
}
|
||||
}
|
||||
|
||||
/* SHROOM THUMB CHECK */
|
||||
else if (herbalismManager.canUseShroomThumb(blockState)) {
|
||||
Bukkit.getPluginManager().callEvent(fakeSwing);
|
||||
event.setCancelled(true);
|
||||
if (herbalismManager.processShroomThumb(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
||||
blockState.update(true);
|
||||
|
Loading…
Reference in New Issue
Block a user