Green Thumb (Plants) now fires a SubSkillBlockEvent

This commit is contained in:
nossr50 2021-02-03 15:08:21 -08:00
parent 1c1abe9a2a
commit 369b34406e
2 changed files with 12 additions and 5 deletions

View File

@ -5,9 +5,11 @@ Version 2.1.174
Updated fr locale (thanks Elikill58) Updated fr locale (thanks Elikill58)
(API) Added SubSkillBlockEvent for some SubSkill events that have a block (eg: Green Thumb Block events) (API) Added SubSkillBlockEvent for some SubSkill events that have a block (eg: Green Thumb Block events)
(API) Green Thumb (Block) now fires a SubSkillBlockEvent which is cancellable (API) Green Thumb (Block) now fires a SubSkillBlockEvent which is cancellable
(API) Green Thumb (Plant) now fires SubSkillBlockEvent which is cancellable
(API) Shroom Thumb now fires a SubSkillBlockEvent which is cancellable (API) Shroom Thumb now fires a SubSkillBlockEvent which is cancellable
NOTE: A lot of sub-skills without random chance elements are missing events, this will be cleaned up in the near future. If you need something specific added sooner than that, post a GitHub issue for it and I'll patch it in. NOTE: A lot of sub-skills without random chance elements are missing events, this will be cleaned up in the near future. If you need something specific added sooner than that, post a GitHub issue for it and I'll patch it in.
I'm likely to separate Green Thumb into two distinct skills in an upcoming patch
Version 2.1.173 Version 2.1.173
The experience orbs dropped by Knock on Wood rank 2 during Tree Feller are now much less frequent but provide more XP The experience orbs dropped by Knock on Wood rank 2 during Tree Feller are now much less frequent but provide more XP

View File

@ -754,11 +754,16 @@ public class HerbalismManager extends SkillManager {
return false; return false;
} }
if(EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, blockState.getBlock()).isCancelled()) {
return false;
} else {
playerInventory.removeItem(seedStack); playerInventory.removeItem(seedStack);
player.updateInventory(); // Needed until replacement available player.updateInventory(); // Needed until replacement available
//Play sound //Play sound
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_CONSUMED); SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_CONSUMED);
return true; return true;
}
// new HerbalismBlockUpdaterTask(blockState).runTaskLater(mcMMO.p, 0); // new HerbalismBlockUpdaterTask(blockState).runTaskLater(mcMMO.p, 0);
} }