mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Herbalism compatibility with PlayerAnimationEvent
This change in theory should make McMMO herbalism compatible with plugins that utilise PlayerAnimationEvent. The main reason that I want to add this is to fix `no swing` false positives in `AAC` (though didn't get to test this).
I would appreciate if someone could test this PR and verify that its working without any issues. (I am busy for the next few days so I haven't been able to test it. In theory it looks like it should work. I could have checked if the event `isCancelled()` however, this doesn't seem necessary quite yet. Though, if it is needed I can add it 👍
Please don't merge this unless it's confirmed completely working. I will find some time to test it out within the next few days.
This commit is contained in:
parent
c0a3d63213
commit
93fefa031b
@ -656,16 +656,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