Give each particle set a unique id for the db

This commit is contained in:
Teriuihi 2022-01-13 20:10:56 +01:00
parent d424e7d768
commit 2fe8b0d367
3 changed files with 33 additions and 7 deletions

View File

@ -13,17 +13,19 @@ public class ParticleSet {
private final List<Frame> frames;
private final int delay, repeat;
private final APartType particlesType;
private final APartType aPartType;
private final String uniqueId;
private int ticksUntilNextFrame;
private final boolean shouldRepeat;
private final String permission;
private final ItemStack itemStack;
private int ticksUntilNextFrame;
public ParticleSet(List<Frame> frames, int delay, int repeat, APartType particlesType, String permission, ItemStack itemStack) {
public ParticleSet(List<Frame> frames, int delay, int repeat, APartType aPartType, String uniqueId, String permission, ItemStack itemStack) {
this.frames = frames;
this.delay = delay;
this.repeat = repeat;
this.particlesType = particlesType;
this.aPartType = aPartType;
this.uniqueId = uniqueId;
this.shouldRepeat = repeat < 0;
this.permission = permission;
this.itemStack = itemStack;
@ -40,6 +42,10 @@ public class ParticleSet {
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, delay);
}
public APartType getAPartType() {
return aPartType;
}
public String getPermission() {
return permission;
}

View File

@ -0,0 +1,7 @@
package com.alttd.particles;
public class InitParticles {
public static void init() {
new Test();
}
}

View File

@ -5,23 +5,36 @@ import com.alttd.objects.Frame;
import com.alttd.objects.ParticleSet;
import com.alttd.storage.ParticleStorage;
import com.destroystokyo.paper.ParticleBuilder;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
public class Test {
private static final ItemStack itemStack;
static {
MiniMessage miniMessage = MiniMessage.miniMessage();
itemStack = new ItemStack(Material.CHEST);
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.displayName(miniMessage.deserialize("<gold>TestParticles</gold>"));
itemMeta.lore(List.of(miniMessage.deserialize("<dark_aqua>A particle to test\nthe functionality of this plugin</dark_aqua>")));
itemStack.setItemMeta(itemMeta);
}
public Test() {
APartType test = APartType.DEATH;
APartType test = APartType.BREAK_PLACE_BLOCK;
List<Frame> frameList = new ArrayList<>();
//
frameList.add(new Frame(frameOne()));
//....
ParticleSet particleSet = new ParticleSet(frameList, 5, 5, test, "apart.particle.test", new ItemStack(Material.CHEST));
ParticleSet particleSet = new ParticleSet(frameList, 5, 5, test, "UNIQUE_NAME_TEST", "apart.particle.test", itemStack);
ParticleStorage.addParticleSet(test, particleSet);
}