Advertisement
Guest User

Untitled

a guest
Aug 1st, 2014
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.80 KB | None | 0 0
  1. package src;
  2. import java.lang.reflect.Constructor;
  3. import java.lang.reflect.Field;
  4. import java.lang.reflect.Method;
  5. import java.util.ArrayList;
  6. import java.util.Arrays;
  7. import java.util.Collection;
  8. import java.util.HashMap;
  9. import java.util.List;
  10. import java.util.Map;
  11. import java.util.Map.Entry;
  12.  
  13. import org.bukkit.Bukkit;
  14. import org.bukkit.Location;
  15. import org.bukkit.entity.Player;
  16.  
  17. /**
  18. * ParticleEffect Library v1.4
  19. *
  20. * This library was created by @DarkBlade12 based on content related to particles of @microgeek (names and packet values), it allows you to display all Minecraft particle effects on a Bukkit server
  21. *
  22. * You are welcome to use it, modify it and redistribute it under the following conditions:
  23. * 1. Don't claim this class as your own
  24. * 2. Don't remove this text
  25. *
  26. * (Would be nice if you provide credit to me)
  27. *
  28. * @author DarkBlade12
  29. */
  30. public enum ParticleEffect {
  31. /**
  32. * @appearance Huge explosions
  33. * @displayed by TNT and creepers
  34. */
  35. HUGE_EXPLOSION("hugeexplosion"),
  36. /**
  37. * @appearance Smaller explosions
  38. * @displayed by TNT and creepers
  39. */
  40. LARGE_EXPLODE("largeexplode"),
  41. /**
  42. * @appearance Little white sparkling stars
  43. * @displayed by Fireworks
  44. */
  45. FIREWORKS_SPARK("fireworksSpark"),
  46. /**
  47. * @appearance Bubbles
  48. * @displayed in water
  49. */
  50. BUBBLE("bubble"),
  51. /**
  52. * @appearance Unknown
  53. */
  54. SUSPEND("suspend"),
  55. /**
  56. * @appearance Little gray dots
  57. * @displayed in the Void and water
  58. */
  59. DEPTH_SUSPEND("depthSuspend"),
  60. /**
  61. * @appearance Little gray dots
  62. * @displayed by Mycelium
  63. */
  64. TOWN_AURA("townaura"),
  65. /**
  66. * @appearance Light brown crosses
  67. * @displayed by critical hits
  68. */
  69. CRIT("crit"),
  70. /**
  71. * @appearance Cyan stars
  72. * @displayed by hits with an enchanted weapon
  73. */
  74. MAGIC_CRIT("magicCrit"),
  75. /**
  76. * @appearance Little black/gray clouds
  77. * @displayed by torches, primed TNT and end portals
  78. */
  79. SMOKE("smoke"),
  80. /**
  81. * @appearance Colored swirls
  82. * @displayed by potion effects
  83. */
  84. MOB_SPELL("mobSpell"),
  85. /**
  86. * @appearance Transparent colored swirls
  87. * @displayed by beacon effect
  88. */
  89. MOB_SPELL_AMBIENT("mobSpellAmbient"),
  90. /**
  91. * @appearance Colored swirls
  92. * @displayed by splash potions
  93. */
  94. SPELL("spell"),
  95. /**
  96. * @appearance Colored crosses
  97. * @displayed by instant splash potions (instant health/instant damage)
  98. */
  99. INSTANT_SPELL("instantSpell"),
  100. /**
  101. * @appearance Colored crosses
  102. * @displayed by witches
  103. */
  104. WITCH_MAGIC("witchMagic"),
  105. /**
  106. * @appearance Colored notes
  107. * @displayed by note blocks
  108. */
  109. NOTE("note"),
  110. /**
  111. * @appearance Little purple clouds
  112. * @displayed by nether portals, endermen, ender pearls, eyes of ender and ender chests
  113. */
  114. PORTAL("portal"),
  115. /**
  116. * @appearance: White letters
  117. * @displayed by enchantment tables that are near bookshelves
  118. */
  119. ENCHANTMENT_TABLE("enchantmenttable"),
  120. /**
  121. * @appearance White clouds
  122. */
  123. EXPLODE("explode"),
  124. /**
  125. * @appearance Little flames
  126. * @displayed by torches, furnaces, magma cubes and monster spawners
  127. */
  128. FLAME("flame"),
  129. /**
  130. * @appearance Little orange blobs
  131. * @displayed by lava
  132. */
  133. LAVA("lava"),
  134. /**
  135. * @appearance Gray transparent squares
  136. */
  137. FOOTSTEP("footstep"),
  138. /**
  139. * @appearance Blue drops
  140. * @displayed by water, rain and shaking wolves
  141. */
  142. SPLASH("splash"),
  143. /**
  144. * @appearance Blue droplets
  145. * @displayed on water when fishing
  146. */
  147. WAKE("wake"),
  148. /**
  149. * @appearance Black/Gray clouds
  150. * @displayed by fire, minecarts with furance and blazes
  151. */
  152. LARGE_SMOKE("largesmoke"),
  153. /**
  154. * @appearance Large white clouds
  155. * @displayed on mob death
  156. */
  157. CLOUD("cloud"),
  158. /**
  159. * @appearance Little colored clouds
  160. * @displayed by active redstone wires and redstone torches
  161. */
  162. RED_DUST("reddust"),
  163. /**
  164. * @appearance Little white parts
  165. * @displayed by cracking snowballs and eggs
  166. */
  167. SNOWBALL_POOF("snowballpoof"),
  168. /**
  169. * @appearance Blue drips
  170. * @displayed by blocks below a water source
  171. */
  172. DRIP_WATER("dripWater"),
  173. /**
  174. * @appearance Orange drips
  175. * @displayed by blocks below a lava source
  176. */
  177. DRIP_LAVA("dripLava"),
  178. /**
  179. * @appearance White clouds
  180. */
  181. SNOW_SHOVEL("snowshovel"),
  182. /**
  183. * @appearance Little green parts
  184. * @displayed by slimes
  185. */
  186. SLIME("slime"),
  187. /**
  188. * @appearance Red hearts
  189. * @displayed when breeding
  190. */
  191. HEART("heart"),
  192. /**
  193. * @appearance Dark gray cracked hearts
  194. * @displayed when attacking a villager in a village
  195. */
  196. ANGRY_VILLAGER("angryVillager"),
  197. /**
  198. * @appearance Green stars
  199. * @displayed by bone meal and when trading with a villager
  200. */
  201. HAPPY_VILLAGER("happyVillager");
  202.  
  203. private static final Map<String, ParticleEffect> NAME_MAP = new HashMap<String, ParticleEffect>();
  204. private static final double MAX_RANGE = 16;
  205. private static Constructor<?> packetPlayOutWorldParticles;
  206. private static Method getHandle;
  207. private static Field playerConnection;
  208. private static Method sendPacket;
  209. private final String name;
  210.  
  211. static {
  212. for (ParticleEffect p : values())
  213. NAME_MAP.put(p.name, p);
  214. try {
  215. packetPlayOutWorldParticles = ReflectionHandler.getConstructor(ReflectionHandler.PacketType.PLAY_OUT_WORLD_PARTICLES.getPacket(), String.class, float.class, float.class, float.class, float.class, float.class,
  216. float.class, float.class, int.class);
  217. getHandle = ReflectionHandler.getMethod("CraftPlayer", ReflectionHandler.SubPackageType.ENTITY, "getHandle");
  218. playerConnection = ReflectionHandler.getField("EntityPlayer", ReflectionHandler.PackageType.MINECRAFT_SERVER, "playerConnection");
  219. sendPacket = ReflectionHandler.getMethod(playerConnection.getType(), "sendPacket", ReflectionHandler.getClass("Packet", ReflectionHandler.PackageType.MINECRAFT_SERVER));
  220. } catch (Exception e) {
  221. e.printStackTrace();
  222. }
  223. }
  224.  
  225. /**
  226. * @param name Name of this particle effect
  227. */
  228. private ParticleEffect(String name) {
  229. this.name = name;
  230. }
  231.  
  232. /**
  233. * @return The name of this particle effect
  234. */
  235. public String getName() {
  236. return this.name;
  237. }
  238.  
  239. /**
  240. * Gets a particle effect from name
  241. *
  242. * @param name Name of the particle effect
  243. * @return The particle effect
  244. */
  245. public static ParticleEffect fromName(String name) {
  246. if (name != null)
  247. for (Entry<String, ParticleEffect> e : NAME_MAP.entrySet())
  248. if (e.getKey().equalsIgnoreCase(name))
  249. return e.getValue();
  250. return null;
  251. }
  252.  
  253. /**
  254. * Gets a list of players in a certain range
  255. *
  256. * @param center Center location
  257. * @param range Range
  258. * @return The list of players in the specified range
  259. */
  260. private static List<Player> getPlayers(Location center, double range) {
  261. List<Player> players = new ArrayList<Player>();
  262. String name = center.getWorld().getName();
  263. double squared = range * range;
  264. for (Player p : Bukkit.getOnlinePlayers())
  265. if (p.getWorld().getName().equals(name) && p.getLocation().distanceSquared(center) <= squared)
  266. players.add(p);
  267. return players;
  268. }
  269.  
  270. /**
  271. * Instantiates a new @PacketPlayOutWorldParticles object through reflection
  272. *
  273. * @param center Center location of the effect
  274. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  275. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  276. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  277. * @param speed Display speed of the particles
  278. * @param amount Amount of particles
  279. * @return The packet object
  280. * @throws #PacketInstantiationException if the amount is lower than 1 or if the @PacketPlayOutWorldParticles has changed its name or constructor parameters
  281. */
  282. private static Object instantiatePacket(String name, Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
  283. if (amount < 1)
  284. throw new PacketInstantiationException("Amount cannot be lower than 1");
  285. try {
  286. return packetPlayOutWorldParticles.newInstance(name, (float) center.getX(), (float) center.getY(), (float) center.getZ(), offsetX, offsetY, offsetZ, speed, amount);
  287. } catch (Exception e) {
  288. throw new PacketInstantiationException("Packet instantiation failed", e);
  289. }
  290. }
  291.  
  292. /**
  293. * Instantiates a new @PacketPlayOutWorldParticles object through reflection especially for the "iconcrack" effect
  294. *
  295. * @param id Id of the icon
  296. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  297. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  298. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  299. * @param speed Display speed of the particles
  300. * @param amount Amount of particles
  301. * @return The packet object
  302. * @throws #PacketInstantiationException if the amount is lower than 1 or if the @PacketPlayOutWorldParticles has changed its name or constructor parameters
  303. * @see #instantiatePacket
  304. */
  305. private static Object instantiateIconCrackPacket(int id, Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
  306. return instantiatePacket("iconcrack_" + id, center, offsetX, offsetY, offsetZ, speed, amount);
  307. }
  308.  
  309. /**
  310. * Instantiates a new @PacketPlayOutWorldParticles object through reflection especially for the "blockcrack" effect
  311. *
  312. * @param id Id of the block
  313. * @param data Data value
  314. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  315. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  316. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  317. * @param amount Amount of particles
  318. * @return The packet object
  319. * @throws #PacketInstantiationException if the amount is lower than 1 or if the @PacketPlayOutWorldParticles has changed its name or constructor parameters
  320. * @see #instantiatePacket
  321. */
  322. private static Object instantiateBlockCrackPacket(int id, byte data, Location center, float offsetX, float offsetY, float offsetZ, int amount) {
  323. return instantiatePacket("blockcrack_" + id + "_" + data, center, offsetX, offsetY, offsetZ, 0, amount);
  324. }
  325.  
  326. /**
  327. * Instantiates a new @PacketPlayOutWorldParticles object through reflection especially for the "blockdust" effect
  328. *
  329. * @param id Id of the block
  330. * @param data Data value
  331. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  332. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  333. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  334. * @param speed Display speed of the particles
  335. * @param amount Amount of particles
  336. * @return The packet object
  337. * @throws #PacketInstantiationException if the amount is lower than 1 or if the name or the constructor of @PacketPlayOutWorldParticles have changed
  338. * @see #instantiatePacket
  339. */
  340. private static Object instantiateBlockDustPacket(int id, byte data, Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
  341. return instantiatePacket("blockdust_" + id + "_" + data, center, offsetX, offsetY, offsetZ, speed, amount);
  342. }
  343.  
  344. /**
  345. * Sends a packet through reflection to a player
  346. *
  347. * @param p Receiver of the packet
  348. * @param packet Packet that is sent
  349. * @throws #PacketSendingException if the packet is null or some methods which are accessed through reflection have changed
  350. */
  351. private static void sendPacket(Player p, Object packet) {
  352. try {
  353. sendPacket.invoke(playerConnection.get(getHandle.invoke(p)), packet);
  354. } catch (Exception e) {
  355. throw new PacketSendingException("Failed to send a packet to player '" + p.getName() + "'", e);
  356. }
  357. }
  358.  
  359. /**
  360. * Sends a packet through reflection to a collection of players
  361. *
  362. * @param players Receivers of the packet
  363. * @param packet Packet that is sent
  364. * @throws #PacketSendingException if the sending to a single player fails
  365. * @see #sendPacket
  366. */
  367. private static void sendPacket(Collection<Player> players, Object packet) {
  368. for (Player p : players)
  369. sendPacket(p, packet);
  370. }
  371.  
  372. /**
  373. * Displays a particle effect which is only visible for the specified players
  374. *
  375. * @param center Center location of the effect
  376. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  377. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  378. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  379. * @param speed Display speed of the particles
  380. * @param amount Amount of particles
  381. * @param players Receivers of the effect
  382. * @see #sendPacket
  383. * @see #instantiatePacket
  384. */
  385. public void display(Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount, Player... players) {
  386. sendPacket(Arrays.asList(players), instantiatePacket(name, center, offsetX, offsetY, offsetZ, speed, amount));
  387. }
  388.  
  389. /**
  390. * Displays a particle effect which is only visible for all players within a certain range in the world of @param center
  391. *
  392. * @param center Center location of the effect
  393. * @param range Range of the visibility
  394. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  395. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  396. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  397. * @param speed Display speed of the particles
  398. * @param amount Amount of particles
  399. * @param players Receivers of the effect
  400. * @throws @IllegalArgumentException if the range is higher than 20
  401. * @see #sendPacket
  402. * @see #instantiatePacket
  403. */
  404. public void display(Location center, double range, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
  405. if (range > MAX_RANGE)
  406. throw new IllegalArgumentException("Range cannot exceed the maximum value of 16");
  407. sendPacket(getPlayers(center, range), instantiatePacket(name, center, offsetX, offsetY, offsetZ, speed, amount));
  408. }
  409.  
  410. /**
  411. * Displays a particle effect which is only visible for all players within a range of 20 in the world of @param center
  412. *
  413. * @param center Center location of the effect
  414. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  415. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  416. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  417. * @param speed Display speed of the particles
  418. * @param amount Amount of particles
  419. * @param players Receivers of the effect
  420. * @see #display(org.bukkit.Location, double, float, float, float, float, int)
  421. */
  422. public void display(Location center, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
  423. display(center, MAX_RANGE, offsetX, offsetY, offsetZ, speed, amount);
  424. }
  425.  
  426. /**
  427. * Displays an icon crack (item break) particle effect which is only visible for the specified players
  428. *
  429. * @param center Center location of the effect
  430. * @param id Id of the icon
  431. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  432. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  433. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  434. * @param speed Display speed of the particles
  435. * @param amount Amount of particles
  436. * @param players Receivers of the effect
  437. * @see #sendPacket
  438. * @see #instantiateIconCrackPacket
  439. */
  440. public static void displayIconCrack(Location center, int id, float offsetX, float offsetY, float offsetZ, float speed, int amount, Player... players) {
  441. sendPacket(Arrays.asList(players), instantiateIconCrackPacket(id, center, offsetX, offsetY, offsetZ, speed, amount));
  442. }
  443.  
  444. /**
  445. * Displays an icon crack (item break) particle effect which is only visible for all players within a certain range in the world of @param center
  446. *
  447. * @param center Center location of the effect
  448. * @param range Range of the visibility
  449. * @param id Id of the icon
  450. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  451. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  452. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  453. * @param speed Display speed of the particles
  454. * @param amount Amount of particles
  455. * @throws @IllegalArgumentException if the range is higher than 20
  456. * @see #sendPacket
  457. * @see #instantiateIconCrackPacket
  458. */
  459. public static void displayIconCrack(Location center, double range, int id, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
  460. if (range > MAX_RANGE)
  461. throw new IllegalArgumentException("Range has to be lower/equal the maximum of 16");
  462. sendPacket(getPlayers(center, range), instantiateIconCrackPacket(id, center, offsetX, offsetY, offsetZ, speed, amount));
  463. }
  464.  
  465. /**
  466. * Displays an icon crack (item break) effect which is visible for all players whitin the maximum range of 20 blocks in the world of @param center
  467. *
  468. * @param center Center location of the effect
  469. * @param id Id of the icon
  470. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  471. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  472. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  473. * @param speed Display speed of the particles
  474. * @param amount Amount of particles
  475. * @see #displayIconCrack(org.bukkit.Location, double, int, float, float, float, float, int)
  476. */
  477. public static void displayIconCrack(Location center, int id, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
  478. displayIconCrack(center, MAX_RANGE, id, offsetX, offsetY, offsetZ, speed, amount);
  479. }
  480.  
  481. /**
  482. * Displays a block crack (block break) particle effect which is only visible for the specified players
  483. *
  484. * @param center Center location of the effect
  485. * @param id Id of the block
  486. * @param data Data value
  487. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  488. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  489. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  490. * @param amount Amount of particles
  491. * @param players Receivers of the effect
  492. * @see #sendPacket
  493. * @see #instantiateBlockCrackPacket
  494. */
  495. public static void displayBlockCrack(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, int amount, Player... players) {
  496. sendPacket(Arrays.asList(players), instantiateBlockCrackPacket(id, data, center, offsetX, offsetY, offsetZ, amount));
  497. }
  498.  
  499. /**
  500. * Displays a block crack (block break) particle effect which is only visible for all players within a certain range in the world of @param center
  501. *
  502. * @param center Center location of the effect
  503. * @param range Range of the visibility
  504. * @param id Id of the block
  505. * @param data Data value
  506. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  507. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  508. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  509. * @param amount Amount of particles
  510. * @throws @IllegalArgumentException if the range is higher than 20
  511. * @see #sendPacket
  512. * @see #instantiateBlockCrackPacket
  513. */
  514. public static void displayBlockCrack(Location center, double range, int id, byte data, float offsetX, float offsetY, float offsetZ, int amount) {
  515. if (range > MAX_RANGE)
  516. throw new IllegalArgumentException("Range has to be lower/equal the maximum of 16");
  517. sendPacket(getPlayers(center, range), instantiateBlockCrackPacket(id, data, center, offsetX, offsetY, offsetZ, amount));
  518. }
  519.  
  520. /**
  521. * Displays a block crack (block break) effect which is visible for all players whitin the maximum range of 20 blocks in the world of @param center
  522. *
  523. * @param center Center location of the effect
  524. * @param id Id of the block
  525. * @param data Data value
  526. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  527. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  528. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  529. * @param amount Amount of particles
  530. * @see #displayBlockCrack(org.bukkit.Location, double, int, byte, float, float, float, int)
  531. */
  532. public static void displayBlockCrack(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, int amount) {
  533. displayBlockCrack(center, MAX_RANGE, id, data, offsetX, offsetY, offsetZ, amount);
  534. }
  535.  
  536. /**
  537. * Displays a block dust particle effect which is only visible for the specified players
  538. *
  539. * @param center Center location of the effect
  540. * @param id Id of the block
  541. * @param data Data value
  542. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  543. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  544. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  545. * @param speed Display speed of the particles
  546. * @param amount Amount of particles
  547. * @param players Receivers of the effect
  548. * @see #sendPacket
  549. * @see #instantiateBlockDustPacket
  550. */
  551. public static void displayBlockDust(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int amount, Player... players) {
  552. sendPacket(Arrays.asList(players), instantiateBlockDustPacket(id, data, center, offsetX, offsetY, offsetZ, speed, amount));
  553. }
  554.  
  555. /**
  556. * Displays a block dust particle effect which is only visible for all players within a certain range in the world of @param center
  557. *
  558. * @param center Center location of the effect
  559. * @param range Range of the visibility
  560. * @param id Id of the block
  561. * @param data Data value
  562. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  563. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  564. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  565. * @param speed Display speed of the particles
  566. * @param amount Amount of particles
  567. * @throws @IllegalArgumentException if the range is higher than 20
  568. * @see #sendPacket
  569. * @see #instantiateBlockDustPacket
  570. */
  571. public static void displayBlockDust(Location center, double range, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
  572. if (range > MAX_RANGE)
  573. throw new IllegalArgumentException("Range has to be lower/equal the maximum of 16");
  574. sendPacket(getPlayers(center, range), instantiateBlockDustPacket(id, data, center, offsetX, offsetY, offsetZ, speed, amount));
  575. }
  576.  
  577. /**
  578. * Displays a block dust effect which is visible for all players whitin the maximum range of 20 blocks in the world of @param center
  579. *
  580. * @param center Center location of the effect
  581. * @param id Id of the block
  582. * @param data Data value
  583. * @param offsetX Maximum distance particles can fly away from the center on the x-axis
  584. * @param offsetY Maximum distance particles can fly away from the center on the y-axis
  585. * @param offsetZ Maximum distance particles can fly away from the center on the z-axis
  586. * @param speed Display speed of the particles
  587. * @param amount Amount of particles
  588. * @see #displayBlockDust(org.bukkit.Location, double, int, byte, float, float, float, float, int)
  589. */
  590. public static void displayBlockDust(Location center, int id, byte data, float offsetX, float offsetY, float offsetZ, float speed, int amount) {
  591. displayBlockDust(center, MAX_RANGE, id, data, offsetX, offsetY, offsetZ, speed, amount);
  592. }
  593.  
  594. /**
  595. * Represents a runtime exception that can be thrown upon packet instantiation
  596. */
  597. private static final class PacketInstantiationException extends RuntimeException {
  598. private static final long serialVersionUID = 3203085387160737484L;
  599.  
  600. /**
  601. * @param message Message that will be logged
  602. */
  603. public PacketInstantiationException(String message) {
  604. super(message);
  605. }
  606.  
  607. /**
  608. * @param message Message that will be logged
  609. * @param cause Cause of the exception
  610. */
  611. public PacketInstantiationException(String message, Throwable cause) {
  612. super(message, cause);
  613. }
  614. }
  615.  
  616. /**
  617. * Represents a runtime exception that can be thrown upon packet sending
  618. */
  619. private static final class PacketSendingException extends RuntimeException {
  620. private static final long serialVersionUID = 3203085387160737484L;
  621.  
  622. /**
  623. * @param message Message that will be logged
  624. * @param cause Cause of the exception
  625. */
  626. public PacketSendingException(String message, Throwable cause) {
  627. super(message, cause);
  628. }
  629. }
  630. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement