-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Make visual effects serializable #7114
base: dev/feature
Are you sure you want to change the base?
Make visual effects serializable #7114
Conversation
also you can remove the license from the top of the files |
Co-authored-by: Efy <[email protected]>
d95d3cb
to
b2c231e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this handle types with data, like vibrations or dust particles? Also, I'd like to see some regression tests if possible.
@Override | ||
public Fields serialize(VisualEffectType visualEffectType) { | ||
Fields fields = new Fields(); | ||
fields.putObject("id", visualEffectType.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doing a quick look thru the VisualEffectType code, I see this regarding IDs
public String getId() {
return effect.getDeclaringClass().getSimpleName() + "." + effect.name();
}
The issue here is the ID is the class name and enum name.
Problem comes from the fact Mojang has changed particle names several times in the last few versions.
And as of I believe 1.21 Bukkit has changed a whole bunch of the enums.
That said, this is not version safe.
Description
Started by @TPGamesNL in PR #4123 (the commit has been cherry-picked and the author has been kept for credits), providing a serializer for
VisualEffectType
allows to serializeVisualEffect
correctly. In fact, this should have been handled bysimpleClassLoaders
, where this specific class was originally registered.However, the
Yggdrasil#getSerializer
method did not return a serializer: aSimpleClassResolver
extends fromClassResolver
and not from aYggdrasilSerializer
like the others. A fix is therefore to directly register this serializer at the root ofclassResolvers
.https://github.com/SkriptLang/Skript/blob/master/src/main/java/ch/njol/yggdrasil/Yggdrasil.java
Target Minecraft Versions: any
Requirements: none
Related Issues: #4196