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

PotionEffectType overhaul #7364

Merged
merged 13 commits into from
Jan 9, 2025

Conversation

ShaneBeee
Copy link
Contributor

@ShaneBeee ShaneBeee commented Jan 2, 2025

Description

This PR aims to overhaul potion effect type in Skript.

It started with a bug:
"null" showing up in the docs for PotionEffectType:
Screenshot 2025-01-02 at 12 00 56 PM

It has since changed into re-working a lot:

  • Cleanup PotionEffect utils to use keys instead of deprecated IDs (this fixes the "null" in docs bug)
  • Add a potion effect type registry when it is available (1.20.x+)

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

@Moderocky
Copy link
Member

Do you know if there is any way of removing the getId entirely? It's deprecated for removal (though that's hidden by the suppression).

@ShaneBeee
Copy link
Contributor Author

Do you know if there is any way of removing the getId entirely? It's deprecated for removal (though that's hidden by the suppression).

could use keys/strings(from keys) instead.
looking at Spigot 1.19 docs, it has implemented Keyed for long enough.

I also considered doing an overhaul for this and using a RegistryClassInfo when the registry is available.

@ShaneBeee ShaneBeee marked this pull request as draft January 2, 2025 20:31
@ShaneBeee ShaneBeee changed the title PotionEffectUtils - fix null in docs PotionEffectType overhaul Jan 2, 2025
@ShaneBeee
Copy link
Contributor Author

Do you know if there is any way of removing the getId entirely? It's deprecated for removal (though that's hidden by the suppression).

@Moderocky ok I re-wrote the whole PR.

  • changed PotionEffectUtils to use keys instead of deprecated IDs
  • Added a PotionEffectType registry (when available)

@ShaneBeee ShaneBeee marked this pull request as ready for review January 2, 2025 21:01
@APickledWalrus APickledWalrus self-requested a review January 2, 2025 21:25
Copy link
Member

@Moderocky Moderocky left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for fixing this.

@cheeezburga cheeezburga added enhancement Feature request, an issue about something that could be improved, or a PR improving something. feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. and removed feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. labels Jan 3, 2025
@Moderocky
Copy link
Member

@APickledWalrus will wait for you before merging because you have a stale potions rework PR.

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.

A few minor things. One thing I wanted to ask about is the serialization changes. Is it possible that the serialization/deserialization process would change on the same version (that is, using the registry vs using PotionEffectType.getByName). Nice work!

@ShaneBeee
Copy link
Contributor Author

Is it possible that the serialization/deserialization process would change on the same version (that is, using the registry vs using PotionEffectType.getByName). Nice work!

It shouldn't. The method just uses Keys internally anyways:
(from bukkit)
Screenshot 2025-01-03 at 10 47 32 AM

@Moderocky Moderocky merged commit 344e0af into SkriptLang:dev/feature Jan 9, 2025
5 checks passed
@ShaneBeee ShaneBeee deleted the shane/potion-effect-null branch January 9, 2025 18:50
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.

7 participants