Skip to content

Commit

Permalink
add coloring n stuff to last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Sep 20, 2021
1 parent 3c7ef99 commit 71eb4e4
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/main/java/com/denizenscript/denizencore/events/ScriptEvent.java
Expand Up @@ -207,16 +207,16 @@ public static void reload() {
}
YamlConfiguration config = container.getConfigurationSection("events");
if (config == null) {
Debug.echoError("Missing or invalid events block for " + container.getName());
Debug.echoError("Missing or invalid events block for <Y>" + container.getName());
continue;
}
for (StringHolder evt : config.getKeys(false)) {
if (evt == null || evt.str == null) {
Debug.echoError("Missing or invalid events block for " + container.getName());
Debug.echoError("Missing or invalid events block for <Y>" + container.getName());
}
else if (CoreUtilities.contains(evt.str, '@')) {
Debug.echoError("Script '" + container.getName() + "' has event '" + evt.str.replace("@", "<R>@<W>")
+ "' which contains object notation, which is deprecated for use in world events. Please remove it.");
Debug.echoError("Script '<Y>" + container.getName() + "<W>' has event '<Y>" + evt.str.replace("@", "<R>@<Y>")
+ "<W>' which contains object notation, which is deprecated for use in world events. Please remove it.");
}
}
}
Expand All @@ -237,14 +237,14 @@ else if (evt1.low.startsWith("after ")) {
after = true;
}
else {
Debug.echoError("Script path '" + evt1.str + "' is invalid (missing 'on' or 'after').");
Debug.echoError("Script path '<Y>" + evt1.str + "<W>' is invalid (missing 'on' or 'after').");
continue;
}
evt = evt.replace("&dot", ".").replace("&amp", "&");
ScriptPath path = new ScriptPath(container, evt, evt1.str);
path.fireAfter = after;
if (path.set == null) {
Debug.echoError("Script path '" + path + "' is invalid (empty or misconfigured).");
Debug.echoError("Script path '<Y>" + path + "<W>' is invalid (empty or misconfigured).");
continue;
}
paths.add(path);
Expand All @@ -262,7 +262,7 @@ else if (evt1.low.startsWith("after ")) {
event.eventPaths.add(path);
path.matches.add(event);
if (Debug.showLoading) {
Debug.log("Event match, " + event.getName() + " matched for '" + path + "'!");
Debug.log("Event match, <Y>" + event.getName() + "<W> matched for '<Y>" + path + "<W>'!");
}
matched = true;
}
Expand All @@ -273,18 +273,18 @@ else if (evt1.low.startsWith("after ")) {
}
}
catch (Throwable ex) {
Debug.echoError("Failed to reload event '" + event.getName() + "':");
Debug.echoError("Failed to reload event '<Y>" + event.getName() + "<W>':");
Debug.echoError(ex);
}
}
tryingToBuildEvent = null;
tryingToBuildPath = null;
for (ScriptPath path : paths) {
if (path.matches.size() > 1) {
Debug.log("Event " + path + " is matched to multiple ScriptEvents: " + CoreUtilities.join(", ", path.matches));
Debug.log("Event <Y>" + path + "<W> is matched to multiple ScriptEvents: <Y>" + CoreUtilities.join("<W>,<Y> ", path.matches));
}
else if (path.matches.isEmpty()) {
Debug.echoError("Event " + path + " is not matched to any ScriptEvents.");
Debug.echoError("Event <Y>" + path + "<W> is not matched to any ScriptEvents.");
if (path.matchFailReasons != null) {
for (String reason : path.matchFailReasons) {
Debug.log(reason);
Expand All @@ -293,20 +293,20 @@ else if (path.matches.isEmpty()) {
}
path.matchFailReasons = null;
}
Debug.log("Processed " + paths.size() + " script event paths.");
Debug.log("Processed <A>" + paths.size() + "<W> script event paths.");
}

public static ScriptPath tryingToBuildPath = null;
public static ScriptEvent tryingToBuildEvent = null;

public static void addPossibleCouldMatchFailReason(String reason) {
public static void addPossibleCouldMatchFailReason(String reason, String example) {
if (tryingToBuildPath == null || tryingToBuildEvent == null) {
return;
}
if (tryingToBuildPath.matchFailReasons == null) {
tryingToBuildPath.matchFailReasons = new ArrayList<>();
}
tryingToBuildPath.matchFailReasons.add("Almost matched: " + tryingToBuildEvent.getName() + ", but failed because: " + reason);
tryingToBuildPath.matchFailReasons.add("Almost matched: <Y>" + tryingToBuildEvent.getName() + "<W>, but failed because: <Y>" + reason + "<W>: '<LR>" + example + "<W>'");
}

// <--[language]
Expand Down

0 comments on commit 71eb4e4

Please sign in to comment.