DRE2N / DungeonsXL

Create custom dungeons and adventure maps with ease!
https://www.spigotmc.org/resources/dungeonsxl.9488/
GNU General Public License v3.0
152 stars 84 forks source link

Multiple issues with keepInventory rules #1040

Closed call911nowplz closed 2 years ago

call911nowplz commented 2 years ago

keepInventoryOnEnter: true causes multiple issues:

To produce this issue, join a dungeon that has both keepInventoryOnEnter: true and keepInventoryOnEscape: false, Change your armor in lobby then escape the dungeon. You will lose your armor

To produce the 2nd part of the issue, Have a golden apple as a reward in a Dungeon chest. Enter the Dungeon with golden apples. Stack the reward golden apple on-top of your golden apples and escape. You get to keep the extra golden apples without completing the dungeon.

Currently using v0.18-SNAPSHOT-1097 Spigot 1.16.5

call911nowplz commented 2 years ago

Also sometimes the KeepInventory rules are completely ignored when you die. Which makes players lose their items

advra commented 2 years ago

More so this will break with other plugins such as Magic which switch out your hotkey/inventory for a menu. If you teleport into the dungeon with a magic skill menu (or custom menu) open you lose the skill options.

Also vice versa, when exiting the dungeon with the skills/custom menu open DungeonsXL will make all custom menu items into actual items while losing your entire inventory.

Sataniel98 commented 2 years ago

More so this will break with other plugins such as Magic which switch out your hotkey/inventory for a menu. If you teleport into the dungeon with a magic skill menu or custom menu open you lose them options.

Also vice versa, when exiting the dungeon with the skills/custom menu open DungeonsXL will make all custom menu items into actual items while losing your entire inventory.

I'm afraid but I can't reasonably expect that the player inventory is used as a GUI instead of as item storage, much less deal with that case abstractly. If the player inventory is reinterpreted in such a fundamental way, it's better not to use keepInventory rules.

advra commented 2 years ago

I looked at the leave command which uses your common library wrapper. Perhaps we can assume other plugins will use the inventory generically by storing the Player's inventory in memory to avoid plugin collisions from occurring.

If I come up with something and thoroughly test it, I'll make a PR. This proposed change will only fix the plugin collision where inventory is used as GUI but I dont think this will fix OP's issue. I didnt look too much into that issue but it looks like we should cache the inventory once ReadySign button is pressed and players are teleported to StartSign.