mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-02-11 03:29:53 +00:00
Add styles 'twins', 'popper', fix bug with style 'celebration'
This commit is contained in:
parent
c14f76e611
commit
5392cd2511
9 changed files with 163 additions and 10 deletions
|
@ -5,6 +5,7 @@
|
|||
+ Added new styles 'pulse', 'whirl', and 'whirlwind'
|
||||
+ The "Save New Group" button in the GUI now actually saves a new group and prompts for a name in chat (15 second timeout)
|
||||
+ Added a click sound to the GUI for button clicks (Can be disabled in the config.yml)
|
||||
+ Added setting 'toggle-on-move-delay' to the config.yml
|
||||
* Reduced the number of particles that spawn for the styles 'blockbreak', 'blockplace', and 'swords'
|
||||
* Fix GUI borders showing up as glass panes instead of stained glass panes on servers running 1.12.2 or earlier
|
||||
* Fix a console error that occurs when trying to remove a group that doesn't exist
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* + Add named colors to the color data
|
||||
* + Add effect/style name customization through config files
|
||||
* + Add effect/style settings folder that lets you disable effects/style and edit style properties
|
||||
* + Possibly add a couple new styles (tornado, doubleorbit)
|
||||
*/
|
||||
|
||||
package com.esophose.playerparticles;
|
||||
|
|
|
@ -39,9 +39,13 @@ public class DataManager {
|
|||
* @return The PPlayer from cache
|
||||
*/
|
||||
public static PPlayer getPPlayer(UUID playerUUID) {
|
||||
for (PPlayer pp : ParticleManager.getPPlayers())
|
||||
if (pp.getUniqueId().equals(playerUUID)) return pp;
|
||||
return null;
|
||||
List<PPlayer> pplayers = ParticleManager.getPPlayers();
|
||||
synchronized (pplayers) { // Under rare circumstances, the PPlayers list can be changed while it's looping
|
||||
for (PPlayer pp : pplayers)
|
||||
if (pp.getUniqueId().equals(playerUUID))
|
||||
return pp;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,6 +32,7 @@ public class DefaultStyles {
|
|||
public static final ParticleStyle ORBIT = new ParticleStyleOrbit();
|
||||
public static final ParticleStyle OVERHEAD = new ParticleStyleOverhead();
|
||||
public static final ParticleStyle POINT = new ParticleStylePoint();
|
||||
public static final ParticleStyle POPPER = new ParticleStylePopper();
|
||||
public static final ParticleStyle PULSE = new ParticleStylePulse();
|
||||
public static final ParticleStyle QUADHELIX = new ParticleStyleQuadhelix();
|
||||
public static final ParticleStyle RINGS = new ParticleStyleRings();
|
||||
|
@ -40,6 +41,7 @@ public class DefaultStyles {
|
|||
public static final ParticleStyle SPIRAL = new ParticleStyleSpiral();
|
||||
public static final ParticleStyle SWORDS = new ParticleStyleSwords();
|
||||
public static final ParticleStyle THICK = new ParticleStyleThick();
|
||||
public static final ParticleStyle TWINS = new ParticleStyleTwins();
|
||||
public static final ParticleStyle VORTEX = new ParticleStyleVortex();
|
||||
public static final ParticleStyle WHIRL = new ParticleStyleWhirl();
|
||||
public static final ParticleStyle WHIRLWIND = new ParticleStyleWhirlwind();
|
||||
|
@ -68,6 +70,7 @@ public class DefaultStyles {
|
|||
ParticleStyleManager.registerStyle(ORBIT);
|
||||
ParticleStyleManager.registerStyle(OVERHEAD);
|
||||
ParticleStyleManager.registerStyle(POINT);
|
||||
ParticleStyleManager.registerStyle(POPPER);
|
||||
ParticleStyleManager.registerStyle(PULSE);
|
||||
ParticleStyleManager.registerStyle(QUADHELIX);
|
||||
ParticleStyleManager.registerStyle(RINGS);
|
||||
|
@ -76,6 +79,7 @@ public class DefaultStyles {
|
|||
ParticleStyleManager.registerStyle(SPIRAL);
|
||||
ParticleStyleManager.registerCustomHandledStyle(SWORDS);
|
||||
ParticleStyleManager.registerStyle(THICK);
|
||||
ParticleStyleManager.registerStyle(TWINS);
|
||||
ParticleStyleManager.registerStyle(VORTEX);
|
||||
ParticleStyleManager.registerStyle(WHIRL);
|
||||
ParticleStyleManager.registerStyle(WHIRLWIND);
|
||||
|
|
|
@ -5,12 +5,14 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.esophose.playerparticles.PlayerParticles;
|
||||
import com.esophose.playerparticles.manager.ParticleManager;
|
||||
import com.esophose.playerparticles.manager.PermissionManager;
|
||||
import com.esophose.playerparticles.particles.FixedParticleEffect;
|
||||
import com.esophose.playerparticles.particles.PPlayer;
|
||||
import com.esophose.playerparticles.particles.ParticleEffect;
|
||||
|
@ -39,13 +41,13 @@ public class ParticleStyleCelebration implements ParticleStyle {
|
|||
Random random = new Random();
|
||||
for (PPlayer pplayer : ParticleManager.getPPlayers()) {
|
||||
Player player = pplayer.getPlayer();
|
||||
|
||||
for (ParticlePair particle : pplayer.getActiveParticles())
|
||||
if (particle.getStyle() == this)
|
||||
spawnFirework(player.getLocation(), pplayer, particle, random);
|
||||
if (player != null && player.getGameMode() != GameMode.SPECTATOR && !PermissionManager.isWorldDisabled(player.getWorld().getName()))
|
||||
for (ParticlePair particle : pplayer.getActiveParticles())
|
||||
if (particle.getStyle() == this)
|
||||
spawnFirework(player.getLocation(), pplayer, particle, random);
|
||||
|
||||
for (FixedParticleEffect fixedEffect : pplayer.getFixedParticles())
|
||||
if (fixedEffect.getParticlePair().getStyle() == this)
|
||||
if (fixedEffect.getParticlePair().getStyle() == this && !PermissionManager.isWorldDisabled(fixedEffect.getLocation().getWorld().getName()))
|
||||
spawnFirework(fixedEffect.getLocation(), pplayer, fixedEffect.getParticlePair(), random);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.esophose.playerparticles.styles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.esophose.playerparticles.particles.ParticlePair;
|
||||
import com.esophose.playerparticles.styles.api.PParticle;
|
||||
import com.esophose.playerparticles.styles.api.ParticleStyle;
|
||||
|
||||
public class ParticleStylePopper implements ParticleStyle {
|
||||
|
||||
private double grow = 0.08f;
|
||||
private double radials = Math.PI / 16;
|
||||
private int helices = 2;
|
||||
private int step = 0;
|
||||
private int maxStep = 35;
|
||||
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<PParticle>();
|
||||
|
||||
double radius = (1 - (double)step / maxStep);
|
||||
for (int i = 0; i < helices; i++) {
|
||||
double angle = step * radials + (2 * Math.PI * i / helices);
|
||||
Vector v = new Vector(Math.cos(angle) * radius, step * grow - 1, Math.sin(angle) * radius);
|
||||
|
||||
particles.add(new PParticle(location.clone().add(v)));
|
||||
}
|
||||
|
||||
if (step == maxStep - 1) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
particles.add(new PParticle(location.clone().add(0, 1.5, 0), 0.5, 0.5, 0.5, 0.03));
|
||||
}
|
||||
}
|
||||
|
||||
return particles;
|
||||
}
|
||||
|
||||
public void updateTimers() {
|
||||
step = (step + 1) % maxStep;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "popper";
|
||||
}
|
||||
|
||||
public boolean canBeFixed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canToggleWithMovement() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public double getFixedEffectOffset() {
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
}
|
|
@ -13,7 +13,7 @@ import com.esophose.playerparticles.styles.api.ParticleStyle;
|
|||
public class ParticleStylePulse implements ParticleStyle {
|
||||
|
||||
private int points = 50;
|
||||
private double radius = 0.75;
|
||||
private double radius = 0.5;
|
||||
private double step = 0;
|
||||
private int numSteps = 15;
|
||||
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package com.esophose.playerparticles.styles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import com.esophose.playerparticles.particles.ParticlePair;
|
||||
import com.esophose.playerparticles.styles.api.PParticle;
|
||||
import com.esophose.playerparticles.styles.api.ParticleStyle;
|
||||
|
||||
public class ParticleStyleTwins implements ParticleStyle {
|
||||
|
||||
private static double[] cos, sin;
|
||||
private static final int orbs = 2;
|
||||
private static final int numSteps = 60;
|
||||
private int stepX = 0;
|
||||
private int stepY = 0;
|
||||
private int maxStepY = 30;
|
||||
private boolean reverse = false;
|
||||
|
||||
static {
|
||||
cos = new double[120];
|
||||
sin = new double[120];
|
||||
|
||||
int i = 0;
|
||||
for (double n = 0; n < numSteps; n++) {
|
||||
cos[i] = -Math.cos(n / numSteps * Math.PI * 2);
|
||||
sin[i] = -Math.sin(n / numSteps * Math.PI * 2);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||
List<PParticle> particles = new ArrayList<PParticle>();
|
||||
for (int i = 0; i < orbs; i++) {
|
||||
double dx = cos[(stepX + (numSteps / orbs * i)) % numSteps];
|
||||
double dy = (stepY / (double)maxStepY);
|
||||
double dz = sin[(stepX + (numSteps / orbs * i)) % numSteps];
|
||||
particles.add(new PParticle(location.clone().add(dx, dy, dz)));
|
||||
}
|
||||
return particles;
|
||||
}
|
||||
|
||||
public void updateTimers() {
|
||||
stepX++;
|
||||
if (stepX > numSteps) {
|
||||
stepX = 0;
|
||||
}
|
||||
|
||||
if (reverse) {
|
||||
stepY++;
|
||||
if (stepY > maxStepY) reverse = false;
|
||||
} else {
|
||||
stepY--;
|
||||
if (stepY < -maxStepY) reverse = true;
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "twins";
|
||||
}
|
||||
|
||||
public boolean canBeFixed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canToggleWithMovement() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public double getFixedEffectOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -344,6 +344,9 @@ gui-icon:
|
|||
- GLOWSTONE
|
||||
point:
|
||||
- STONE_BUTTON
|
||||
popper:
|
||||
- POPPED_CHORUS_FRUIT
|
||||
- CHORUS_FRUIT_POPPED
|
||||
pulse:
|
||||
- REDSTONE_TORCH
|
||||
- REDSTONE_TORCH_ON
|
||||
|
@ -364,6 +367,9 @@ gui-icon:
|
|||
thick:
|
||||
- COBWEB
|
||||
- WEB
|
||||
twins:
|
||||
- OAK_FENCE
|
||||
- FENCE
|
||||
vortex:
|
||||
- GLOWSTONE_DUST
|
||||
whirl:
|
||||
|
|
Loading…
Reference in a new issue