forked from SteamWar/SteamWar
Add BauSystem module
Fix ci java version Fix LinkageProcessor
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import de.steamwar.lobby.particle.ParticleTickType;
|
||||
|
||||
public class Always extends DelegatingParticleElement {
|
||||
|
||||
public Always(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_TICK";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleTickType tickType() {
|
||||
return ParticleTickType.ALWAYS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
particleElement.tick(particleTickData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Circle extends DelegatingParticleElement {
|
||||
|
||||
private double distance;
|
||||
private double speed;
|
||||
|
||||
public Circle(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
this.distance = 1;
|
||||
this.speed = 1;
|
||||
}
|
||||
|
||||
public Circle(ParticleElement particleElement, double distance, double speed) {
|
||||
super(particleElement);
|
||||
this.distance = distance;
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_CIRCLE";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
Location location = particleTickData.getLocation();
|
||||
|
||||
Vector vector = new Vector(distance, 0, 0);
|
||||
vector.rotateAroundY((particleTickData.getDeg() * speed) % 360);
|
||||
ParticleTickData nParticleTickData = particleTickData.withLocation(location.clone().add(vector));
|
||||
particleElement.tick(nParticleTickData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class Cloud extends DelegatingParticleElement {
|
||||
|
||||
public Cloud(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_CLOUD";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
if (particleTickData.getWorld().getBlockAt(particleTickData.getPlayer().getLocation().subtract(0, 0.5, 0)).getType() == Material.AIR) {
|
||||
particleTickData.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 5, 2, false, false, false));
|
||||
} else {
|
||||
particleTickData.getPlayer().removePotionEffect(PotionEffectType.SLOW_FALLING);
|
||||
return;
|
||||
}
|
||||
ParticleTickData nParticleTickData = particleTickData.withLocation(particleTickData.getLocation().subtract(0, -0.2, 0));
|
||||
particleElement.tick(nParticleTickData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Delayed extends DelegatingParticleElement {
|
||||
|
||||
private DelayedData delayedData = new DelayedData();
|
||||
private int interval;
|
||||
|
||||
private static class DelayedData implements Listener {
|
||||
private Map<Player, Integer> data = new HashMap<>();
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
data.remove(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
public Delayed(ParticleElement particleElement, int interval) {
|
||||
super(particleElement);
|
||||
Bukkit.getPluginManager().registerEvents(delayedData, LobbySystem.getPlugin());
|
||||
this.interval = interval;
|
||||
if (interval <= 0) {
|
||||
throw new IllegalArgumentException("Interval must be greater than 0");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
int currentNumber = delayedData.data.getOrDefault(particleTickData.getPlayer(), 0) % interval;
|
||||
delayedData.data.put(particleTickData.getPlayer(), currentNumber + 1);
|
||||
if (currentNumber != 0) {
|
||||
return;
|
||||
}
|
||||
particleElement.tick(particleTickData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import de.steamwar.lobby.particle.ParticleTickType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class DoubleCircle extends Circle {
|
||||
|
||||
private ParticleElement second;
|
||||
|
||||
private double distance;
|
||||
private double speed;
|
||||
|
||||
public DoubleCircle(ParticleElement first, ParticleElement second) {
|
||||
super(first);
|
||||
this.second = second;
|
||||
this.distance = 1;
|
||||
this.speed = 1;
|
||||
}
|
||||
|
||||
public DoubleCircle(ParticleElement first, ParticleElement second, double distance, double speed) {
|
||||
super(first);
|
||||
this.second = second;
|
||||
this.distance = distance;
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_BI_CIRCLE";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParticleTickType tickType() {
|
||||
if (particleElement.tickType() == second.tickType()) {
|
||||
return particleElement.tickType();
|
||||
}
|
||||
return ParticleTickType.MOVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
Location location = particleTickData.getLocation();
|
||||
|
||||
Vector vector = new Vector(distance, 0, 0);
|
||||
vector.rotateAroundY((particleTickData.getDeg() * speed) % 360);
|
||||
ParticleTickData nParticleTickData = particleTickData.withLocation(location.clone().add(vector));
|
||||
particleElement.tick(nParticleTickData);
|
||||
|
||||
vector.setX(-vector.getX());
|
||||
vector.setZ(-vector.getZ());
|
||||
|
||||
nParticleTickData = particleTickData.withLocation(location.clone().add(vector));
|
||||
second.tick(nParticleTickData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
|
||||
public class DustParticle implements ParticleElement {
|
||||
|
||||
private Particle particle;
|
||||
private float vx = 0.01f;
|
||||
private float vy = 0.01f;
|
||||
private float vz = 0.01f;
|
||||
private double speed = 0.01;
|
||||
private int count = 5;
|
||||
|
||||
public DustParticle(Particle particle) {
|
||||
this.particle = particle;
|
||||
}
|
||||
|
||||
public DustParticle(Particle particle, float vx, float vy, float vz) {
|
||||
this.particle = particle;
|
||||
this.vx = vx;
|
||||
this.vy = vy;
|
||||
this.vz = vz;
|
||||
}
|
||||
|
||||
public DustParticle(Particle particle, float vx, float vy, float vz, double speed, int count) {
|
||||
this.particle = particle;
|
||||
this.vx = vx;
|
||||
this.vy = vy;
|
||||
this.vz = vz;
|
||||
this.speed = speed;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
Location location = particleTickData.getLocation().add(0.0, 0.2, 0.0);
|
||||
display(location, particleTickData.getPlayer(), particleTickData.isOnlySelf(), particleTickData.isOnlyOthers(), player -> {
|
||||
player.spawnParticle(particle, location, count, vx, vy, vz, speed, randomParticleDust());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
|
||||
public class Floor extends DelegatingParticleElement {
|
||||
|
||||
public Floor(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_FLOOR";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
if (!particleTickData.getWorld().getBlockAt(particleTickData.getPlayer().getLocation().subtract(0, 0.5, 0)).getType().isAir()) {
|
||||
particleElement.tick(particleTickData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
|
||||
public class Flying extends DelegatingParticleElement {
|
||||
|
||||
public Flying(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_FLYING";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
if (!particleTickData.getPlayer().isGliding()) {
|
||||
return;
|
||||
}
|
||||
particleElement.tick(particleTickData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleData;
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
|
||||
public class Group extends DelegatingParticleElement {
|
||||
|
||||
private final ParticleElement[] rest;
|
||||
|
||||
public Group(ParticleElement particleElement, ParticleElement... rest) {
|
||||
super(particleElement);
|
||||
this.rest = rest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void aggregateAttributes(ParticleData particleData) {
|
||||
particleElement.aggregateAttributes(particleData);
|
||||
for (ParticleElement particleElement : rest) {
|
||||
particleElement.aggregateAttributes(particleData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
particleElement.tick(particleTickData);
|
||||
for (ParticleElement particleElement : rest) {
|
||||
particleElement.tick(particleTickData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
public class LocationMutator extends DelegatingParticleElement {
|
||||
|
||||
private UnaryOperator<Location> mutator;
|
||||
|
||||
public LocationMutator(ParticleElement particleElement, UnaryOperator<Location> mutator) {
|
||||
super(particleElement);
|
||||
this.mutator = mutator;
|
||||
}
|
||||
|
||||
public LocationMutator(ParticleElement particleElement, double vx, double vy, double vz) {
|
||||
this(particleElement, location -> location.add(vx, vy, vz));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
ParticleTickData nParticleTickData = particleTickData.withLocation(mutator.apply(particleTickData.getLocation()));
|
||||
particleElement.tick(nParticleTickData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
|
||||
public class NonFloor extends DelegatingParticleElement {
|
||||
|
||||
public NonFloor(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_NON_FLOOR";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
if (particleTickData.getWorld().getBlockAt(particleTickData.getPlayer().getLocation().subtract(0, 0.5, 0)).getType().isAir()) {
|
||||
particleElement.tick(particleTickData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
|
||||
public class NonFlying extends DelegatingParticleElement {
|
||||
|
||||
public NonFlying(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_NON_FLYING";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
if (particleTickData.getPlayer().isGliding()) {
|
||||
return;
|
||||
}
|
||||
particleElement.tick(particleTickData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
|
||||
public class OnlyOthers extends DelegatingParticleElement {
|
||||
|
||||
public OnlyOthers(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
particleElement.tick(particleTickData.onlyOthers());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
|
||||
public class OnlySelf extends DelegatingParticleElement {
|
||||
|
||||
public OnlySelf(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
particleElement.tick(particleTickData.onlySelf());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleEnum;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class RandomParticle implements ParticleElement {
|
||||
|
||||
private RandomData randomData;
|
||||
private ParticleEnum[] particleEnums;
|
||||
|
||||
private static class RandomData implements Listener {
|
||||
private Random random = new Random();
|
||||
private int max;
|
||||
private Map<Player, Integer> data = new HashMap<>();
|
||||
|
||||
public RandomData(int max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
data.put(event.getPlayer(), random.nextInt(max));
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
data.remove(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
public RandomParticle(ParticleEnum... particleEnums) {
|
||||
if (particleEnums.length == 0) {
|
||||
throw new IllegalArgumentException("ParticleEnums must not be empty");
|
||||
}
|
||||
this.randomData = new RandomData(particleEnums.length);
|
||||
Bukkit.getPluginManager().registerEvents(randomData, LobbySystem.getPlugin());
|
||||
this.particleEnums = particleEnums;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
int currentNumber = randomData.data.getOrDefault(particleTickData.getPlayer(), 0);
|
||||
particleEnums[currentNumber].getParticle().getParticleElement().tick(particleTickData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleData;
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
|
||||
public class Separator implements ParticleElement {
|
||||
|
||||
@Override
|
||||
public void aggregateAttributes(ParticleData particleData) {
|
||||
particleData.add("PARTICLE_ATTRIBUTE_SEPARATOR");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
|
||||
public class SimpleParticle implements ParticleElement {
|
||||
|
||||
private final Particle particle;
|
||||
private boolean customVelocity = false;
|
||||
private float vx;
|
||||
private float vy;
|
||||
private float vz;
|
||||
private double time = 1;
|
||||
private int count = 5;
|
||||
|
||||
public SimpleParticle(Particle particle) {
|
||||
this.particle = particle;
|
||||
}
|
||||
|
||||
public SimpleParticle(Particle particle, float vx, float vy, float vz) {
|
||||
this.particle = particle;
|
||||
this.customVelocity = true;
|
||||
this.vx = vx;
|
||||
this.vy = vy;
|
||||
this.vz = vz;
|
||||
}
|
||||
|
||||
public SimpleParticle(Particle particle, float vx, float vy, float vz, double time) {
|
||||
this.particle = particle;
|
||||
this.customVelocity = true;
|
||||
this.vx = vx;
|
||||
this.vy = vy;
|
||||
this.vz = vz;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public SimpleParticle(Particle particle, float vx, float vy, float vz, double time, int count) {
|
||||
this.particle = particle;
|
||||
this.customVelocity = true;
|
||||
this.vx = vx;
|
||||
this.vy = vy;
|
||||
this.vz = vz;
|
||||
this.time = time;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public SimpleParticle(Particle particle, double time, int count) {
|
||||
this.particle = particle;
|
||||
this.time = time;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
Location location = particleTickData.getLocation().add(0.0, 0.2, 0.0);
|
||||
display(location, particleTickData.getPlayer(), particleTickData.isOnlySelf(), particleTickData.isOnlyOthers(), player -> {
|
||||
if (customVelocity) {
|
||||
player.spawnParticle(particle, location, count, vx, vy, vz, time);
|
||||
} else {
|
||||
player.spawnParticle(particle, location, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
|
||||
public class Sneaking extends DelegatingParticleElement {
|
||||
|
||||
public Sneaking(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_SNEAKING";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
if (!particleTickData.getPlayer().isSneaking()) {
|
||||
return;
|
||||
}
|
||||
particleElement.tick(particleTickData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package de.steamwar.lobby.particle.elements;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import de.steamwar.lobby.particle.WingDesign;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Wing extends DelegatingParticleElement {
|
||||
|
||||
private double size;
|
||||
private WingDesign wingDesign;
|
||||
|
||||
public Wing(ParticleElement particleElement, double size, WingDesign wingDesign) {
|
||||
super(particleElement);
|
||||
this.size = size;
|
||||
this.wingDesign = wingDesign;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_WING";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
for (Vector dVector : wingDesign.getVectors()) {
|
||||
Vector vector = new Vector(dVector.getX() * size, 0.6 + dVector.getY() * size - (particleTickData.getPlayer().isSneaking() ? 0.5 : 0), 0.5);
|
||||
vector.rotateAroundY(Math.toRadians(particleTickData.getPlayer().getLocation().getYaw() * -1));
|
||||
vector.setX(-vector.getX());
|
||||
vector.setZ(-vector.getZ());
|
||||
Location location = particleTickData.getPlayer().getLocation().clone().add(vector);
|
||||
ParticleTickData current = particleTickData.withLocation(location);
|
||||
particleElement.tick(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package de.steamwar.lobby.particle.elements.custom;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class HearthBeat extends DelegatingParticleElement {
|
||||
|
||||
private double speed;
|
||||
|
||||
private double y(double time) {
|
||||
double d1 = Math.pow(2, -Math.pow(time * 17 - 7.5, 2));
|
||||
double d2 = Math.pow(2, -Math.pow(time * 20 - 11, 2)) * 0.5;
|
||||
double d3 = Math.pow(2, -Math.pow(time * 25 - 17, 2)) * 0.1;
|
||||
return (d1 - d2 + d3) * 0.5;
|
||||
}
|
||||
|
||||
public HearthBeat(ParticleElement particleElement, double speed) {
|
||||
super(particleElement);
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
double time = ((particleTickData.getDeg() * speed) % 360) / 360.0;
|
||||
double y = y(time) * 2;
|
||||
double x = (time - 0.5) * 2;
|
||||
|
||||
Vector vector = new Vector(x, 1.1 + y - (particleTickData.getPlayer().isSneaking() ? 0.5 : 0), 0.7);
|
||||
vector.rotateAroundY(Math.toRadians(particleTickData.getPlayer().getLocation().getYaw() * -1));
|
||||
vector.setX(-vector.getX());
|
||||
vector.setZ(-vector.getZ());
|
||||
Location location = particleTickData.getPlayer().getLocation().clone().add(vector);
|
||||
ParticleTickData current = particleTickData.withLocation(location);
|
||||
particleElement.tick(current);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package de.steamwar.lobby.particle.elements.custom;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
|
||||
|
||||
public class NonMoving extends DelegatingParticleElement {
|
||||
|
||||
public NonMoving(ParticleElement particleElement) {
|
||||
super(particleElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return "PARTICLE_ATTRIBUTE_NON_MOVING";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
if (particleTickData.isMoving()) {
|
||||
return;
|
||||
}
|
||||
particleElement.tick(particleTickData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package de.steamwar.lobby.particle.elements.custom;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class PulseShimmer extends DelegatingParticleElement {
|
||||
|
||||
private int speed;
|
||||
private int rotationSpeed;
|
||||
|
||||
private double x(double time) {
|
||||
if (time < 0.45) {
|
||||
return Math.pow(2, -Math.pow((time - 0.45) * 6, 2)) * 0.8;
|
||||
} else {
|
||||
return Math.pow(2, -Math.pow((time - 0.45) * 4, 2)) * 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
private double y(double time) {
|
||||
return (8 * Math.pow(time, 2.2) - time) / (6.5 / 3.5) -0.1;
|
||||
}
|
||||
|
||||
public PulseShimmer(ParticleElement particleElement, int speed, int rotationSpeed) {
|
||||
super(particleElement);
|
||||
this.speed = speed;
|
||||
this.rotationSpeed = rotationSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
double time = ((particleTickData.getDeg() * speed) % 360) / 360.0;
|
||||
double x = x(time);
|
||||
double y = y(time);
|
||||
Vector vector = new Vector(x, y, 0);
|
||||
vector.rotateAroundY((particleTickData.getDeg() * rotationSpeed) % 360);
|
||||
|
||||
particleElement.tick(particleTickData.withLocation(particleTickData.getLocation().clone().add(vector)));
|
||||
vector.rotateAroundY(90);
|
||||
particleElement.tick(particleTickData.withLocation(particleTickData.getLocation().clone().add(vector)));
|
||||
vector.rotateAroundY(90);
|
||||
particleElement.tick(particleTickData.withLocation(particleTickData.getLocation().clone().add(vector)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package de.steamwar.lobby.particle.elements.custom;
|
||||
|
||||
import de.steamwar.lobby.particle.ParticleElement;
|
||||
import de.steamwar.lobby.particle.ParticleTickData;
|
||||
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
|
||||
|
||||
public class YOffset extends DelegatingParticleElement {
|
||||
|
||||
private double multiplication;
|
||||
private double minY;
|
||||
private double maxY;
|
||||
private boolean inverted;
|
||||
|
||||
public YOffset(ParticleElement particleElement, double speed, double minY, double maxY, boolean inverted) {
|
||||
super(particleElement);
|
||||
this.multiplication = speed;
|
||||
this.minY = minY;
|
||||
this.maxY = maxY;
|
||||
this.inverted = inverted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String attribute() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ParticleTickData particleTickData) {
|
||||
double value = ((particleTickData.getDeg() * multiplication) % 360) / 180;
|
||||
double y;
|
||||
if (inverted) {
|
||||
if (value <= 1) {
|
||||
y = maxY - (maxY - minY) * value;
|
||||
} else {
|
||||
y = minY + (maxY - minY) * (value - 1);
|
||||
}
|
||||
} else {
|
||||
if (value <= 1) {
|
||||
y = minY + (maxY - minY) * value;
|
||||
} else {
|
||||
y = maxY - (maxY - minY) * (value - 1);
|
||||
}
|
||||
}
|
||||
ParticleTickData current = particleTickData.withLocation(particleTickData.getLocation().clone().add(0, y, 0));
|
||||
particleElement.tick(current);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user