From 99211d5d8947e9668052500d48155ebd6a5e2f1a Mon Sep 17 00:00:00 2001 From: samczsun Date: Fri, 23 Dec 2016 21:13:58 -0500 Subject: [PATCH] Fix particles --- .../src/mineplex/core/common/util/UtilParticle.java | 9 +++++++++ .../src/nautilus/game/arcade/game/Game.java | 12 ------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java index 1444f7d43..0945ad7fd 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java @@ -7,6 +7,7 @@ import net.minecraft.server.v1_8_R3.EnumParticle; import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles; import org.bukkit.Color; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -272,6 +273,8 @@ public class UtilParticle public static void playParticleFor(Player player, ParticleType type, Location location, Vector offset, float speed, int count, ViewDist dist) { + if (player.getGameMode() == GameMode.SPECTATOR) + return; float x = 0; float y = 0; float z = 0; @@ -289,6 +292,8 @@ public class UtilParticle public static void playParticleFor(Player player, ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, ViewDist dist) { + if (player.getGameMode() == GameMode.SPECTATOR) + return; List players = new ArrayList<>(UtilServer.getPlayersCollection()); players.removeIf(other -> !other.canSee(player)); PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count, dist, players.toArray(new Player[0])); @@ -296,6 +301,8 @@ public class UtilParticle public static void playParticleFor(Player player, String particle, Location location, Vector offset, float speed, int count, ViewDist dist) { + if (player.getGameMode() == GameMode.SPECTATOR) + return; float x = 0; float y = 0; float z = 0; @@ -313,6 +320,8 @@ public class UtilParticle public static void playParticleFor(Player player, String particle, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, ViewDist dist) { + if (player.getGameMode() == GameMode.SPECTATOR) + return; List players = new ArrayList<>(UtilServer.getPlayersCollection()); players.removeIf(other -> !other.canSee(player)); PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, players.toArray(new Player[0])); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index c008a6ae6..17e88e026 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -1884,18 +1884,6 @@ public abstract class Game extends ListenerComponent implements Lifetimed SetState(GameState.End); } - @EventHandler - public void disableParticles(GameStateChangeEvent event) - { - if (event.GetState() == GameState.Prepare && Manager.getCosmeticManager().getGadgetManager().hideParticles()) - { - for (Player player : GetPlayers(false)) - { - getArcadeManager().getCosmeticManager().getGadgetManager().removeGadgetType(player, GadgetType.PARTICLE); - } - } - } - @EventHandler public void onGameStart(GameStateChangeEvent event) {