Skip to content

Commit f27cdeb

Browse files
committed
allow empty data arrays in SimpleLiteral
1 parent 699cf5a commit f27cdeb

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/main/java/ch/njol/skript/lang/util/SimpleLiteral.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,17 @@ public class SimpleLiteral<T> implements Literal<T>, DefaultExpression<T> {
3636

3737
private @Nullable Expression<?> source = null;
3838

39+
/**
40+
* The data of the literal. May not be null or contain null, but may be empty.
41+
*/
3942
protected transient T[] data;
4043

4144
public SimpleLiteral(T[] data, Class<T> type, boolean and) {
4245
assert data != null;
4346
assert type != null;
4447
this.data = data;
4548
this.type = type;
46-
this.and = data.length == 1 || and;
49+
this.and = data.length <= 1 || and;
4750
this.isDefault = false;
4851
}
4952

@@ -142,7 +145,7 @@ public String toString() {
142145

143146
@Override
144147
public boolean isSingle() {
145-
return !getAnd() || data.length == 1;
148+
return !getAnd() || data.length <= 1;
146149
}
147150

148151
@Override

0 commit comments

Comments
 (0)