Skip to content

Commit

Permalink
use new getRawValue method
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 18, 2020
1 parent a9cb492 commit 58d1f08
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 25 deletions.
Expand Up @@ -179,17 +179,17 @@ else if (!scriptEntry.hasObject("flag_target")

// Check if setting a boolean
else if (!scriptEntry.hasObject("flag_name") &&
arg.raw_value.split(":", 3).length == 1) {
arg.getRawValue().split(":", 3).length == 1) {
scriptEntry.addObject("action", FlagManager.Action.SET_BOOLEAN);
scriptEntry.addObject("value", new ElementTag(true));
scriptEntry.addObject("flag_name", arg.asElement());
}

// Check for flag_name:value/action
else if (!scriptEntry.hasObject("flag_name") &&
arg.raw_value.split(":", 3).length == 2) {
arg.getRawValue().split(":", 3).length == 2) {

String[] flagArgs = arg.raw_value.split(":", 2);
String[] flagArgs = arg.getRawValue().split(":", 2);
scriptEntry.addObject("flag_name", new ElementTag(flagArgs[0].toUpperCase()));

if (flagArgs[1].equals("++") || flagArgs[1].equals("+")) {
Expand Down Expand Up @@ -217,8 +217,8 @@ else if (flagArgs[1].equals("<-")) {

// Check for flag_name:action:value
else if (!scriptEntry.hasObject("flag_name") &&
arg.raw_value.split(":", 3).length == 3) {
String[] flagArgs = arg.raw_value.split(":", 3);
arg.getRawValue().split(":", 3).length == 3) {
String[] flagArgs = arg.getRawValue().split(":", 3);
scriptEntry.addObject("flag_name", new ElementTag(flagArgs[0].toUpperCase()));

if (flagArgs[1].equals("->")) {
Expand Down Expand Up @@ -247,7 +247,7 @@ else if (flagArgs[1].equals("//") || flagArgs[1].equals("/")) {
}
else {
scriptEntry.addObject("action", FlagManager.Action.SET_VALUE);
scriptEntry.addObject("value", new ElementTag(arg.raw_value.split(":", 2)[1]));
scriptEntry.addObject("value", new ElementTag(arg.getRawValue().split(":", 2)[1]));
continue;
}

Expand Down
Expand Up @@ -93,7 +93,7 @@ else if (arg.matchesArgumentType(LocationTag.class)) {
scriptEntry.addObject("origin_location", arg.asType(LocationTag.class));
}
else {
Debug.echoError("Ignoring unrecognized argument: " + arg.raw_value);
Debug.echoError("Ignoring unrecognized argument: " + arg.getRawValue());
}
}
else if (!scriptEntry.hasObject("destination")
Expand Down
Expand Up @@ -98,7 +98,7 @@ else if (!scriptEntry.hasObject("per_player")
scriptEntry.addObject("per_player", new ElementTag(true));
}
else if (!scriptEntry.hasObject("name")) {
scriptEntry.addObject("name", new ElementTag(arg.raw_value));
scriptEntry.addObject("name", new ElementTag(arg.getRawValue()));
}
else {
arg.reportUnhandled();
Expand Down
Expand Up @@ -106,7 +106,7 @@ else if (arg.matchesArgumentType(LocationTag.class)) {
scriptEntry.addObject("origin_location", arg.asType(LocationTag.class));
}
else {
Debug.echoError("Ignoring unrecognized argument: " + arg.raw_value);
Debug.echoError("Ignoring unrecognized argument: " + arg.getRawValue());
}
}
else if (!scriptEntry.hasObject("destination")
Expand Down
Expand Up @@ -93,9 +93,9 @@ else if (!scriptEntry.hasObject("unlimit_stack_size")
}
else if (!scriptEntry.hasObject("items")
&& !scriptEntry.hasObject("type")
&& (arg.matchesArgumentList(ItemTag.class) || arg.startsWith("item:"))) {
scriptEntry.addObject("items", ListTag.valueOf(arg.raw_value.startsWith("item:") ?
arg.raw_value.substring("item:".length()) : arg.raw_value, scriptEntry.getContext()).filter(ItemTag.class, scriptEntry));
&& (arg.matchesArgumentList(ItemTag.class))) {
scriptEntry.addObject("items", ListTag.valueOf(arg.getRawValue().startsWith("item:") ?
arg.getRawValue().substring("item:".length()) : arg.getRawValue(), scriptEntry.getContext()).filter(ItemTag.class, scriptEntry));
}
else if (!scriptEntry.hasObject("inventory")
&& arg.matchesPrefix("t", "to")
Expand Down
Expand Up @@ -26,8 +26,8 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
for (Argument arg : scriptEntry.getProcessedArgs()) {

if (!scriptEntry.hasObject("key")
&& arg.raw_value.split(":", 2).length == 2) {
String[] flagArgs = arg.raw_value.split(":", 2);
&& arg.getRawValue().split(":", 2).length == 2) {
String[] flagArgs = arg.getRawValue().split(":", 2);
scriptEntry.addObject("key", new ElementTag(flagArgs[0]));
scriptEntry.addObject("value", new ElementTag(flagArgs[1]));
}
Expand Down
Expand Up @@ -158,7 +158,7 @@ else if (!scriptEntry.hasObject("slot")
else if (!scriptEntry.hasObject("items")
&& !scriptEntry.hasObject("type")
&& arg.matchesArgumentList(ItemTag.class)) {
scriptEntry.addObject("items", ListTag.valueOf(arg.raw_value.replace("item:", ""), scriptEntry.getContext()).filter(ItemTag.class, scriptEntry));
scriptEntry.addObject("items", ListTag.valueOf(arg.getRawValue().replace("item:", ""), scriptEntry.getContext()).filter(ItemTag.class, scriptEntry));
}
else if (!scriptEntry.hasObject("inventory")
&& arg.matchesPrefix("f", "from")
Expand Down
Expand Up @@ -84,7 +84,7 @@ else if (!scriptEntry.hasObject("per_player")
scriptEntry.addObject("per_player", new ElementTag(true));
}
else if (!scriptEntry.hasObject("text")) {
scriptEntry.addObject("text", new ElementTag(arg.raw_value));
scriptEntry.addObject("text", new ElementTag(arg.getRawValue()));
}
}
if (!scriptEntry.hasObject("text")) {
Expand Down
Expand Up @@ -92,7 +92,7 @@ else if (arg.matchesPrefix("range", "r")) {
}
}
else if (!scriptEntry.hasObject("message")) {
scriptEntry.addObject("message", new ElementTag(arg.raw_value));
scriptEntry.addObject("message", new ElementTag(arg.getRawValue()));
}
else {
arg.reportUnhandled();
Expand Down
Expand Up @@ -124,7 +124,7 @@ else if (!scriptEntry.hasObject("for_players")
scriptEntry.addObject("for_players", arg.asType(ListTag.class).filter(PlayerTag.class, scriptEntry));
}
else if (!scriptEntry.hasObject("script")) {
String scriptName = arg.raw_value;
String scriptName = arg.getRawValue();
int dotIndex = scriptName.indexOf('.');
if (dotIndex > 0) {
scriptEntry.addObject("path", new ElementTag(scriptName.substring(dotIndex + 1)));
Expand Down
Expand Up @@ -86,7 +86,7 @@ else if (!scriptEntry.hasObject("per_player")
scriptEntry.addObject("per_player", new ElementTag(true));
}
else if (!scriptEntry.hasObject("text")) {
scriptEntry.addObject("text", new ElementTag(arg.raw_value));
scriptEntry.addObject("text", new ElementTag(arg.getRawValue()));
}
else {
arg.reportUnhandled();
Expand Down
Expand Up @@ -88,7 +88,7 @@ else if (!scriptEntry.hasObject("background")
scriptEntry.addObject("background", arg.asElement());
}
else if (!scriptEntry.hasObject("text")) {
scriptEntry.addObject("text", new ElementTag(arg.raw_value));
scriptEntry.addObject("text", new ElementTag(arg.getRawValue()));
}
else {
arg.reportUnhandled();
Expand Down
Expand Up @@ -101,7 +101,7 @@ else if (!scriptEntry.hasObject("format")
scriptEntry.addObject("format", format);
}
else if (!scriptEntry.hasObject("text")) {
scriptEntry.addObject("text", new ElementTag(arg.raw_value));
scriptEntry.addObject("text", new ElementTag(arg.getRawValue()));
}

}
Expand Down
Expand Up @@ -106,7 +106,7 @@ else if (!scriptEntry.hasObject("silent")
scriptEntry.addObject("silent", new ElementTag("true"));
}
else if (!scriptEntry.hasObject("command")) {
scriptEntry.addObject("command", new ElementTag(arg.raw_value));
scriptEntry.addObject("command", new ElementTag(arg.getRawValue()));
}
else {
arg.reportUnhandled();
Expand Down
Expand Up @@ -105,13 +105,13 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
if (arg.matchesArgumentType(CuboidTag.class)
&& !scriptEntry.hasObject("locations")
&& !scriptEntry.hasObject("location_list")
&& (arg.startsWith("cu@") || !arg.raw_value.contains("|"))) {
&& (arg.startsWith("cu@") || !arg.getRawValue().contains("|"))) {
scriptEntry.addObject("locations", arg.asType(CuboidTag.class).getBlockLocationsUnfiltered());
}
else if (arg.matchesArgumentType(EllipsoidTag.class)
&& !scriptEntry.hasObject("locations")
&& !scriptEntry.hasObject("location_list")
&& (arg.startsWith("ellipsoid@") || !arg.raw_value.contains("|"))) {
&& (arg.startsWith("ellipsoid@") || !arg.getRawValue().contains("|"))) {
scriptEntry.addObject("locations", arg.asType(EllipsoidTag.class).getBlockLocationsUnfiltered());
}
else if (arg.matchesArgumentList(LocationTag.class)
Expand Down
Expand Up @@ -144,7 +144,7 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
for (Argument arg : scriptEntry.getProcessedArgs()) {
if (!scriptEntry.hasObject("type")
&& arg.matchesEnum(Type.values())) {
scriptEntry.addObject("type", new ElementTag(arg.raw_value.toUpperCase()));
scriptEntry.addObject("type", new ElementTag(arg.getRawValue().toUpperCase()));
}
else if (!scriptEntry.hasObject("name")
&& arg.matchesPrefix("name")) {
Expand Down

0 comments on commit 58d1f08

Please sign in to comment.