-
-
Notifications
You must be signed in to change notification settings - Fork 414
Add first empty slot in inventory expression #7914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add first empty slot in inventory expression #7914
Conversation
Co-authored-by: Patrick Miller <apickledwalrus@gmail.com>
|
Is the optional [s] there on purpose? I mean, it always returns the first empty slot anyway |
it's because the pattern supports multiple inventories |
Yeah silly me didn't notice the plural |
Problem
There was no easy way to detect the first empty slot in an inventory without looping over all the slots manually. Bukkit provides a easy
firstEmpty()expression that avoids this nonsense, so there was room for improvement.Solution
Adds an expression that uses firstEmpty() to get the first empty slot in an inventory.
[the] first empty slot in %inventories%, along with the typical property expression patterns.Testing Completed
ExprFirstEmptySlot.sktests basic inventory behavior, some manual testing was done to confirm it doesn't return armor slots for players.Supporting Information
Completes: none
Related: none