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

Improve variable names in EffChange #6779

Open
wants to merge 5 commits into
base: dev/feature
Choose a base branch
from

Conversation

Pikachu920
Copy link
Member

Description

Adds some more descriptive variable names to EffChange. It also swaps complicated ternaries for if/else instead.


Target Minecraft Versions: any
Requirements: none
Related Issues: none

@Moderocky Moderocky changed the base branch from master to dev/feature June 10, 2024 19:32
Comment on lines +273 to 277
if (deltaReturnTypeClassInfo.getC() != Object.class && deltaReturnTypeClassInfo.getSerializer() == null && deltaReturnTypeClassInfo.getSerializeAs() == null && !SkriptConfig.disableObjectCannotBeSavedWarnings.value()) {
if (getParser().isActive() && !getParser().getCurrentScript().suppressesWarning(ScriptWarning.VARIABLE_SAVE)) {
Skript.warning(ci.getName().withIndefiniteArticle() + " cannot be saved, i.e. the contents of the variable " + changed + " will be lost when the server stops.");
Skript.warning(deltaReturnTypeClassInfo.getName().withIndefiniteArticle() + " cannot be saved, i.e. the contents of the variable " + expressionToChange + " will be lost when the server stops.");
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's just github UI messing up but it looks like we have two ifs nested in here and neither of them have an else, maybe they could be combined or tidied up somehow?

final Expression<?> changer = this.changer;
switch (mode) {
public String toString(final @Nullable Event event, final boolean debug) {
assert deltaValuesExpression != null;
Copy link
Member

Choose a reason for hiding this comment

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

Won't this cause problems in test mode if it ever gets stringified? For DELETE and RESET it is null, right? (If not the field probably shouldn't be @Nullable so we won't need this assertion)

Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

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

other than kenzie things, seems good

@sovdeeth sovdeeth added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Jun 28, 2024
Copy link
Member

@UnderscoreTud UnderscoreTud left a comment

Choose a reason for hiding this comment

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

Could you remove all occurrences of ErrorQuality.SEMANTIC_ERROR since it's already the default?

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