ObelusPA / CreativeParkour

Bukkit parkour plugin that allows all the players to play and show their skills in fun parkour maps they build or download!
https://creativeparkour.net
GNU General Public License v3.0
3 stars 9 forks source link

Able to take items from GUI menu #4

Open RoboMWM opened 7 years ago

RoboMWM commented 7 years ago

I've heard that using a custom InventoryHolder prevents issues like these.

https://i.imgur.com/5CJLqmK.gifv

I think this happened due to the inventory being closed on the client, but it didn't send an inventorycloseevent(?) Other than that guess, I don't really know.

ObelusPA commented 7 years ago

Does this always happen or only sometimes (when the server lags for example)?

RoboMWM commented 7 years ago

For me this happened when the inventory was closed due to the server sending me a resource pack (I set it to prompt). I had opened it via /cp play before it sent it, and then I reopened it afterwards - and was able to take items out at my leisure.

Very possible that either an inventorycloseevent doesn't fire(?) and/or that I'm somehow viewing a different inventory than the one you're currently watching for (if my guess is correct) and thus your plugin doesn't believe I'm interacting with your UI.

ObelusPA commented 7 years ago

Ok, I will search how to fix this. Thanks !

RoboMWM commented 6 years ago

re custom inventoryholder:

Since I've now made a couple things that interact with inventories, this is simple. Just create a new class that implements InventoryHolder, and then when creating the inventory, pass it in as the holder. Then do instanceof on the inventoryholder in the inventory events.

Since I haven't actually made a pure inventory UI, I'm not sure about all the inventory events you have to watch for (I know at least the obvious click, but there's also drag, and a couple others?). I personally prefer Book GUIs though, using this BookUtil to open the book gui.