From 46f51072703e8c76c043b413af9d476bdc691c22 Mon Sep 17 00:00:00 2001 From: Esophose Date: Fri, 16 Nov 2018 03:26:08 -0700 Subject: [PATCH] Add new setting 'toggle-on-move', change version to v6.0 --- pom.xml | 12 ++-- .../playerparticles/PlayerParticles.java | 10 ++- .../manager/ParticleManager.java | 19 ++++-- .../manager/SettingManager.java | 1 + .../playerparticles/particles/PPlayer.java | 20 ++++++ .../particles/PPlayerMovementListener.java | 68 +++++++++++++++++++ .../styles/ParticleStyleArrows.java | 7 +- .../styles/ParticleStyleBatman.java | 4 ++ .../styles/ParticleStyleBeam.java | 4 ++ .../styles/ParticleStyleBlockBreak.java | 4 ++ .../styles/ParticleStyleBlockEdit.java | 4 ++ .../styles/ParticleStyleBlockPlace.java | 4 ++ .../styles/ParticleStyleChains.java | 4 ++ .../styles/ParticleStyleCompanion.java | 4 ++ .../styles/ParticleStyleCube.java | 4 ++ .../styles/ParticleStyleFeet.java | 4 ++ .../styles/ParticleStyleHalo.java | 4 ++ .../styles/ParticleStyleHurt.java | 4 ++ .../styles/ParticleStyleInvocation.java | 4 ++ .../styles/ParticleStyleMove.java | 4 ++ .../styles/ParticleStyleNormal.java | 4 ++ .../styles/ParticleStyleOrbit.java | 4 ++ .../styles/ParticleStyleOverhead.java | 4 ++ .../styles/ParticleStylePoint.java | 4 ++ .../styles/ParticleStyleQuadhelix.java | 4 ++ .../styles/ParticleStyleRings.java | 4 ++ .../styles/ParticleStyleSphere.java | 4 ++ .../styles/ParticleStyleSpin.java | 4 ++ .../styles/ParticleStyleSpiral.java | 4 ++ .../styles/ParticleStyleSwords.java | 4 ++ .../styles/ParticleStyleThick.java | 4 ++ .../styles/ParticleStyleVortex.java | 4 ++ .../styles/ParticleStyleWings.java | 4 ++ .../styles/api/ParticleStyle.java | 6 ++ src/config.yml | 20 ++++-- src/plugin.yml | 2 +- 36 files changed, 246 insertions(+), 23 deletions(-) create mode 100644 src/com/esophose/playerparticles/particles/PPlayerMovementListener.java diff --git a/pom.xml b/pom.xml index fc2d8bc..b76fed9 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.esophose.playerparticles PlayerParticles - 5.3 + 6.0 PlayerParticles https://github.com/Esophose/PlayerParticles Display particles around your player using customized styles and data! @@ -54,7 +54,7 @@ - C:\Users\Esophose\Desktop\Spigot Dev Servers\1.13\plugins\update\PlayerParticles v5.3.jar + C:\Users\Esophose\Desktop\Spigot Dev Servers\1.13\plugins\update\PlayerParticles v6.0.jar @@ -81,7 +81,7 @@ - C:\Users\Esophose\Desktop\Spigot Dev Servers\1.12\plugins\update\PlayerParticles v5.3.jar + C:\Users\Esophose\Desktop\Spigot Dev Servers\1.12\plugins\update\PlayerParticles v6.0.jar @@ -108,7 +108,7 @@ - C:\Users\Esophose\Desktop\Spigot Dev Servers\1.11\plugins\update\PlayerParticles v5.3.jar + C:\Users\Esophose\Desktop\Spigot Dev Servers\1.11\plugins\update\PlayerParticles v6.0.jar @@ -135,7 +135,7 @@ - C:\Users\Esophose\Desktop\Spigot Dev Servers\1.10\plugins\update\PlayerParticles v5.3.jar + C:\Users\Esophose\Desktop\Spigot Dev Servers\1.10\plugins\update\PlayerParticles v6.0.jar @@ -162,7 +162,7 @@ - C:\Users\Esophose\Desktop\Spigot Dev Servers\1.9\plugins\update\PlayerParticles v5.3.jar + C:\Users\Esophose\Desktop\Spigot Dev Servers\1.9\plugins\update\PlayerParticles v6.0.jar diff --git a/src/com/esophose/playerparticles/PlayerParticles.java b/src/com/esophose/playerparticles/PlayerParticles.java index 6984617..7148037 100644 --- a/src/com/esophose/playerparticles/PlayerParticles.java +++ b/src/com/esophose/playerparticles/PlayerParticles.java @@ -1,9 +1,11 @@ /* - * TODO: v5.3 (actually v6) + * TODO: v6.0 * + Add new style 'tornado' * + Add new style 'doubleorbit' - * * Adjust PParticles to use a Vector instead of a Location - * * Setting in config.yml to make non-event styles display particles using DefaultStyles.FEET while the player is moving + * * Adjust style positioning around central point based on if they are being spawned for a player or fixed effect + * * Write a class called ConfigManager which manages updating the config.yml between versions so it doesn't have to be deleted every time + * * Clean up the '/pp help' menu and command descriptions so each command fits on one line + * * Display a note in the GUI under event-based styles */ package com.esophose.playerparticles; @@ -25,6 +27,7 @@ import com.esophose.playerparticles.manager.LangManager; import com.esophose.playerparticles.manager.ParticleManager; import com.esophose.playerparticles.manager.SettingManager; import com.esophose.playerparticles.manager.SettingManager.PSetting; +import com.esophose.playerparticles.particles.PPlayerMovementListener; import com.esophose.playerparticles.particles.ParticleGroup; import com.esophose.playerparticles.styles.DefaultStyles; import com.esophose.playerparticles.updater.PluginUpdateListener; @@ -62,6 +65,7 @@ public class PlayerParticles extends JavaPlugin { Bukkit.getPluginManager().registerEvents(new ParticleManager(), this); Bukkit.getPluginManager().registerEvents(new PluginUpdateListener(), this); Bukkit.getPluginManager().registerEvents(new GuiHandler(), this); + Bukkit.getPluginManager().registerEvents(new PPlayerMovementListener(), this); saveDefaultConfig(); double configVersion = PSetting.VERSION.getDouble(); diff --git a/src/com/esophose/playerparticles/manager/ParticleManager.java b/src/com/esophose/playerparticles/manager/ParticleManager.java index e86f614..ab3700b 100644 --- a/src/com/esophose/playerparticles/manager/ParticleManager.java +++ b/src/com/esophose/playerparticles/manager/ParticleManager.java @@ -16,12 +16,14 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.scheduler.BukkitRunnable; +import com.esophose.playerparticles.manager.SettingManager.PSetting; import com.esophose.playerparticles.particles.FixedParticleEffect; import com.esophose.playerparticles.particles.PPlayer; import com.esophose.playerparticles.particles.ParticleEffect; import com.esophose.playerparticles.particles.ParticleEffect.NoteColor; import com.esophose.playerparticles.particles.ParticleEffect.OrdinaryColor; import com.esophose.playerparticles.particles.ParticlePair; +import com.esophose.playerparticles.styles.DefaultStyles; import com.esophose.playerparticles.styles.api.PParticle; import com.esophose.playerparticles.styles.api.ParticleStyleManager; @@ -106,7 +108,7 @@ public class ParticleManager extends BukkitRunnable implements Listener { // Don't spawn particles if the world doesn't allow it if (player != null && player.getGameMode() != GameMode.SPECTATOR && !PermissionManager.isWorldDisabled(player.getWorld().getName())) for (ParticlePair particles : pplayer.getActiveParticles()) - displayParticles(particles, player.getLocation().clone().add(0, 1, 0)); + displayParticles(pplayer, particles, player.getLocation().clone().add(0, 1, 0)); // Loop for FixedParticleEffects // Don't spawn particles if the world doesn't allow it @@ -119,13 +121,20 @@ public class ParticleManager extends BukkitRunnable implements Listener { /** * Displays particles at the given player location with their settings * + * @param pplayer The PPlayer to spawn the particles for * @param particle The ParticlePair to use for getting particle settings * @param location The location to display at */ - private void displayParticles(ParticlePair particle, Location location) { - if (!ParticleStyleManager.isCustomHandled(particle.getStyle())) - for (PParticle pparticle : particle.getStyle().getParticles(particle, location)) - ParticleEffect.display(particle, pparticle, false); + private void displayParticles(PPlayer pplayer, ParticlePair particle, Location location) { + if (!ParticleStyleManager.isCustomHandled(particle.getStyle())) { + if (PSetting.TOGGLE_ON_MOVE.getBoolean() && particle.getStyle().canToggleWithMovement() && pplayer.isMoving()) { + for (PParticle pparticle : DefaultStyles.FEET.getParticles(particle, location)) + ParticleEffect.display(particle, pparticle, false); + } else { + for (PParticle pparticle : particle.getStyle().getParticles(particle, location)) + ParticleEffect.display(particle, pparticle, false); + } + } } /** diff --git a/src/com/esophose/playerparticles/manager/SettingManager.java b/src/com/esophose/playerparticles/manager/SettingManager.java index 1a788bc..5ef77ff 100644 --- a/src/com/esophose/playerparticles/manager/SettingManager.java +++ b/src/com/esophose/playerparticles/manager/SettingManager.java @@ -32,6 +32,7 @@ public class SettingManager { TICKS_PER_PARTICLE(PSettingType.LONG), CHECK_UPDATES(PSettingType.BOOLEAN), GUI_ENABLED(PSettingType.BOOLEAN), + TOGGLE_ON_MOVE(PSettingType.BOOLEAN), PARTICLE_RENDER_RANGE_PLAYER(PSettingType.INTEGER), PARTICLE_RENDER_RANGE_FIXED_EFFECT(PSettingType.INTEGER), diff --git a/src/com/esophose/playerparticles/particles/PPlayer.java b/src/com/esophose/playerparticles/particles/PPlayer.java index 4e3ad65..2d68198 100644 --- a/src/com/esophose/playerparticles/particles/PPlayer.java +++ b/src/com/esophose/playerparticles/particles/PPlayer.java @@ -31,6 +31,11 @@ public class PPlayer { * If True, the player will not see any particles spawned by the plugin */ private boolean particlesHidden; + + /** + * If the player is moving + */ + private boolean isMoving; /** * Constructs a new PPlayer @@ -44,7 +49,9 @@ public class PPlayer { this.playerUUID = uuid; this.particleGroups = particleGroups; this.fixedParticles = fixedParticles; + this.particlesHidden = particlesHidden; + this.isMoving = false; } /** @@ -91,6 +98,19 @@ public class PPlayer { public List getParticleGroups() { return this.particleGroups; } + + /** + * Sets the player's movement state + * + * @param isMoving True if the player is moving, otherwise false if they are standing still + */ + public void setMoving(boolean isMoving) { + this.isMoving = isMoving; + } + + public boolean isMoving() { + return this.isMoving; + } /** * Gets a ParticleGroup this player has by its name diff --git a/src/com/esophose/playerparticles/particles/PPlayerMovementListener.java b/src/com/esophose/playerparticles/particles/PPlayerMovementListener.java new file mode 100644 index 0000000..21cfa31 --- /dev/null +++ b/src/com/esophose/playerparticles/particles/PPlayerMovementListener.java @@ -0,0 +1,68 @@ +package com.esophose.playerparticles.particles; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.scheduler.BukkitRunnable; + +import com.esophose.playerparticles.PlayerParticles; +import com.esophose.playerparticles.manager.DataManager; +import com.esophose.playerparticles.manager.SettingManager.PSetting; + +public class PPlayerMovementListener implements Listener { + + private static Map timeSinceLastMovement = new HashMap(); + private static final int STANDING_TIME = 9; + private static final int CHECK_INTERVAL = 3; + + public PPlayerMovementListener() { + new BukkitRunnable() { + public void run() { + if (!PSetting.TOGGLE_ON_MOVE.getBoolean()) return; + + List toRemove = new ArrayList(); + + for (UUID uuid : timeSinceLastMovement.keySet()) { + PPlayer pplayer = DataManager.getPPlayer(uuid); + if (pplayer == null) { + toRemove.add(uuid); + } else { + int standingTime = timeSinceLastMovement.get(uuid); + pplayer.setMoving(standingTime < STANDING_TIME); + if (standingTime < STANDING_TIME) + timeSinceLastMovement.replace(uuid, standingTime + CHECK_INTERVAL); + } + } + + for (UUID uuid : toRemove) + timeSinceLastMovement.remove(uuid); + } + }.runTaskTimer(PlayerParticles.getPlugin(), 0, CHECK_INTERVAL); + } + + /** + * Used to detect if the player is moving + * + * @param event The event + */ + @EventHandler(priority = EventPriority.MONITOR) + public void onPlayerMove(PlayerMoveEvent event) { + if (!PSetting.TOGGLE_ON_MOVE.getBoolean()) return; + if (event.getTo().getBlockX() == event.getFrom().getBlockX() && event.getTo().getBlockY() == event.getFrom().getBlockY() && event.getTo().getBlockZ() == event.getFrom().getBlockZ()) return; + + UUID playerUUID = event.getPlayer().getUniqueId(); + if (!timeSinceLastMovement.containsKey(playerUUID)) { + timeSinceLastMovement.put(playerUUID, 0); + } else { + timeSinceLastMovement.replace(playerUUID, 0); + } + } + +} diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleArrows.java b/src/com/esophose/playerparticles/styles/ParticleStyleArrows.java index 8ad92a0..66702d6 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleArrows.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleArrows.java @@ -49,6 +49,10 @@ public class ParticleStyleArrows implements ParticleStyle, Listener { public boolean canBeFixed() { return false; } + + public boolean canToggleWithMovement() { + return false; + } /** * The event used to get all arrows fired by players @@ -68,7 +72,8 @@ public class ParticleStyleArrows implements ParticleStyle, Listener { } } - if (match) arrows.add((Arrow) e.getProjectile()); + if (match) + arrows.add((Arrow) e.getProjectile()); } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleBatman.java b/src/com/esophose/playerparticles/styles/ParticleStyleBatman.java index bfdf44e..e6c1e60 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleBatman.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleBatman.java @@ -120,5 +120,9 @@ public class ParticleStyleBatman implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleBeam.java b/src/com/esophose/playerparticles/styles/ParticleStyleBeam.java index 4065c65..ea265cb 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleBeam.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleBeam.java @@ -58,5 +58,9 @@ public class ParticleStyleBeam implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleBlockBreak.java b/src/com/esophose/playerparticles/styles/ParticleStyleBlockBreak.java index 48691b0..6ec917c 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleBlockBreak.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleBlockBreak.java @@ -41,6 +41,10 @@ public class ParticleStyleBlockBreak implements ParticleStyle, Listener { public boolean canBeFixed() { return false; } + + public boolean canToggleWithMovement() { + return false; + } @EventHandler(priority = EventPriority.MONITOR) public void onBlockBreak(BlockBreakEvent event) { diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleBlockEdit.java b/src/com/esophose/playerparticles/styles/ParticleStyleBlockEdit.java index f320a3f..6dee914 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleBlockEdit.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleBlockEdit.java @@ -35,6 +35,10 @@ public class ParticleStyleBlockEdit implements ParticleStyle, Listener { public boolean canBeFixed() { return false; } + + public boolean canToggleWithMovement() { + return false; + } @EventHandler(priority = EventPriority.MONITOR) public void onBlockBreak(BlockBreakEvent event) { diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleBlockPlace.java b/src/com/esophose/playerparticles/styles/ParticleStyleBlockPlace.java index 4595ec0..405dc3f 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleBlockPlace.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleBlockPlace.java @@ -41,6 +41,10 @@ public class ParticleStyleBlockPlace implements ParticleStyle, Listener { public boolean canBeFixed() { return false; } + + public boolean canToggleWithMovement() { + return false; + } @EventHandler(priority = EventPriority.MONITOR) public void onBlockPlace(BlockPlaceEvent event) { diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleChains.java b/src/com/esophose/playerparticles/styles/ParticleStyleChains.java index 45181e0..f8994f7 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleChains.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleChains.java @@ -35,5 +35,9 @@ public class ParticleStyleChains implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleCompanion.java b/src/com/esophose/playerparticles/styles/ParticleStyleCompanion.java index 92116af..c83abce 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleCompanion.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleCompanion.java @@ -73,5 +73,9 @@ public class ParticleStyleCompanion implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return false; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleCube.java b/src/com/esophose/playerparticles/styles/ParticleStyleCube.java index 27fda78..68986f3 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleCube.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleCube.java @@ -98,5 +98,9 @@ public class ParticleStyleCube implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleFeet.java b/src/com/esophose/playerparticles/styles/ParticleStyleFeet.java index ac30ed5..00918af 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleFeet.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleFeet.java @@ -28,5 +28,9 @@ public class ParticleStyleFeet implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return false; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleHalo.java b/src/com/esophose/playerparticles/styles/ParticleStyleHalo.java index 96f2cc3..ae34449 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleHalo.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleHalo.java @@ -56,5 +56,9 @@ public class ParticleStyleHalo implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return false; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleHurt.java b/src/com/esophose/playerparticles/styles/ParticleStyleHurt.java index 114c5f0..4c250f4 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleHurt.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleHurt.java @@ -42,6 +42,10 @@ public class ParticleStyleHurt implements ParticleStyle, Listener { public boolean canBeFixed() { return false; } + + public boolean canToggleWithMovement() { + return false; + } @EventHandler(priority = EventPriority.MONITOR) public void onEntityDamage(EntityDamageEvent event) { diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleInvocation.java b/src/com/esophose/playerparticles/styles/ParticleStyleInvocation.java index 2dfb5c1..d77025c 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleInvocation.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleInvocation.java @@ -98,5 +98,9 @@ public class ParticleStyleInvocation implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleMove.java b/src/com/esophose/playerparticles/styles/ParticleStyleMove.java index c564c57..aeb2125 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleMove.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleMove.java @@ -32,6 +32,10 @@ public class ParticleStyleMove implements ParticleStyle, Listener { public boolean canBeFixed() { return false; } + + public boolean canToggleWithMovement() { + return false; + } @EventHandler(priority = EventPriority.MONITOR) public void onPlayerMove(PlayerMoveEvent e) { diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleNormal.java b/src/com/esophose/playerparticles/styles/ParticleStyleNormal.java index fb4e9e1..24a840b 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleNormal.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleNormal.java @@ -138,5 +138,9 @@ public class ParticleStyleNormal implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return false; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleOrbit.java b/src/com/esophose/playerparticles/styles/ParticleStyleOrbit.java index ff8b3c5..75287a5 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleOrbit.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleOrbit.java @@ -52,5 +52,9 @@ public class ParticleStyleOrbit implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleOverhead.java b/src/com/esophose/playerparticles/styles/ParticleStyleOverhead.java index 4fd41f3..ff42608 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleOverhead.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleOverhead.java @@ -29,5 +29,9 @@ public class ParticleStyleOverhead implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return false; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStylePoint.java b/src/com/esophose/playerparticles/styles/ParticleStylePoint.java index e275a7e..709c7a8 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStylePoint.java +++ b/src/com/esophose/playerparticles/styles/ParticleStylePoint.java @@ -26,5 +26,9 @@ public class ParticleStylePoint implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return false; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleQuadhelix.java b/src/com/esophose/playerparticles/styles/ParticleStyleQuadhelix.java index bcf75ad..2769b05 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleQuadhelix.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleQuadhelix.java @@ -64,5 +64,9 @@ public class ParticleStyleQuadhelix implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleRings.java b/src/com/esophose/playerparticles/styles/ParticleStyleRings.java index 6759872..f3c8493 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleRings.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleRings.java @@ -58,5 +58,9 @@ public class ParticleStyleRings implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleSphere.java b/src/com/esophose/playerparticles/styles/ParticleStyleSphere.java index b58e4a7..e275def 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleSphere.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleSphere.java @@ -41,5 +41,9 @@ public class ParticleStyleSphere implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleSpin.java b/src/com/esophose/playerparticles/styles/ParticleStyleSpin.java index 92e9f1c..b6c8396 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleSpin.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleSpin.java @@ -46,5 +46,9 @@ public class ParticleStyleSpin implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleSpiral.java b/src/com/esophose/playerparticles/styles/ParticleStyleSpiral.java index 65afd55..eef8733 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleSpiral.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleSpiral.java @@ -35,5 +35,9 @@ public class ParticleStyleSpiral implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleSwords.java b/src/com/esophose/playerparticles/styles/ParticleStyleSwords.java index 6376afb..53da8e0 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleSwords.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleSwords.java @@ -51,6 +51,10 @@ public class ParticleStyleSwords implements ParticleStyle, Listener { public boolean canBeFixed() { return false; } + + public boolean canToggleWithMovement() { + return false; + } @EventHandler(priority = EventPriority.MONITOR) public void onEntityDamageEntity(EntityDamageByEntityEvent event) { diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleThick.java b/src/com/esophose/playerparticles/styles/ParticleStyleThick.java index a240828..814c87f 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleThick.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleThick.java @@ -34,5 +34,9 @@ public class ParticleStyleThick implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleVortex.java b/src/com/esophose/playerparticles/styles/ParticleStyleVortex.java index 61b3b19..ca83486 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleVortex.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleVortex.java @@ -66,5 +66,9 @@ public class ParticleStyleVortex implements ParticleStyle { public boolean canBeFixed() { return true; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/ParticleStyleWings.java b/src/com/esophose/playerparticles/styles/ParticleStyleWings.java index b64ffb4..887a8f2 100644 --- a/src/com/esophose/playerparticles/styles/ParticleStyleWings.java +++ b/src/com/esophose/playerparticles/styles/ParticleStyleWings.java @@ -40,5 +40,9 @@ public class ParticleStyleWings implements ParticleStyle { public boolean canBeFixed() { return false; } + + public boolean canToggleWithMovement() { + return true; + } } diff --git a/src/com/esophose/playerparticles/styles/api/ParticleStyle.java b/src/com/esophose/playerparticles/styles/api/ParticleStyle.java index 0c73e9e..8261aea 100644 --- a/src/com/esophose/playerparticles/styles/api/ParticleStyle.java +++ b/src/com/esophose/playerparticles/styles/api/ParticleStyle.java @@ -36,6 +36,12 @@ public interface ParticleStyle { */ public boolean canBeFixed(); + /** + * Gets if the style can be replaced with DefaultStyles.FEET when the player is moving + * + * @return True if it can be, otherwise False + */ + public boolean canToggleWithMovement(); /** * Gets the ParticleStyle with the name given, returns null if not found diff --git a/src/config.yml b/src/config.yml index 8e1e47e..d894130 100644 --- a/src/config.yml +++ b/src/config.yml @@ -1,8 +1,8 @@ # __________ __ __________ __ __ __ ________ -# \______ \ | _____ ___ __ __________\______ \_____ ________/ |_|__| ____ | | ____ ______ ___ _| ____/ -# | ___/ | \__ \< | |/ __ \_ __ \ ___/\__ \\_ __ \ __\ |/ ___\| | _/ __ \ / ___/ \ \/ /____ \ -# | | | |__/ __ \\___ \ ___/| | \/ | / __ \| | \/| | | \ \___| |_\ ___/ \___ \ \ // \ -# |____| |____(____ / ____|\___ >__| |____| (____ /__| |__| |__|\___ >____/\___ >____ > \_//______ / +# \______ \ | _____ ___ __ __________\______ \_____ ________/ |_|__| ____ | | ____ ______ ___ __/ _____/ +# | ___/ | \__ \< | |/ __ \_ __ \ ___/\__ \\_ __ \ __\ |/ ___\| | _/ __ \ / ___/ \ \/ / __ \ +# | | | |__/ __ \\___ \ ___/| | \/ | / __ \| | \/| | | \ \___| |_\ ___/ \___ \ \ /\ |__\ \ +# |____| |____(____ / ____|\___ >__| |____| (____ /__| |__| |__|\___ >____/\___ >____ > \_/ \_____ / # \/\/ \/ \/ \/ \/ \/ \/ # ==================================================== # @@ -11,9 +11,9 @@ # ==================================================== # # This value is the version of the plugin that last modified the config file -# Changing this value will reset your config on the next server reload / restart. -# I don't recommend changing it -version: 5.3 +# Changing this value manually will likely result in data loss and errors! +# Do not change this manually unless specifically told to by the plugin author +version: 6.0 # Check for new versions of the plugin # Default: true @@ -41,6 +41,12 @@ message-prefix: '&7[&3PlayerParticles&7]' # Default: true gui-enabled: true +# If true, styles will not display while the player is moving +# They will instead have the effect displayed at their feet +# Note: Not all styles abide by this rule, but most will +# Default: false +toggle-on-move: false + # The worlds which this plugin is disabled in # Remove the [] before you enter world names # Default: [] diff --git a/src/plugin.yml b/src/plugin.yml index 95de435..933d031 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: PlayerParticles main: com.esophose.playerparticles.PlayerParticles -version: 5.3 +version: 6.0 api-version: 1.13 description: Display particles around your player using customized styles and data! author: Esophose