Skip to content

Commit

Permalink
use modern java instanceof in several places
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Feb 11, 2023
1 parent 669a92b commit 1c4d56f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Expand Up @@ -61,7 +61,7 @@ public boolean hasValue() {
if (value == null) {
return false;
}
if (value instanceof ElementTag && ((ElementTag) value).asString().isEmpty()) {
if (value instanceof ElementTag element && element.asString().isEmpty()) {
return false;
}
return true;
Expand Down
Expand Up @@ -172,7 +172,7 @@ public final Argument argAtIndex(ScriptEntry.InternalArgument[] argSet, int inde
arg.scriptEntry = this;
if (internalArg.shouldParse) {
TagManager.fillArgumentObjects(internalArg, arg, context);
if (internalArg.hadColon && arg.prefix == null && arg.object instanceof ElementTag && ((ElementTag) arg.object).isRawInput) {
if (internalArg.hadColon && arg.prefix == null && arg.object instanceof ElementTag element && element.isRawInput) {
arg.fillStr(arg.object.toString());
if (arg.prefix != null && !internal.actualCommand.allowedDynamicPrefixes) {
arg.prefixWasDynamic = true;
Expand Down
Expand Up @@ -250,7 +250,7 @@ public static String stringifyNullPass(Object obj) {
}

public static ObjectTag fixType(ObjectTag input, TagContext context) {
if (input instanceof ElementTag && !((ElementTag) input).isPlainText) {
if (input instanceof ElementTag element && !element.isPlainText) {
return ObjectFetcher.pickObjectFor(input.toString(), context);
}
return input.refreshState();
Expand Down
Expand Up @@ -12,7 +12,7 @@
public class DataActionHelper {

public static DataAction parse(ActionableDataProvider provider, Argument arg, TagContext context) {
if ((arg.object instanceof ElementTag && ((ElementTag) arg.object).isRawInput) || !arg.hasPrefix()) {
if ((arg.object instanceof ElementTag element && element.isRawInput) || !arg.hasPrefix()) {
return parse(provider, arg.getRawValue(), context);
}
DataAction action = new DataAction();
Expand Down

0 comments on commit 1c4d56f

Please sign in to comment.