forked from SteamWar/SteamWar
Move lobby presets and rewards onto the particle slot model
Team- and user-specific particles become presets built from entries, tournament and egg hunt particles become fixed reward designs, and the old particle enums, ParticleEnum and ParticleData are removed. The particle menu temporarily lists only unlocked presets.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.lobby.particle.design;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleRequirement;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
// A design whose look, including its particles, is fixed; only the entry's conditions, timing and offset apply
|
||||
public class FixedDesign extends ParticleDesign {
|
||||
|
||||
private final int points;
|
||||
private final Consumer<ParameterValues> defaults;
|
||||
private final Supplier<ParticleElement> shape;
|
||||
|
||||
public FixedDesign(String id, Material icon, String nameKey, ParticleRequirement requirement, int points, Consumer<ParameterValues> defaults, Supplier<ParticleElement> shape) {
|
||||
super(id, icon, nameKey, DesignVisibility.REWARD, requirement);
|
||||
this.points = points;
|
||||
this.defaults = defaults;
|
||||
this.shape = shape;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleElement build(ParameterValues values, ParticleElement particle) {
|
||||
return shape.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int points(ParameterValues values) {
|
||||
return points;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesEntryParticle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyDefaults(ParameterValues values) {
|
||||
defaults.accept(values);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user