Guest User

Ability BloodHelix

a guest
Jan 4th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. package bloodHelix;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Location;
  5. import org.bukkit.Material;
  6. import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
  7. import org.bukkit.entity.Entity;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.event.EventHandler;
  10. import org.bukkit.event.Listener;
  11. import org.bukkit.event.block.Action;
  12. import org.bukkit.event.player.PlayerInteractEvent;
  13. import org.bukkit.inventory.ItemStack;
  14. import org.bukkit.plugin.Plugin;
  15. import org.bukkit.potion.PotionEffect;
  16. import org.bukkit.potion.PotionEffectType;
  17. import org.bukkit.scheduler.BukkitRunnable;
  18.  
  19. import mainInfo.MainClass;
  20. import net.minecraft.server.v1_12_R1.EnumParticle;
  21. import net.minecraft.server.v1_12_R1.PacketPlayOutWorldParticles;
  22.  
  23. public class BloodHelix implements Listener {
  24.  
  25. static Plugin plugin = MainClass.getPlugin(MainClass.class);
  26.  
  27. @EventHandler
  28. public void helix(PlayerInteractEvent event) {
  29.  
  30. Action a = event.getAction();
  31. Player player = event.getPlayer();
  32.  
  33. ItemStack mainhand = player.getInventory().getItemInMainHand();
  34.  
  35. if(a == Action.RIGHT_CLICK_AIR || a == Action.RIGHT_CLICK_BLOCK) {
  36. if(!mainhand.hasItemMeta()) return;
  37.  
  38. else if(mainhand.getType() == Material.DIAMOND) {
  39.  
  40. if(mainhand.getItemMeta().getDisplayName().equalsIgnoreCase("Dimension Warp")) {
  41.  
  42. player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 400, 10));
  43. player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 400, 1));
  44. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 400, 1));
  45.  
  46. for (Entity entity : Bukkit.getWorld("warmode").getEntities()) {
  47. if (entity instanceof Player) {
  48. Player p = (Player) entity;
  49.  
  50. new BukkitRunnable() {
  51.  
  52. double phi = 0;
  53.  
  54. @Override
  55. public void run() {
  56.  
  57. phi = phi + Math.PI/8;
  58. double x, y, z;
  59.  
  60. Location loc = p.getLocation();
  61.  
  62. for(int f=0; f<20; f=f+1) {
  63.  
  64. for (double t = 0; t <= 2*Math.PI; t = t + Math.PI/16) {
  65.  
  66. for (double i = 0; i <= 1; i = i + 1) {
  67.  
  68. float red = 255;
  69. float green = 10;
  70. float blue = 10;
  71.  
  72. x = 0.4*(2*Math.PI-t)*0.5*Math.cos(t + phi + i*Math.PI);
  73.  
  74. y = 0.5*t;
  75.  
  76. z = 0.4*(2*Math.PI-t)*0.5*Math.sin(t + phi + i*Math.PI);
  77.  
  78. PacketPlayOutWorldParticles particles = new PacketPlayOutWorldParticles(EnumParticle.SPELL_MOB, true, (float) (loc.getX() + x), (float) (loc.getY() + y), (float) (loc.getZ() + z), red, green, blue, (float)255, 0, 40);
  79. ((CraftPlayer) p).getHandle().playerConnection.sendPacket(particles);
  80.  
  81. }
  82.  
  83. }
  84. }
  85.  
  86. //Cancel Event (this.cancel();)
  87.  
  88. }
  89.  
  90. }.runTaskTimerAsynchronously(plugin, 0, 3);
  91.  
  92. }
  93.  
  94. }
  95. }
  96. }
  97.  
  98.  
  99.  
  100. }
  101.  
  102. }
  103.  
  104. }
Advertisement
Add Comment
Please, Sign In to add comment