[SPIGOT-2702] PrepareAnvilEvent fires 3 times Created: 27/Sep/16 Updated: 27/Dec/20 Resolved: 01/Oct/16 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | BillyGalbreath | Assignee: | Unassigned |
Resolution: | Won't Fix | Votes: | 1 |
Labels: | None |
Issue Links: |
|
Description |
As title states, the PrepareAnvilEvent fires 3 times. I asked in IRC if this is a known thing, and no one seemed to know, so I'm chalking this up as a bug. This can be recreated with a simple event that outputs to console and simply place items into and put items out of an anvil inventory: @EventHandler public void onPrepareAnvil(PrepareAnvilEvent event) { System.out.println("Test"); } |
Comments |
Comment by Black Hole [ 11/Dec/19 ] |
As a workaround you could store if such event was called for a particular inventory and schedule a one time handling for the next tick. |
Comment by Reg [ 11/Dec/19 ] |
It now fires 5 times. I appreciate the comment that it would be a lot of work to fix this but my plugin just broke because I had hardcoded it to handle three calls from each PrepareAnvilEvent and now, all of a sudden it's getting five calls. What makes this particularly awkward is that I can no longer trust the fact that the number of calls will be consistent across (even minor) versions. |
Comment by md_5 [ 01/Oct/16 ] |
This is because the update routine is indeed run 3 times. It can't really be fixed without rewriting inventories. |