Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sovdee.oopsk.elements.structures;

import ch.njol.skript.ScriptLoader;
import ch.njol.skript.Skript;
import ch.njol.skript.classes.ClassInfo;
import ch.njol.skript.config.Node;
Expand Down Expand Up @@ -121,7 +122,7 @@ private List<Field<?>> getFields(@NotNull SectionNode node) {
for (Node child : node) {
if (child instanceof SimpleNode simpleNode) {
// match the field pattern
String key = simpleNode.getKey();
String key = ScriptLoader.replaceOptions(simpleNode.getKey());
Matcher matcher;
if (key == null || !(matcher = fieldPattern.matcher(key)).matches()) {
Skript.error("invalid field: " + key);
Expand Down
5 changes: 5 additions & 0 deletions src/test/scripts/basics.sk
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
options:
a: 17

struct basic:
a: int
b: strings
c: entitytype = cow
d{@a}: number = {@a}

test "basic struct behavior":
set {_struct} to a basic struct
assert {_struct}->a is not set with "struct field a was somehow set"
assert {_struct}->b is not set with "struct field b was somehow set"
assert {_struct}->c is a cow with "struct field c was not set to cow"
assert {_struct}->d{@a} is {@a} with "struct field {@a} was not set to {@a}"

set {_struct}->a to 1
assert {_struct}->a is 1 with "struct field a was not set to 1"
Expand Down