Added delay
Made particles dependent on player yaw
This commit is contained in:
@@ -3,18 +3,21 @@ package com.alttd.objects;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public enum APartType { //TODO add description?
|
||||
HEAD("HEAD", "Head", Material.PLAYER_HEAD, null, false),
|
||||
TRAIL("TRAIL", "Trail", Material.GOLD_INGOT, null, false),
|
||||
BREAK_PLACE_BLOCK("BREAK_PLACE_BLOCK", "Break/place block", Material.GRASS_BLOCK, null, true),
|
||||
DEATH("DEATH", "Death", Material.SKELETON_SKULL, null, true),
|
||||
KILL("KILL", "Kill", Material.DIAMOND_SWORD, null, true),
|
||||
CLICK_BLOCK("CLICK_BLOCK", "Right click block", Material.DIAMOND_BLOCK, null, true),
|
||||
TELEPORT_ARRIVE("TELEPORT", "Teleport", Material.DRAGON_EGG, null, true);
|
||||
HEAD("HEAD", "Head", Material.PLAYER_HEAD, 0,null, false),
|
||||
TRAIL("TRAIL", "Trail", Material.GOLD_INGOT, 0, null, false),
|
||||
BREAK_PLACE_BLOCK("BREAK_PLACE_BLOCK", "Break/place block", Material.GRASS_BLOCK, TimeUnit.SECONDS.toMillis(5), null, true),
|
||||
DEATH("DEATH", "Death", Material.SKELETON_SKULL, TimeUnit.SECONDS.toMillis(30), null, true),
|
||||
KILL("KILL", "Kill", Material.DIAMOND_SWORD, TimeUnit.SECONDS.toMillis(5), null, true),
|
||||
CLICK_BLOCK("CLICK_BLOCK", "Right click block", Material.DIAMOND_BLOCK, TimeUnit.SECONDS.toMillis(60), null, true),
|
||||
TELEPORT_ARRIVE("TELEPORT", "Teleport", Material.DRAGON_EGG, TimeUnit.SECONDS.toMillis(5), null, true);
|
||||
|
||||
private final String name;
|
||||
private final String displayName;
|
||||
private final Material material;
|
||||
private final long delay;
|
||||
private ItemStack itemStack;
|
||||
private final boolean event;
|
||||
|
||||
@@ -30,6 +33,10 @@ public enum APartType { //TODO add description?
|
||||
return material;
|
||||
}
|
||||
|
||||
public long getDelay() {
|
||||
return delay;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
@@ -42,12 +49,12 @@ public enum APartType { //TODO add description?
|
||||
return event;
|
||||
}
|
||||
|
||||
APartType(String name, String displayName, Material material, ItemStack itemStack, boolean event) {
|
||||
APartType(String name, String displayName, Material material, long delay, ItemStack itemStack, boolean event) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.material = material;
|
||||
this.delay = delay;
|
||||
this.itemStack = itemStack;
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ParticleSet {
|
||||
|
||||
@@ -32,18 +34,32 @@ public class ParticleSet {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
public void run(Location location) {
|
||||
public void run(Location location, UUID uuid) {
|
||||
if (tooSoon(uuid))
|
||||
return;
|
||||
FrameSpawnerLocation frameSpawnerLocation = new FrameSpawnerLocation(repeat, repeatDelay, frames, location);
|
||||
frameSpawnerLocation.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
|
||||
}
|
||||
|
||||
public void run(Player player, PlayerSettings playerSettings) {
|
||||
public void run(Player player, PlayerSettings playerSettings, UUID uuid) {
|
||||
if (tooSoon(uuid))
|
||||
return;
|
||||
if (Config.DEBUG)
|
||||
Logger.info("Starting particle set % for %.", uniqueId, player.getName());
|
||||
FrameSpawnerPlayer frameSpawnerPlayer = new FrameSpawnerPlayer(repeat, repeatDelay, frames, player, playerSettings, aPartType, uniqueId);
|
||||
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
|
||||
}
|
||||
|
||||
private boolean tooSoon(UUID uuid) {
|
||||
PlayerSettings ps = PlayerSettings.getPlayer(uuid);
|
||||
if (ps.canRun(aPartType))
|
||||
{
|
||||
ps.run(aPartType);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public APartType getAPartType() {
|
||||
return aPartType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user