Fix particles

This commit is contained in:
samczsun 2016-12-23 21:13:58 -05:00 committed by cnr
parent cb13fb1ccc
commit 99211d5d89
2 changed files with 9 additions and 12 deletions

View File

@ -7,6 +7,7 @@ import net.minecraft.server.v1_8_R3.EnumParticle;
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles; import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; 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) 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 x = 0;
float y = 0; float y = 0;
float z = 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, public static void playParticleFor(Player player, ParticleType type, Location location, float offsetX, float offsetY, float offsetZ,
float speed, int count, ViewDist dist) float speed, int count, ViewDist dist)
{ {
if (player.getGameMode() == GameMode.SPECTATOR)
return;
List<Player> players = new ArrayList<>(UtilServer.getPlayersCollection()); List<Player> players = new ArrayList<>(UtilServer.getPlayersCollection());
players.removeIf(other -> !other.canSee(player)); players.removeIf(other -> !other.canSee(player));
PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count, dist, players.toArray(new Player[0])); 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) 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 x = 0;
float y = 0; float y = 0;
float z = 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, public static void playParticleFor(Player player, String particle, Location location, float offsetX, float offsetY, float offsetZ,
float speed, int count, ViewDist dist) float speed, int count, ViewDist dist)
{ {
if (player.getGameMode() == GameMode.SPECTATOR)
return;
List<Player> players = new ArrayList<>(UtilServer.getPlayersCollection()); List<Player> players = new ArrayList<>(UtilServer.getPlayersCollection());
players.removeIf(other -> !other.canSee(player)); players.removeIf(other -> !other.canSee(player));
PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, players.toArray(new Player[0])); PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, players.toArray(new Player[0]));

View File

@ -1884,18 +1884,6 @@ public abstract class Game extends ListenerComponent implements Lifetimed
SetState(GameState.End); 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 @EventHandler
public void onGameStart(GameStateChangeEvent event) public void onGameStart(GameStateChangeEvent event)
{ {