Skip to content

Commit de8be6b

Browse files
committed
plural support
1 parent 95791c1 commit de8be6b

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/java/ch/njol/skript/expressions/ExprFirstEmptySlot.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public class ExprFirstEmptySlot extends SimplePropertyExpression<Inventory, Slot
1616

1717
static {
1818
// support `first empty slot in inventory` as well as typical property syntax
19-
List<String> patterns = new ArrayList<>(Arrays.asList(getPatterns("first empty slot", "inventory")));
20-
patterns.add("[the] first empty slot in %inventory%");
19+
List<String> patterns = new ArrayList<>(Arrays.asList(getPatterns("first empty slot[s]", "inventories")));
20+
patterns.add("[the] first empty slot[s] in %inventories%");
2121
Skript.registerExpression(ExprFirstEmptySlot.class, Slot.class, ExpressionType.PROPERTY, patterns.toArray(new String[0]));
2222
}
2323

src/test/skript/tests/syntaxes/expressions/ExprFirstEmptySlot.sk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ test "first empty slot":
1111
set first empty slot of {_inv} to diamond sword
1212
assert slot 2 of {_inv} is a diamond sword with "First empty slot should be set to diamond sword"
1313
assert the index of the first empty slot in {_inv} is 4 with "First empty slot in inventory should be 4"
14+
15+
set {_inv2} to a hopper inventory named "Test Hopper"
16+
set the first empty slots in {_inv2} and {_inv} to diamond sword
17+
assert slot 0 of {_inv2} is a diamond sword with "First empty slot in hopper inventory should be set to diamond sword"
18+
assert slot 4 of {_inv} is a diamond sword with "First empty slot in chest inventory should be set to diamond sword"

0 commit comments

Comments
 (0)