[SPIGOT-5313] Dispenser API additions Created: 08/Sep/19 Updated: 06/Mar/20 |
|
| Status: | Open |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor |
| Reporter: | blablubbabc | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | None | ||
| Version: | This server is running CraftBukkit version git-Spigot-065a373-7ef2b20 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT) |
| Guidelines Read: | Yes |
| Description |
|
I would find it useful to be able to:
I will prepare a PR for these. |
| Comments |
| Comment by Loggits [ 06/Mar/20 ] |
|
Thats actually a great idea |
| Comment by Black Hole [ 06/Mar/20 ] |
|
Alternatively the event could also expose the slot number. |
| Comment by Loggits [ 06/Mar/20 ] |
|
This is exactly what I need for a side project. Also I'm trying to change shulker behaviour and have it spawn a custom shulker and remove the item from the dispenser. Do you think you could add something like a .getVoidDispense() and .setVoidDispense(true) which cancel the event but still removes the item (so nothing comes out but the item gets removed from the dispenser/dropper inventory). The reason I propose this is because of itemstack comparison issues with shulkerboxes/books/potions etc. Great addition, keep up the great work |
| Comment by YourCoal [ 09/Sep/19 ] |
|
Just cancel the BlockDispenseEvent |
| Comment by blablubbabc [ 08/Sep/19 ] |
|
Yes, my usecase is to disable the special dispense behavior of specific items and make them behave (drop) like regular items when used from a dispenser. For example, I have a plugin which gives players mob spawn eggs (with specific name and lore) which they can use to place shop NPCs. But players should not be able to spawn regular mobs with these special spawn eggs. When these items get dispensed from a dispenser, it spawns the corresponding mob. I want to disable that. But instead of disabling dispensers altogether for these items, I want them to simply drop instead (just like regular items, which don't have a special dispense behavior either). The workaround would be to copy the underlying minecraft code to replicate the behavior as closely as possible. With the proposed changes plugins can instead simply toggle inside the dispense event whether the item's default dispense behavior should be used, or whether the item should behave like a regular item instead (i.e. drop). |
| Comment by YourCoal [ 08/Sep/19 ] |
|
"make a dispenser drop a specific item, instead of using the item's default dispense behavior" so.... Droppers? |
| Comment by blablubbabc [ 08/Sep/19 ] |
|
Bukkit PR: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/456/ CB PR: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/595/ |