prevent shop creation item regular usage doesn't work
blablubbabcDEV opened this issue ยท 4 comments
Migrated from: https://dev.bukkit.org/projects/shopkeepers/issues/212
Originally posted by Intangir (Jan 17, 2014):
What steps will reproduce the problem?
- prevent-shop-creation-item-regular-usage
- set creation item to villager egg
- use villager egg on groundWhat is the expected output? What do you see instead?
it should tell you to select a chest firstWhat version of the product are you using?
latest 1.7.2 betaDo you have an error log of what happened?
no, but i even added a debug message in my own build and the code IS being run to event.setUseItemInHand(Result.DENY);
but it spawns the villager anywayPlease provide any additional information below.
i tried it with multiple versions of bukkit problem persists
Originally commented by blablubbabc (Jan 17, 2014):
I am able to reproduce this.
I would have thought event.setUseItemInHand(Result.DENY); cancles the item usage and by that the monster spawning, sadly, after searching through the craftbukkit sources, it seems like while the item usage is cancelled (https://github.com/Bukkit/CraftBukkit/blob/378718ef2e56c541cf4b4cbff3b831ae1620190e/src/main/java/net/minecraft/server/PlayerInteractManager.java#L400) the MonsterEgg item seems to also spawn the entity inside it's "placeItem" code (trigger here: https://github.com/Bukkit/CraftBukkit/blob/378718ef2e56c541cf4b4cbff3b831ae1620190e/src/main/java/net/minecraft/server/PlayerInteractManager.java#L390 , and spawned here: https://github.com/Bukkit/CraftBukkit/blob/378718ef2e56c541cf4b4cbff3b831ae1620190e/src/main/java/net/minecraft/server/ItemMonsterEgg.java#L36)
:( So I have to cancle block usage as well (aka the whole event) for monster spawning to not be triggered.. that's not very intuitive, but well..
Originally commented by Intangir (Jan 17, 2014):
i have a fix for you if you don't get it first
basically just moved that if to the bottom of the function and changed it to set cancel instead of the set use item in hand