Skip to content

Commit

Permalink
fix mistaken debug from certain matches calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 6, 2020
1 parent 3e638fa commit 8c5a780
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Expand Up @@ -4,6 +4,7 @@
import com.denizenscript.denizencore.objects.core.ElementTag;
import com.denizenscript.denizencore.objects.core.ListTag;
import com.denizenscript.denizencore.scripts.ScriptEntry;
import com.denizenscript.denizencore.tags.TagContext;
import com.denizenscript.denizencore.tags.TagManager;
import com.denizenscript.denizencore.utilities.AsciiMatcher;
import com.denizenscript.denizencore.utilities.CoreUtilities;
Expand Down Expand Up @@ -130,11 +131,14 @@ public String getValue() {
return value;
}

public ListTag getList() {
public ListTag getList(TagContext context) {
if (object instanceof ListTag) {
return (ListTag) object;
}
return ListTag.valueOf(value, scriptEntry == null ? null : scriptEntry.getContext());
if (context == null && scriptEntry != null) {
context = scriptEntry.getContext();
}
return ListTag.valueOf(value, context);
}

public static HashSet<String> precalcEnum(Enum<?>[] values) {
Expand All @@ -161,7 +165,7 @@ public boolean matchesEnum(Enum<?>[] values) {
}

public boolean matchesEnumList(Enum<?>[] values) {
ListTag list = getList();
ListTag list = getList(CoreUtilities.noDebugContext);
for (String string : list) {
String tval = string.replace("_", "");
for (Enum<?> value : values) {
Expand Down Expand Up @@ -221,7 +225,7 @@ public boolean matchesArgumentTypes(Class<? extends ObjectTag>... dClasses) {

// Check if this argument matches a ListTag of a certain ObjectTag
public boolean matchesArgumentList(Class<? extends ObjectTag> dClass) {
ListTag list = getList();
ListTag list = getList(CoreUtilities.noDebugContext);
return list.isEmpty() || list.containsObjectsFrom(dClass);
}

Expand Down
Expand Up @@ -41,11 +41,11 @@ public YamlCommand() {
// @Syntax yaml [create]/[load:<file>]/[loadtext:<text>]/[unload]/[savefile:<file>]/[copykey:<source key> <target key> (to_id:<name>)]/[set <key>([<#>])(:<action>):<value>] [id:<name>]
// @Required 2
// @Maximum 4
// @Short Edits a YAML configuration file.
// @Short Edits YAML data, especially for YAML files.
// @Group file
//
// @Description
// Edits a YAML configuration file.
// Edits YAML configuration data.
// This can be used for interacting with other plugins' configuration files.
// It can also be used for storing your own script's data.
//
Expand Down

0 comments on commit 8c5a780

Please sign in to comment.