#not detect drop
1 messages · Page 1 of 1 (latest)
?
an overly complicated and buggy way is to always dectect if there are any new dropped items, if they are near players, and if so, to treat all playerinteract events as if they mean that it was dropped
threads are easier to keep track of
than lots of replies
are we supposed to not create threads?
in my opinion
There is defo a way around it, which doesn't messy attempts. Why do you need to ignore the drops?
I'm creating an item with an ability, and I don't want the ability to trigger when/if the player drops the item
I don't think this is very efficient solution but I'm not aware of any other methods so I'll mention it.
To further elaborate on this thread, specifically the 2nd comment from aecsocket: https://www.spigotmc.org/threads/playerinteractevent-called-when-holding-q.436971/
I'd do all the above as mentioned in the thread but would also create a scheduler that would clear the map values every X ticks (preferably, every 20 ticks or so?) to avoid creating a memory leak into your plugin
NOTE Although be sure to avoid getting rid of a entry that was stored on the same tick to avoid creating a situation where the scheduler could possibly clear the entries right before the PlayerInteractEvent gets triggered, and thus ruining the point of the whole ideal
that seems like basicly what I wrote(but alot better)
I guess