Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance & Fix Sign Text Expression #5465

Closed

Conversation

NotSoDelayed
Copy link
Contributor

Description

A broom from Wal-Mart arrived to clean up ExprSignText which also allows for plural lines support!


Target Minecraft Versions: any
Requirements: any
Related Issues: #4576 (lines)

@AyhamAl-Ali AyhamAl-Ali added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Feb 20, 2023
src/main/java/ch/njol/skript/expressions/ExprSignText.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprSignText.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprSignText.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprSignText.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprSignText.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprSignText.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprSignText.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprSignText.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/expressions/ExprSignText.java Outdated Show resolved Hide resolved
Comment on lines +76 to +80
if (matchedPattern == 1) {
line = (Expression<Number>) exprs[0];
} else {
new SimpleLiteral<>(parseResult.mark, false);
}
Copy link
Contributor

@Fusezion Fusezion Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you call new SimpleLiteral here but never set line to this, also a little lost on the change here outside of better readability

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged this with ternary but LimeGlass disagreed, so I reverted back to this.

Copy link
Contributor

@Fusezion Fusezion Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, then that's all

Copy link
Contributor

@Fusezion Fusezion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something I missed in my once over

Comment on lines 56 to +60
Skript.registerExpression(ExprSignText.class, String.class, ExpressionType.PROPERTY,
"[the] line %number% [of %block%]", "[the] (1¦1st|1¦first|2¦2nd|2¦second|3¦3rd|3¦third|4¦4th|4¦fourth) line [of %block%]");
"[the] lines [of %block%]",
"[the] line %number% [of %block%]",
"[the] (1¦1st|1¦first|2¦2nd|2¦second|3¦3rd|3¦third|4¦4th|4¦fourth) line [of %block%]"
);
Copy link
Contributor

@Fusezion Fusezion Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could the last pattern not be (1:(1st|first)|2:(2nd|second)|3:(3rd|third)|4:(4th|fourth)) for the matching?
we no longer need pipe lines and should stay back from those as ParseMark supports colons.

Do double check with the pattern tho but it should work like that

@NotSoDelayed NotSoDelayed marked this pull request as draft April 10, 2023 01:05
@NotSoDelayed
Copy link
Contributor Author

Closing in favour of #5797

@NotSoDelayed NotSoDelayed deleted the enhance/sign-lines branch July 14, 2023 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants