erikzimmermann / TradeSystem

A highly customizable, free and open-source Minecraft plugin for trading between players.
https://www.spigotmc.org/resources/trade-system-custom-layouts.58434/
MIT License
82 stars 48 forks source link

Incompatibility with certain plugins #455

Closed BenceX100 closed 1 year ago

BenceX100 commented 1 year ago

Describe the bug If a trade gets cancelled, tradesystem closes your inventory, however if the trade got cancelled because opening another gui then it could cause issues (for example in the KingdomsX plugin it let's you take items from the menus, althrough this requires a mod to execute a command while trading)

To Reproduce Steps to reproduce the behavior:

  1. Start a trade
  2. Open another menu with a macro (for example I ran /k gui ranks/ranks which opens a KingdomsX menu)
  3. The trade got cancelled, and the menu I opened with the macro is still open.
  4. You can take items from the menu (it depends on the plugin)

Expected behavior The inventory should close properly when cancelling a trade.

Screenshots Here is a video: https://imgur.com/a/PGHYdJg

Additional context Running this with a 0 tick scheduler fixes the issue: https://github.com/erikzimmermann/TradeSystem/blob/main/TradeSystem-Spigot/src/main/java/de/codingair/tradesystem/spigot/trade/Trade.java#L1133 I think this happens because the inv open and close event gets called the same tick and the other plugin (in this case KingdomsX) thinks that the player closed the menu, however minecraft didn't close it because it happened within the same tick, so waiting for the next tick seems to fix it

Discord contact: BenceX100