Skip to content

Commit 1f32800

Browse files
Clarify variable naming and purpose
1 parent fdb8c47 commit 1f32800

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎src/main/java/ch/njol/skript/aliases/ItemType.java‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public void setTo(ItemType i) {
211211
for (final ItemData d : i) {
212212
types.add(d.clone());
213213
}
214-
isRandom = i.isRandom;
214+
isWrappingItemStack = i.isWrappingItemStack;
215215
}
216216

217217
public ItemType(Block block) {
@@ -670,7 +670,11 @@ public ItemType clone() {
670670

671671
private final static Random random = new Random();
672672

673-
public boolean isRandom = false;
673+
/**
674+
* Represents whether this ItemType is simply wrapping an ItemStack.
675+
* That is, it has only a single data, and that data represents a random ItemStack.
676+
*/
677+
public boolean isWrappingItemStack = false;
674678

675679
/**
676680
* @return One random ItemStack that this ItemType represents. If you have a List or an Inventory, use {@link #addTo(Inventory)} or {@link #addTo(List)} respectively.
@@ -683,7 +687,7 @@ public ItemType clone() {
683687
* @see #removeFrom(List...)
684688
*/
685689
public @Nullable ItemStack getRandom() {
686-
if (isRandom) {
690+
if (isWrappingItemStack) {
687691
ItemStack stack = types.getFirst().getStack();
688692
stack.setAmount(getAmount());
689693
return stack;

‎src/main/java/org/skriptlang/skript/bukkit/types/ItemTypeClassInfo.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private static class ItemTypeParser extends Parser<ItemType> {
6767
public @Nullable ItemType parse(String s, ParseContext context) {
6868
ItemType itemType = Aliases.parseItemType(s);
6969
if (itemType != null && itemType.getTypes().size() == 1 && itemType.getTypes().getFirst().getStack() != null) {
70-
itemType.isRandom = true;
70+
itemType.isWrappingItemStack = true;
7171
}
7272
return itemType;
7373
}

0 commit comments

Comments
 (0)