summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2016-03-01 08:30:03 +1100
committermd_5 <git@md-5.net>2016-03-01 08:30:03 +1100
commitd5958ff936427a46a833c7ac9354c19ceb371d21 (patch)
treef24e45068e8f097c43d28142d426e56f6c6bfaf7
parentd2656274bfd5013cc74eeb59d09be836a5d58718 (diff)
downloadbukkit-d5958ff936427a46a833c7ac9354c19ceb371d21.tar
bukkit-d5958ff936427a46a833c7ac9354c19ceb371d21.tar.gz
bukkit-d5958ff936427a46a833c7ac9354c19ceb371d21.tar.lz
bukkit-d5958ff936427a46a833c7ac9354c19ceb371d21.tar.xz
bukkit-d5958ff936427a46a833c7ac9354c19ceb371d21.zip
Implement Particle API
-rw-r--r--src/main/java/org/bukkit/Particle.java71
-rw-r--r--src/main/java/org/bukkit/entity/Player.java196
2 files changed, 267 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java
new file mode 100644
index 00000000..af491f32
--- /dev/null
+++ b/src/main/java/org/bukkit/Particle.java
@@ -0,0 +1,71 @@
+package org.bukkit;
+
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.material.MaterialData;
+
+public enum Particle {
+ EXPLOSION_NORMAL,
+ EXPLOSION_LARGE,
+ EXPLOSION_HUGE,
+ FIREWORKS_SPARK,
+ WATER_BUBBLE,
+ WATER_SPLASH,
+ WATER_WAKE,
+ SUSPENDED,
+ SUSPENDED_DEPTH,
+ CRIT,
+ CRIT_MAGIC,
+ SMOKE_NORMAL,
+ SMOKE_LARGE,
+ SPELL,
+ SPELL_INSTANT,
+ SPELL_MOB,
+ SPELL_MOB_AMBIENT,
+ SPELL_WITCH,
+ DRIP_WATER,
+ DRIP_LAVA,
+ VILLAGER_ANGRY,
+ VILLAGER_HAPPY,
+ TOWN_AURA,
+ NOTE,
+ PORTAL,
+ ENCHANTMENT_TABLE,
+ FLAME,
+ LAVA,
+ FOOTSTEP,
+ CLOUD,
+ REDSTONE,
+ SNOWBALL,
+ SNOW_SHOVEL,
+ SLIME,
+ HEART,
+ BARRIER,
+ ITEM_CRACK(ItemStack.class),
+ BLOCK_CRACK(MaterialData.class),
+ BLOCK_DUST(MaterialData.class),
+ WATER_DROP,
+ ITEM_TAKE,
+ MOB_APPEARANCE,
+ DRAGON_BREATH,
+ END_ROD,
+ DAMAGE_INDICATOR,
+ SWEEP_ATTACK;
+
+ private final Class<?> dataType;
+
+ Particle() {
+ dataType = Void.class;
+ }
+
+ Particle(Class<?> data) {
+ dataType = data;
+ }
+
+ /**
+ * Returns the required data type for the particle
+ * @return the required data type
+ */
+ public Class<?> getDataType() {
+ return dataType;
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 1b54b486..723464b7 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -11,6 +11,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Note;
import org.bukkit.OfflinePlayer;
+import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.Statistic;
import org.bukkit.WeatherType;
@@ -1076,4 +1077,199 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
*/
@Deprecated
public void resetTitle();
+
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location.
+ *
+ * @param particle the particle to spawn
+ * @param location the location to spawn at
+ * @param count the number of particles
+ */
+ public void spawnParticle(Particle particle, Location location, int count);
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location.
+ *
+ * @param particle the particle to spawn
+ * @param x the position on the x axis to spawn at
+ * @param y the position on the y axis to spawn at
+ * @param z the position on the z axis to spawn at
+ * @param count the number of particles
+ */
+ public void spawnParticle(Particle particle, double x, double y, double z, int count);
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location.
+ *
+ * @param particle the particle to spawn
+ * @param location the location to spawn at
+ * @param count the number of particles
+ * @param data the data to use for the particle or null,
+ * the type of this depends on {@link Particle#getDataType()}
+ */
+ public <T> void spawnParticle(Particle particle, Location location, int count, T data);
+
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location.
+ *
+ * @param particle the particle to spawn
+ * @param x the position on the x axis to spawn at
+ * @param y the position on the y axis to spawn at
+ * @param z the position on the z axis to spawn at
+ * @param count the number of particles
+ * @param data the data to use for the particle or null,
+ * the type of this depends on {@link Particle#getDataType()}
+ */
+ public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, T data);
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
+ * randomized positively and negatively by the offset parameters
+ * on each axis.
+ *
+ * @param particle the particle to spawn
+ * @param location the location to spawn at
+ * @param count the number of particles
+ * @param offsetX the maximum random offset on the X axis
+ * @param offsetY the maximum random offset on the Y axis
+ * @param offsetZ the maximum random offset on the Z axis
+ */
+ public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ);
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
+ * randomized positively and negatively by the offset parameters
+ * on each axis.
+ *
+ * @param particle the particle to spawn
+ * @param x the position on the x axis to spawn at
+ * @param y the position on the y axis to spawn at
+ * @param z the position on the z axis to spawn at
+ * @param count the number of particles
+ * @param offsetX the maximum random offset on the X axis
+ * @param offsetY the maximum random offset on the Y axis
+ * @param offsetZ the maximum random offset on the Z axis
+ */
+ public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ);
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
+ * randomized positively and negatively by the offset parameters
+ * on each axis.
+ *
+ * @param particle the particle to spawn
+ * @param location the location to spawn at
+ * @param count the number of particles
+ * @param offsetX the maximum random offset on the X axis
+ * @param offsetY the maximum random offset on the Y axis
+ * @param offsetZ the maximum random offset on the Z axis
+ * @param data the data to use for the particle or null,
+ * the type of this depends on {@link Particle#getDataType()}
+ */
+ public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, T data);
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
+ * randomized positively and negatively by the offset parameters
+ * on each axis.
+ *
+ * @param particle the particle to spawn
+ * @param x the position on the x axis to spawn at
+ * @param y the position on the y axis to spawn at
+ * @param z the position on the z axis to spawn at
+ * @param count the number of particles
+ * @param offsetX the maximum random offset on the X axis
+ * @param offsetY the maximum random offset on the Y axis
+ * @param offsetZ the maximum random offset on the Z axis
+ * @param data the data to use for the particle or null,
+ * the type of this depends on {@link Particle#getDataType()}
+ */
+ public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, T data);
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
+ * randomized positively and negatively by the offset parameters
+ * on each axis.
+ *
+ * @param particle the particle to spawn
+ * @param location the location to spawn at
+ * @param count the number of particles
+ * @param offsetX the maximum random offset on the X axis
+ * @param offsetY the maximum random offset on the Y axis
+ * @param offsetZ the maximum random offset on the Z axis
+ * @param extra the extra data for this particle, depends on the
+ * particle used (normally speed)
+ */
+ public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra);
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
+ * randomized positively and negatively by the offset parameters
+ * on each axis.
+ *
+ * @param particle the particle to spawn
+ * @param x the position on the x axis to spawn at
+ * @param y the position on the y axis to spawn at
+ * @param z the position on the z axis to spawn at
+ * @param count the number of particles
+ * @param offsetX the maximum random offset on the X axis
+ * @param offsetY the maximum random offset on the Y axis
+ * @param offsetZ the maximum random offset on the Z axis
+ * @param extra the extra data for this particle, depends on the
+ * particle used (normally speed)
+ */
+ public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra);
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
+ * randomized positively and negatively by the offset parameters
+ * on each axis.
+ *
+ * @param particle the particle to spawn
+ * @param location the location to spawn at
+ * @param count the number of particles
+ * @param offsetX the maximum random offset on the X axis
+ * @param offsetY the maximum random offset on the Y axis
+ * @param offsetZ the maximum random offset on the Z axis
+ * @param extra the extra data for this particle, depends on the
+ * particle used (normally speed)
+ * @param data the data to use for the particle or null,
+ * the type of this depends on {@link Particle#getDataType()}
+ */
+ public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
+
+ /**
+ * Spawns the particle (the number of times specified by count)
+ * at the target location. The position of each particle will be
+ * randomized positively and negatively by the offset parameters
+ * on each axis.
+ *
+ * @param particle the particle to spawn
+ * @param x the position on the x axis to spawn at
+ * @param y the position on the y axis to spawn at
+ * @param z the position on the z axis to spawn at
+ * @param count the number of particles
+ * @param offsetX the maximum random offset on the X axis
+ * @param offsetY the maximum random offset on the Y axis
+ * @param offsetZ the maximum random offset on the Z axis
+ * @param extra the extra data for this particle, depends on the
+ * particle used (normally speed)
+ * @param data the data to use for the particle or null,
+ * the type of this depends on {@link Particle#getDataType()}
+ */
+ public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
+
}