package de.steamwar.lobby.particle.elements;

import de.steamwar.lobby.particle.ParticleData;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickType;

public abstract class DelegatingParticleElement implements ParticleElement {

    protected final ParticleElement particleElement;

    protected DelegatingParticleElement(ParticleElement particleElement) {
        this.particleElement = particleElement;
    }

    public abstract String attribute();

    @Override
    public void aggregateAttributes(ParticleData particleData) {
        String attribute = attribute();
        if (attribute != null) {
            particleData.add(attribute);
        }
        particleElement.aggregateAttributes(particleData);
    }

    @Override
    public ParticleTickType tickType() {
        return particleElement.tickType();
    }
}
