diff --git a/src/main/java/dev/esophose/playerparticles/manager/ConfigurationManager.java b/src/main/java/dev/esophose/playerparticles/manager/ConfigurationManager.java index 930621f..05c91aa 100644 --- a/src/main/java/dev/esophose/playerparticles/manager/ConfigurationManager.java +++ b/src/main/java/dev/esophose/playerparticles/manager/ConfigurationManager.java @@ -54,7 +54,7 @@ public class ConfigurationManager extends Manager { PARTICLE_RENDER_RANGE_PLAYER("particle-render-range-player", 48, "From how many blocks away should a player be able to see the particles from another player?"), PARTICLE_RENDER_RANGE_FIXED_EFFECT("particle-render-range-fixed-effect", 192, "From how many blocks away should a player be able to see the particles from a fixed effect?"), RAINBOW_CYCLE_SPEED("rainbow-cycle-speed", 2, "How many out of 360 hue ticks to move per game tick", "Higher values make the rainbow cycle faster", "Note: Must be a positive whole number"), - DUST_SIZE("dust-size", 1, "How large should dust particles appear?", "Note: Can include decimals", "Only works in 1.13+"), + DUST_SIZE("dust-size", 1.0, "How large should dust particles appear?", "Note: Can include decimals", "Only works in 1.13+"), MYSQL_SETTINGS("mysql-settings", null, "Settings for if you want to use MySQL for data management"), MYSQL_ENABLED("mysql-settings.enabled", false, "Enable MySQL", "If false, SQLite will be used instead"), diff --git a/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleArrows.java b/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleArrows.java index e07d117..2b19497 100644 --- a/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleArrows.java +++ b/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleArrows.java @@ -7,20 +7,19 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.bukkit.Location; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ProjectileLaunchEvent; public class ParticleStyleArrows extends DefaultParticleStyle implements Listener { - private static final String[] arrowEntityNames = new String[] { "ARROW", "SPECTRAL_ARROW", "TIPPED_ARROW" }; private List arrows = new ArrayList<>(); private int maxArrowsPerPlayer; private boolean onlySpawnIfFlying; + private List arrowEntityNames; public ParticleStyleArrows() { super("arrows", false, false, 0); @@ -61,31 +60,30 @@ public class ParticleStyleArrows extends DefaultParticleStyle implements Listene } /** - * The event used to get all arrows fired by players - * Adds all arrows fired from players to the array - * - * @param e The EntityShootBowEvent + * The event used to get all projectiles fired by players + * Adds all projectiles fired from players to the array + * + * @param event The ProjectileLaunchEvent */ @EventHandler - public void onArrowFired(EntityShootBowEvent e) { - if (e.getEntityType() != EntityType.PLAYER) - return; - - String entityName = e.getProjectile().getType().toString(); - if (Arrays.stream(arrowEntityNames).anyMatch(entityName::equalsIgnoreCase)) - this.arrows.add((Projectile) e.getProjectile()); + public void onProjectileLaunch(ProjectileLaunchEvent event) { + String entityName = event.getEntity().getType().name(); + if (this.arrowEntityNames.contains(entityName)) + this.arrows.add(event.getEntity()); } @Override protected void setDefaultSettings(CommentedFileConfiguration config) { this.setIfNotExists("max-arrows-per-player", 10, "The max number of arrows that will spawn particles per player"); this.setIfNotExists("only-spawn-if-flying", false, "Only spawn particles while the arrow is still in the air"); + this.setIfNotExists("arrow-entities", Arrays.asList("ARROW", "SPECTRAL_ARROW", "TIPPED_ARROW"), "The name of the projectile entities that are counted as arrows"); } @Override protected void loadSettings(CommentedFileConfiguration config) { this.maxArrowsPerPlayer = config.getInt("max-arrows-per-player"); this.onlySpawnIfFlying = config.getBoolean("only-spawn-if-flying"); + this.arrowEntityNames = config.getStringList("arrow-entities"); } } diff --git a/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleOrbit.java b/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleOrbit.java index 7aa3983..12f1a6f 100644 --- a/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleOrbit.java +++ b/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleOrbit.java @@ -14,6 +14,7 @@ public class ParticleStyleOrbit extends DefaultParticleStyle { private int orbs; private int numSteps; + private double radius; public ParticleStyleOrbit() { super("orbit", true, true, 0); @@ -23,8 +24,8 @@ public class ParticleStyleOrbit extends DefaultParticleStyle { public List getParticles(ParticlePair particle, Location location) { List particles = new ArrayList<>(); for (int i = 0; i < this.orbs; i++) { - double dx = -(MathL.cos((this.step / (double) this.numSteps) * (Math.PI * 2) + (((Math.PI * 2) / this.orbs) * i))); - double dz = -(MathL.sin((this.step / (double) this.numSteps) * (Math.PI * 2) + (((Math.PI * 2) / this.orbs) * i))); + double dx = -(MathL.cos((this.step / (double) this.numSteps) * (Math.PI * 2) + (((Math.PI * 2) / this.orbs) * i))) * this.radius; + double dz = -(MathL.sin((this.step / (double) this.numSteps) * (Math.PI * 2) + (((Math.PI * 2) / this.orbs) * i))) * this.radius; particles.add(new PParticle(location.clone().add(dx, 0, dz))); } return particles; @@ -39,12 +40,14 @@ public class ParticleStyleOrbit extends DefaultParticleStyle { protected void setDefaultSettings(CommentedFileConfiguration config) { this.setIfNotExists("orbs", 3, "The number of orbs that orbit the player"); this.setIfNotExists("steps", 120, "The number of spawning steps around the player"); + this.setIfNotExists("radius", 1.0, "The radius for spawning the orbs"); } @Override protected void loadSettings(CommentedFileConfiguration config) { this.orbs = config.getInt("orbs"); this.numSteps = config.getInt("steps"); + this.radius = config.getDouble("radius"); } }