Skip to content

Commit

Permalink
fix actionbar command argument parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 9, 2020
1 parent faa3cce commit 577f294
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Expand Up @@ -97,7 +97,6 @@ public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
event.setServerIcon(icon);
}
return true;

}
if (determination.length() > 0 && !determination.equalsIgnoreCase("none")) {
List<String> values = CoreUtilities.split(determination, '|', 2);
Expand Down
Expand Up @@ -68,15 +68,17 @@ public ActionBarCommand() {
@Override
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException {
for (Argument arg : ArgumentHelper.interpret(scriptEntry, scriptEntry.getOriginalArguments())) {
if (arg.matchesPrefix("format", "f")) {
if (!scriptEntry.hasObject("format")
&& arg.matchesPrefix("format", "f")) {
String formatStr = TagManager.tag(arg.getValue(), scriptEntry.getContext());
FormatScriptContainer format = ScriptRegistry.getScriptContainer(formatStr);
if (format == null) {
Debug.echoError("Could not find format script matching '" + formatStr + "'");
}
scriptEntry.addObject("format", new ScriptTag(format));
}
if (arg.matchesPrefix("targets", "target")) {
else if (!scriptEntry.hasObject("targets")
&& arg.matchesPrefix("targets", "target")) {
scriptEntry.addObject("targets", ListTag.getListFor(TagManager.tagObject(arg.getValue(), scriptEntry.getContext()), scriptEntry.getContext()).filter(PlayerTag.class, scriptEntry));
}
else if (!scriptEntry.hasObject("per_player")
Expand All @@ -86,6 +88,9 @@ else if (!scriptEntry.hasObject("per_player")
else if (!scriptEntry.hasObject("text")) {
scriptEntry.addObject("text", new ElementTag(arg.getRawValue()));
}
else {
arg.reportUnhandled();
}
}
if (!scriptEntry.hasObject("text")) {
throw new InvalidArgumentsException("Must specify a message!");
Expand Down

0 comments on commit 577f294

Please sign in to comment.