diff --git a/changelog.txt b/changelog.txt index f4b6cf8..0d15506 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ == UPDATING WILL DELETE YOUR CONFIG.YML == * Create a backup of your config.yml if you wish to import all your old settings! +=== v6.0 === +* Many other changes, the changelog will be updated once the plugin update is about to be released ++ Added setting in config.yml to control how fast the rainbow hue cycles === v5.2 === * Added native support for Minecraft 1.13.x * Still compatible with Minecraft 1.9 through Minecraft 1.12! diff --git a/src/com/esophose/playerparticles/PlayerParticles.java b/src/com/esophose/playerparticles/PlayerParticles.java index ca12f48..b43ad56 100644 --- a/src/com/esophose/playerparticles/PlayerParticles.java +++ b/src/com/esophose/playerparticles/PlayerParticles.java @@ -2,7 +2,7 @@ * TODO: v6.0 * + Add new style 'tornado' * + Add new style 'doubleorbit' - * + Add new style 'wings_', multiple new wing types + * + Add new style 'wings_', multiple new wing types: fairy, demon * * Adjust style positioning around central point based on if they are being spawned for a player or fixed effect * * Display a note in the GUI under event-based styles * diff --git a/src/com/esophose/playerparticles/manager/ParticleManager.java b/src/com/esophose/playerparticles/manager/ParticleManager.java index ab3700b..db18fd4 100644 --- a/src/com/esophose/playerparticles/manager/ParticleManager.java +++ b/src/com/esophose/playerparticles/manager/ParticleManager.java @@ -91,10 +91,10 @@ public class ParticleManager extends BukkitRunnable implements Listener { public void run() { ParticleStyleManager.updateTimers(); - hue++; + hue += PSetting.RAINBOW_CYCLE_SPEED.getInt(); hue %= 360; - if (hue % 5 == 0) { // Only increment note by 4 notes per second + if (hue % 4 == 0) { // Only increment note by 5 notes per second note++; note %= 25; } diff --git a/src/com/esophose/playerparticles/manager/SettingManager.java b/src/com/esophose/playerparticles/manager/SettingManager.java index 5ef77ff..9f0ace2 100644 --- a/src/com/esophose/playerparticles/manager/SettingManager.java +++ b/src/com/esophose/playerparticles/manager/SettingManager.java @@ -55,6 +55,8 @@ public class SettingManager { MAX_GROUPS(PSettingType.INTEGER), + RAINBOW_CYCLE_SPEED(PSettingType.INTEGER), + DISABLED_WORLDS(PSettingType.STRING_LIST), LANG_FILE(PSettingType.STRING); diff --git a/src/com/esophose/playerparticles/styles/DefaultStyles.java b/src/com/esophose/playerparticles/styles/DefaultStyles.java index 3cc6d60..4e89002 100644 --- a/src/com/esophose/playerparticles/styles/DefaultStyles.java +++ b/src/com/esophose/playerparticles/styles/DefaultStyles.java @@ -20,6 +20,7 @@ public class DefaultStyles { public static final ParticleStyle BLOCKBREAK = new ParticleStyleBlockBreak(); public static final ParticleStyle BLOCKEDIT = new ParticleStyleBlockEdit(); public static final ParticleStyle BLOCKPLACE = new ParticleStyleBlockPlace(); + public static final ParticleStyle CELEBRATION = new ParticleStyleCelebration(); public static final ParticleStyle CHAINS = new ParticleStyleChains(); public static final ParticleStyle COMPANION = new ParticleStyleCompanion(); public static final ParticleStyle CUBE = new ParticleStyleCube(); @@ -53,6 +54,7 @@ public class DefaultStyles { ParticleStyleManager.registerCustomHandledStyle(BLOCKBREAK); ParticleStyleManager.registerCustomHandledStyle(BLOCKEDIT); ParticleStyleManager.registerCustomHandledStyle(BLOCKPLACE); + ParticleStyleManager.registerStyle(CELEBRATION); ParticleStyleManager.registerStyle(CHAINS); ParticleStyleManager.registerStyle(COMPANION); ParticleStyleManager.registerStyle(CUBE); diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleCelebration.java b/src/com/esophose/playerparticles/styles/ParticleStyleCelebration.java new file mode 100644 index 0000000..38168c0 --- /dev/null +++ b/src/com/esophose/playerparticles/styles/ParticleStyleCelebration.java @@ -0,0 +1,104 @@ +package com.esophose.playerparticles.styles; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Random; + +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.particles.PPlayer; +import com.esophose.playerparticles.particles.ParticleEffect; +import com.esophose.playerparticles.particles.ParticlePair; +import com.esophose.playerparticles.styles.api.PParticle; +import com.esophose.playerparticles.styles.api.ParticleStyle; + +public class ParticleStyleCelebration implements ParticleStyle { + + private int step = 0; + private final int spawnTime = 15; + + public List getParticles(ParticlePair particle, Location location) { + return null; + } + + /** + * Spawns fireworks every spawnTime number of ticks + * This style uses two different effects, one is always 'firework' + */ + public void updateTimers() { + step++; + if (step == spawnTime) { + step = 0; + + final Random random = new Random(); + for (PPlayer pplayer : ParticleManager.getPPlayers()) { + final Player player = pplayer.getPlayer(); + + for (ParticlePair particle : pplayer.getActiveParticles()) { + if (particle.getStyle() != this) continue; + + double angle = random.nextDouble() * Math.PI * 2; + double distanceFrom = 1.25 + random.nextDouble() * 1.5; + double dx = Math.sin(angle) * distanceFrom; + double dz = Math.cos(angle) * distanceFrom; + final Location loc = player.getLocation().clone().add(dx, 1, dz); + final int fuse = 3 + random.nextInt(3); + + new BukkitRunnable() { + private Location location = loc; + private int fuseLength = fuse; + private int fuseTimer = 0; + + public void run() { + if (this.fuseTimer < this.fuseLength) { + ParticlePair trail = ParticlePair.getNextDefault(pplayer); + trail.setEffect(ParticleEffect.FIREWORK); + trail.setStyle(DefaultStyles.CELEBRATION); + + ParticleManager.displayParticles(trail, Collections.singletonList(new PParticle(this.location))); + + this.location.add(0, 0.25, 0); + } else { + List particles = new ArrayList(); + for (int i = 0; i < 40; i++) { // Copied directly from PlayerParticles source + double radius = 0.6 + random.nextDouble() * 0.2; + double u = random.nextDouble(); + double v = random.nextDouble(); + double theta = 2 * Math.PI * u; + double phi = Math.acos(2 * v - 1); + double dx = radius * Math.sin(phi) * Math.cos(theta); + double dy = radius * Math.sin(phi) * Math.sin(theta); + double dz = radius * Math.cos(phi); + + particles.add(new PParticle(this.location.clone().add(dx, dy, dz))); + } + ParticleManager.displayParticles(particle, particles); + + this.cancel(); + } + this.fuseTimer++; + } + }.runTaskTimer(PlayerParticles.getPlugin(), 0, 1); + } + } + } + } + + public String getName() { + return "celebration"; + } + + public boolean canBeFixed() { + return true; + } + + public boolean canToggleWithMovement() { + return true; + } + +} diff --git a/src/config.yml b/src/config.yml index d894130..130405a 100644 --- a/src/config.yml +++ b/src/config.yml @@ -90,6 +90,12 @@ particle-render-range-player: 48 # Default: 192 particle-render-range-fixed-effect: 192 +# How many out of 360 hue ticks to move per game tick +# Higher values make the rainbow cycle faster +# Note: Must be positive whole numbers +# Default: 2 +rainbow-cycle-speed: 2 + # ================================================================ # # DATABASE CONFIGURATION # # Information: #