Xitecraft

Bossterplates Partikel

Apr 21st, 2020
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.28 KB | None | 0 0
  1. //
  2. //Block Break Listener
  3. //
  4. public class BlockBreakListener implements Listener{
  5. Main pl = Main.getPlugin();
  6. @EventHandler
  7. public void onBreak(BlockBreakEvent e) {
  8. if(e.getBlock() == null) {
  9. return;
  10. }
  11. Material type = e.getBlock().getType();
  12. if((type == Material.IRON_PLATE) || type == Material.STONE_PLATE || type == Material.WOOD_PLATE || type == Material.GOLD_PLATE){
  13. List<String> locations = pl.getLocations().getStringList("boosterplates");
  14. String string = e.getBlock().getWorld().getName()+":"+e.getBlock().getLocation().getX()+
  15. ":"+e.getBlock().getLocation().getY()+":"+e.getBlock().getLocation().getBlockZ();
  16. locations.remove(string);
  17. pl.getLocations().set("boosterplates", locations);
  18. pl.saveLocations();
  19. boosterplates.locs.remove(string);
  20. }
  21. }
  22. }
  23. //
  24. //Block Place Listener
  25. //
  26. public class BlockPlaceListener implements Listener{
  27. Main pl = Main.pl;
  28. @EventHandler
  29. public void onPlace(BlockPlaceEvent e) {
  30. Material type = e.getBlock().getType();
  31. if((type == Material.IRON_PLATE) || type == Material.STONE_PLATE || type == Material.WOOD_PLATE || type ==
  32. Material.GOLD_PLATE){
  33. List<String> locations = pl.getLocations().getStringList("boosterplates");
  34. String string = e.getBlock().getWorld().getName()+":"+e.getBlock().getLocation().getX()+
  35. ":"+e.getBlock().getLocation().getY()+":"+e.getBlock().getLocation().getBlockZ();
  36. locations.add(string);
  37. pl.getLocations().set("boosterplates", locations);
  38. pl.saveLocations();
  39. boosterplates.locs.add(string);
  40. }
  41. }
  42. }
  43. }
  44. //
  45. // boosterplates.java
  46. //
  47. public class boosterplates {
  48. static int count;
  49. static Main pl = Main.pl;
  50. public static List<String> locs = pl.getLocations().getStringList("boosterplates");
  51. public static void start() {
  52. count = 16;
  53. Bukkit.getScheduler().scheduleSyncRepeatingTask(pl, new Runnable() {
  54. @Override
  55. public void run() {
  56. for(String loc : locs) {
  57. String[] location = loc.split(":");
  58. String world = location[0];
  59. double x = Double.parseDouble(location[1]);
  60. double y = Double.parseDouble(location[2]);
  61. double z = Double.parseDouble(location[3]);
  62. Location loc2 = new Location(Bukkit.getWorld(world), x, y, z);
  63. loc2.add(0.5,0.7,0.5);
  64. if(count == 15) ParticleEffects.boosterplate(loc2.add(0.8, 0, 0), true, 0, 0, 0, 0, 1);
  65. if(count == 14) ParticleEffects.boosterplate(loc2.add(0.75, 0, 0.43), true, 0, 0, 0, 0, 1);
  66. if(count == 13) ParticleEffects.boosterplate(loc2.add(0.65, 0, 0.65), true, 0, 0, 0, 0, 1);
  67. if(count == 12) ParticleEffects.boosterplate(loc2.add(0.43, 0, 0.75), true, 0, 0, 0, 0, 1);
  68. if(count == 11) ParticleEffects.boosterplate(loc2.add(0, 0, 0.8), true, 0, 0, 0, 0, 1);
  69. if(count == 10) ParticleEffects.boosterplate(loc2.add(-0.43, 0, 0.75), true, 0, 0, 0, 0, 1);
  70. if(count == 9) ParticleEffects.boosterplate(loc2.add(-0.65, 0, 0.65), true, 0, 0, 0, 0, 1);
  71. if(count == 8) ParticleEffects.boosterplate(loc2.add(-0.75, 0, 0.43), true, 0, 0, 0, 0, 1);
  72. if(count == 7) ParticleEffects.boosterplate(loc2.add(-0.8, 0, 0), true, 0, 0, 0, 0, 1);
  73. if(count == 6) ParticleEffects.boosterplate(loc2.add(-0.75, 0, -0.43), true, 0, 0, 0, 0, 1);
  74. if(count == 5) ParticleEffects.boosterplate(loc2.add(-0.65, 0, -0.65), true, 0, 0, 0, 0, 1);
  75. if(count == 4) ParticleEffects.boosterplate(loc2.add(-0.43, 0, -0.75), true, 0, 0, 0, 0, 1);
  76. if(count == 3) ParticleEffects.boosterplate(loc2.add(0, 0, -0.8), true, 0, 0, 0, 0, 1);
  77. if(count == 2) ParticleEffects.boosterplate(loc2.add(0.43, 0, -0.75), true, 0, 0, 0, 0, 1);
  78. if(count == 1) ParticleEffects.boosterplate(loc2.add(0.65, 0, -0.65), true, 0, 0, 0, 0, 1);
  79. if(count == 0) {
  80. ParticleEffects.boosterplate(loc2.add(0.75, 0, -0.43), true, 0, 0, 0, 0, 1);
  81. }
  82. }
  83. if(count == 0)count = 16;
  84. count--;
  85. }
  86. }, 0, 2);
  87. }
  88. }
  89. //
  90. // ParticleEffects.java
  91. //
  92. public class ParticleEffects {
  93. public static void send(Location location,boolean longdistance,float offsetx,float offsety,float offsetz,float speed,int amount) throws Exception {
  94. ArrayList<EnumParticle> particles = new ArrayList<EnumParticle>();
  95. particles.add(EnumParticle.VILLAGER_HAPPY);
  96. for(EnumParticle name : particles) {
  97. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(name, longdistance, (float)location.getX(), (float)location.getY(), (float)location.getZ(), offsetx, offsety, offsetz, speed, amount, 0);
  98. for(Player all : Bukkit.getOnlinePlayers()) {
  99. ((CraftPlayer) all).getHandle().playerConnection.sendPacket(packet);
  100. }
  101. }
  102. }
  103. public static void boosterplate(Location location,boolean longdistance,float offsetx,float offsety,float offsetz,float speed,int amount){
  104. try {
  105. PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(EnumParticle.FIREWORKS_SPARK, longdistance, (float)location.getX(), (float)location.getY(), (float)location.getZ(), offsetx, offsety, offsetz, 0, amount, 0);
  106. for(Player all : Bukkit.getOnlinePlayers()) {
  107. ((CraftPlayer) all).getHandle().playerConnection.sendPacket(packet);
  108. }
  109. } catch (Exception e1) {
  110. e1.printStackTrace();
  111. }
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment