Class ParticleEffect.ParticlePacket
- java.lang.Object
-
- com.massivecraft.factions.util.Particles.ParticleEffect.ParticlePacket
-
- Enclosing class:
- ParticleEffect
public static final class ParticleEffect.ParticlePacket extends java.lang.ObjectRepresents a particle effect packet with all attributes which is used for sending packets to the playersThis class is part of the ParticleEffect Library and follows the same usage conditions
- Since:
- 1.5
-
-
Constructor Summary
Constructors Constructor Description ParticlePacket(ParticleEffect effect, float offsetX, float offsetY, float offsetZ, float speed, int amount, boolean longDistance, ParticleEffect.ParticleData data)Construct a new particle packetParticlePacket(ParticleEffect effect, ParticleEffect.ParticleColor color, boolean longDistance)Construct a new particle packet of a single colored particleParticlePacket(ParticleEffect effect, org.bukkit.util.Vector direction, float speed, boolean longDistance, ParticleEffect.ParticleData data)Construct a new particle packet of a single particle flying into a determined direction
-
Method Summary
Modifier and Type Method Description static intgetVersion()Returns the version of your server (1.x)static voidinitialize()InitializespacketConstructor,getHandle,playerConnectionandsendPacketand setsinitializedtotrueif it succeeds Note: These fields only have to be initialized once, so it will return ifinitializedis already set totruestatic booleanisInitialized()Determine ifpacketConstructor,getHandle,playerConnectionandsendPacketare initializedvoidsendTo(org.bukkit.Location center, double range)Sends the packet to all players in a certain rangevoidsendTo(org.bukkit.Location center, java.util.List<org.bukkit.entity.Player> players)Sends the packet to all players in the listvoidsendTo(org.bukkit.Location center, org.bukkit.entity.Player player)Sends the packet to a single player and caches it
-
-
-
Constructor Detail
-
ParticlePacket
public ParticlePacket(ParticleEffect effect, float offsetX, float offsetY, float offsetZ, float speed, int amount, boolean longDistance, ParticleEffect.ParticleData data) throws java.lang.IllegalArgumentException
Construct a new particle packet- Parameters:
effect- Particle effectoffsetX- Maximum distance particles can fly away from the center on the x-axisoffsetY- Maximum distance particles can fly away from the center on the y-axisoffsetZ- Maximum distance particles can fly away from the center on the z-axisspeed- Display speed of the particlesamount- Amount of particleslongDistance- Indicates whether the maximum distance is increased from 256 to 65536data- Data of the effect- Throws:
java.lang.IllegalArgumentException- If the speed or amount is lower than 0- See Also:
initialize()
-
ParticlePacket
public ParticlePacket(ParticleEffect effect, org.bukkit.util.Vector direction, float speed, boolean longDistance, ParticleEffect.ParticleData data) throws java.lang.IllegalArgumentException
Construct a new particle packet of a single particle flying into a determined direction- Parameters:
effect- Particle effectdirection- Direction of the particlespeed- Display speed of the particlelongDistance- Indicates whether the maximum distance is increased from 256 to 65536data- Data of the effect- Throws:
java.lang.IllegalArgumentException- If the speed is lower than 0
-
ParticlePacket
public ParticlePacket(ParticleEffect effect, ParticleEffect.ParticleColor color, boolean longDistance)
Construct a new particle packet of a single colored particle- Parameters:
effect- Particle effectcolor- Color of the particlelongDistance- Indicates whether the maximum distance is increased from 256 to 65536
-
-
Method Detail
-
initialize
public static void initialize() throws com.massivecraft.factions.util.Particles.ParticleEffect.ParticlePacket.VersionIncompatibleExceptionInitializespacketConstructor,getHandle,playerConnectionandsendPacketand setsinitializedtotrueif it succeeds Note: These fields only have to be initialized once, so it will return ifinitializedis already set totrue- Throws:
com.massivecraft.factions.util.Particles.ParticleEffect.ParticlePacket.VersionIncompatibleException- if your bukkit version is not supported by this library
-
getVersion
public static int getVersion()
Returns the version of your server (1.x)- Returns:
- The version number
-
isInitialized
public static boolean isInitialized()
Determine ifpacketConstructor,getHandle,playerConnectionandsendPacketare initialized- Returns:
- Whether these fields are initialized or not
- See Also:
initialize()
-
sendTo
public void sendTo(org.bukkit.Location center, org.bukkit.entity.Player player) throws com.massivecraft.factions.util.Particles.ParticleEffect.ParticlePacket.PacketInstantiationException, com.massivecraft.factions.util.Particles.ParticleEffect.ParticlePacket.PacketSendingExceptionSends the packet to a single player and caches it- Parameters:
center- Center location of the effectplayer- Receiver of the packet- Throws:
com.massivecraft.factions.util.Particles.ParticleEffect.ParticlePacket.PacketInstantiationException- If instantion fails due to an unknown errorcom.massivecraft.factions.util.Particles.ParticleEffect.ParticlePacket.PacketSendingException- If sending fails due to an unknown error- See Also:
initializePacket(Location)
-
sendTo
public void sendTo(org.bukkit.Location center, java.util.List<org.bukkit.entity.Player> players) throws java.lang.IllegalArgumentExceptionSends the packet to all players in the list- Parameters:
center- Center location of the effectplayers- Receivers of the packet- Throws:
java.lang.IllegalArgumentException- If the player list is empty- See Also:
sendTo(Location center, Player player)
-
sendTo
public void sendTo(org.bukkit.Location center, double range) throws java.lang.IllegalArgumentExceptionSends the packet to all players in a certain range- Parameters:
center- Center location of the effectrange- Range in which players will receive the packet (Maximum range for particles is usually 16, but it can differ for some types)- Throws:
java.lang.IllegalArgumentException- If the range is lower than 1- See Also:
sendTo(Location center, Player player)
-
-