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

SoundUtils - handle Sound class for enum/interface #7199

Merged
merged 8 commits into from
Nov 8, 2024

Conversation

ShaneBeee
Copy link
Contributor

@ShaneBeee ShaneBeee commented Nov 7, 2024

Description

This PR aims to fix an issue with Bukkit changing the Sound class from Enum to Interface.
This is my take on it, not sure if this is the best way to do it.

Note:

  • I didn't know which branch to target, so change as need be.

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

Copy link
Member

@Efnilite Efnilite left a comment

Choose a reason for hiding this comment

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

i think you can rebase this to patch since this is a bug that should be fixed

@@ -240,4 +239,27 @@ public String toString(@Nullable Event event, boolean debug) {
return builder.toString();
}

@SuppressWarnings({"deprecation", "unchecked", "rawtypes"})
Copy link
Member

Choose a reason for hiding this comment

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

this should be per statement. you should use the noinspection comment (alt enter > arrow down (suppress) > suppress for statement)

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 don't see the point of this. Why remove 1 line to create 3+ more lines?
And since when did SkriptLang do this? I dont think ive ever done this nor ever seen it, nor is it in the code conventions.

Copy link
Member

Choose a reason for hiding this comment

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

i think using suppresswarnings on an entire method may lead to confusion as to when something generally considered not good is used (like casting raw types etc). using these comments just emphasizes where they actually occur

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So is this a SkriptLang preference, or personal preference?
I personally think having a suppression for a block makes more sense than adding a suppression for every line in the block.

Copy link
Member

Choose a reason for hiding this comment

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

It's something we agreed on back in august or so. If it's not in the conventions yet it probably needs to be added. Warning suppression should be as specific as possible to avoid suppressing other warnings that weren't originally intended (see suppressing one deprecated method, but then a second gets deprecated too, it's good to still see the warning for the second.)
Of course, if the warnings are routine and/or the block is very small, like many init() methods, it's not worth suppressing each line individually.
In this case I can see it either way, I don't think it matters much, since the method's quite small.

Copy link
Member

Choose a reason for hiding this comment

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

If it's not in the conventions yet it probably needs to be added.

It is :)

Copy link
Member

Choose a reason for hiding this comment

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

image
ah it's in the nullness category instead of the formatting category

src/main/java/ch/njol/skript/effects/EffPlaySound.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/effects/EffPlaySound.java Outdated Show resolved Hide resolved
@Efnilite Efnilite added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Nov 7, 2024
@ShaneBeee
Copy link
Contributor Author

ShaneBeee commented Nov 7, 2024

@Efnilite so much for SkriptLang being less strict.
What happened with that?

All those changes just seem redundant.

@ShaneBeee ShaneBeee changed the base branch from master to dev/patch November 7, 2024 21:46
@Efnilite
Copy link
Member

Efnilite commented Nov 7, 2024

@Efnilite so much for SkriptLang being less strict. What happened with that?

All those changes just seem redundant.

i think it's to ensure a consistent style in the entire codebase. i don't make the rules, i just follow them :)

@UnderscoreTud
Copy link
Member

@Efnilite so much for SkriptLang being less strict. What happened with that?

All those changes just seem redundant.

https://github.com/SkriptLang/Skript/blob/master/code-conventions.md

Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

Looks great

@sovdeeth sovdeeth merged commit 00650de into SkriptLang:dev/patch Nov 8, 2024
7 checks passed
@ShaneBeee ShaneBeee deleted the fix/sound-enum-fix branch November 9, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants