[SPIGOT-2304] Add LootGenerateEvent Created: 22/May/16 Updated: 30/Apr/20 Resolved: 30/Apr/20 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor |
| Reporter: | Parker Hawke | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | dungeon, event, world | ||
| Environment: |
N/A |
||
| Issue Links: |
|
||||||||
| Plugin: | N/A | ||||||||
| Description |
|
As of version 1.9, dungeon chest loot is only generated upon opening the chest. It would be quite a useful event to listen for as you would be able to modify the contents of the loot, thus allowing for the customization of dungeon loot. An alternative for this would be using an InventoryOpenEvent, but the downside is being unable to determine if it's a dungeon chest or not. Hence, the idea for this event Perhaps the event could be something like this? It may either extend a WorldEvent, PlayerEvent, or the already existing InventoryOpenEvent. I wasn't sure, but WorldEvent made the most sense to me, I think. Also, a List<ItemStack> may be more suitable, but considering most inventory contents are handled through ItemStack arrays, I thought this made more sense. public class LootGenerateEvent extends WorldEvent{ public static HandlerList handlers = new HandlerList(); private final Player player; private final Chest chest; private ItemStack[] loot; // An ArrayList may be better? public LootGenerateEvent(World world, Player player, Chest chest, ItemStack[] loot) { super(world); this.player = player; this.chest = chest; this.loot = loot; } public Chest getChest(){ return chest; } public Player getPlayer(){ return player; } public void setGeneratedLoot(ItemStack[] loot){ this.loot = loot; } public ItemStack[] getGeneratedLoot(){ return loot; } @Override public HandlerList getHandlers() { return handlers; } } |
| Comments |
| Comment by md_5 [ 13/Oct/16 ] |
|
Welcome to implement it. |
| Comment by Parker Hawke [ 13/Oct/16 ] |
|
I'd like to bring more attention to this ticket once again. I still find it to be a really useful event to be able to generate custom loot in dungeon chests |
| Comment by Parker Hawke [ 17/Jun/16 ] |
|
After thinking more into this event, I believe the name should be "PlayerLootGenerateEvent" and it should extend PlayerEvent instead. This is because it is a player that initializes the random generation of loot in the chest, so that made the most sense to me. Not sure if this is still a possibility, though feedback would be appreciated |