-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ffdba78
commit 1fb2261
Showing
13 changed files
with
274 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/org/skriptlang/reflect/syntax/PatternsEntryData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.skriptlang.reflect.syntax; | ||
|
||
import ch.njol.skript.ScriptLoader; | ||
import ch.njol.skript.config.Node; | ||
import ch.njol.skript.config.SectionNode; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.skriptlang.skript.lang.entry.EntryData; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class PatternsEntryData extends EntryData<List<String>> { | ||
|
||
public PatternsEntryData(String key, @Nullable List<String> defaultValue, boolean optional) { | ||
super(key, defaultValue, optional); | ||
} | ||
|
||
@Override | ||
public List<String> getValue(Node node) { | ||
List<String> patterns = new ArrayList<>(); | ||
for (Node subNode : (SectionNode) node) { | ||
String key = subNode.getKey(); | ||
if (key == null) | ||
continue; | ||
patterns.add(key); | ||
} | ||
return patterns; | ||
} | ||
|
||
@Override | ||
public boolean canCreateWith(Node node) { | ||
if (!(node instanceof SectionNode)) | ||
return false; | ||
String key = node.getKey(); | ||
if (key == null) | ||
return false; | ||
key = ScriptLoader.replaceOptions(key); | ||
return getKey().equalsIgnoreCase(key); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.