Skip to content

Commit 583f282

Browse files
committed
Cache script variable outside loop
1 parent 6595aff commit 583f282

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/java/org/skriptlang/reflect/syntax/custom/shared/entry/UsableInEntryData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public UsableInEntryData(String key, @Nullable Predicate<ParserInstance> default
3131
@Override
3232
public Predicate<ParserInstance> getValue(Node node) {
3333
Predicate<ParserInstance> cumulativePredicate = parser -> false;
34+
Script script = ParserInstance.get().getCurrentScript();
3435
for (Node subNode : node) {
3536
if (subNode instanceof SectionNode) {
3637
Skript.error("Cannot use a section here.");
@@ -48,7 +49,6 @@ public Predicate<ParserInstance> getValue(Node node) {
4849
cumulativePredicate = cumulativePredicate.or(parser -> CustomEventManager.isCurrentEvent(parser, identifier));
4950
continue;
5051
}
51-
Script script = ParserInstance.get().getCurrentScript();
5252
JavaType javaType = StructImport.lookup(script, eventName);
5353
if (javaType == null) {
5454
Skript.error("Cannot understand class '" + eventName + "'. Make sure to import it first.");

0 commit comments

Comments
 (0)