Refactor ParticleConfig with Jackson, add ParticleData models, and update dependencies
Replaced JSON-Simple with Jackson for particle configuration parsing. Introduced `ParticleData` and `ParticleInfo` models for structured data. Updated `ParticleConfig` structure for clarity and modularity. Added Jackson and Lombok dependencies in `build.gradle.kts`.
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
package com.alttd.models;
|
||||
|
||||
import com.alttd.objects.APartType;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents the configuration data for a particle effect, including its name, type, display properties,
|
||||
* animations, and permissions. This class is primarily used for managing particle data in the context
|
||||
* of custom particle effects and animations.
|
||||
* <p>
|
||||
* Fields:
|
||||
* - particleName: The unique name of the particle effect, used internally.
|
||||
* - displayName: The name displayed to the user.
|
||||
* - particleType: The type of the particle effect, which corresponds to an {@link APartType}.
|
||||
* - lore: Additional descriptive text associated with the particle effect.
|
||||
* - displayItem: An item representation for display purposes in order to visually represent the effect.
|
||||
* - permission: The permission string required for accessing the particle effect.
|
||||
* - packagePermission: A specific permission string linked to a grouped set of effects.
|
||||
* - frameDelay: The delay between animation frames, in milliseconds.
|
||||
* - repeat: The number of times the particle animation should repeat.
|
||||
* - repeatDelay: The delay between repeat executions, in milliseconds.
|
||||
* - randomOffset: A random position offset applied to the particle effect for variances.
|
||||
* - stationary: Determines if the particle effect remains static or follows movement.
|
||||
* - frames: A map defining animation frames for the particle effect. The key is an identifier, and the
|
||||
* value is a list of {@link ParticleInfo} objects representing the frame's particle configuration.
|
||||
* <p>
|
||||
* Methods:
|
||||
* - getAPartType(): Converts the particleType string field into an equivalent {@link APartType} enum value.
|
||||
* This allows for accessing predefined properties of the particle type.
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class ParticleData {
|
||||
@JsonProperty("particle_name")
|
||||
private String particleName;
|
||||
|
||||
@JsonProperty("display_name")
|
||||
private String displayName;
|
||||
|
||||
@JsonProperty("particle_type")
|
||||
private String particleType;
|
||||
|
||||
private String lore;
|
||||
|
||||
@JsonProperty("display_item")
|
||||
private String displayItem;
|
||||
|
||||
private String permission;
|
||||
|
||||
@JsonProperty("package_permission")
|
||||
private String packagePermission;
|
||||
|
||||
@JsonProperty("frame_delay")
|
||||
private int frameDelay;
|
||||
|
||||
private int repeat;
|
||||
|
||||
@JsonProperty("repeat_delay")
|
||||
private int repeatDelay;
|
||||
|
||||
@JsonProperty("random_offset")
|
||||
private double randomOffset;
|
||||
|
||||
private boolean stationary;
|
||||
|
||||
private Map<String, List<ParticleInfo>> frames;
|
||||
|
||||
public APartType getAPartType() {
|
||||
return APartType.valueOf(particleType);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user