TroDerp / EggWars

A spigot eggwars plugin by RosilloGames. Based on gaelitoelquesito's eggwars.
https://www.spigotmc.org/resources/free-eggwars-mini-game-remastered.97569/
GNU General Public License v3.0
4 stars 3 forks source link

generator inventory updates if other generator is upgraded #3

Closed MPK1 closed 1 year ago

MPK1 commented 1 year ago

Short Description

If you have an generator inventory opened and any other player upgrades any other generator, the open inventory changes to the inventory of the last updated generator.

Why does this happen

After upgrading a generator, it is stopped and started again. After starting, InventoryController.updateInventories() is called. For all players, the open inventory is updated if the following two conditions are true: First, the arena of the Generator and the player matches, second, the open inventory is of the same type.

How to fix it

Since the Generator itself is stored in the opened inventory with EwInventory.setExtraData(), the Location can be compared to only update open inventories that have the same generator location stored inside the extraData as the updated generator.