Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. package me.capz.helix;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.Location;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.event.EventHandler;
  11. import org.bukkit.event.Listener;
  12. import org.bukkit.event.block.Action;
  13. import org.bukkit.event.player.PlayerInteractEvent;
  14. import org.bukkit.event.player.PlayerJoinEvent;
  15. import org.bukkit.plugin.java.JavaPlugin;
  16. import org.bukkit.util.Vector;
  17.  
  18. import de.slikey.effectlib.EffectLib;
  19. import de.slikey.effectlib.EffectManager;
  20.  
  21. public class version2 extends JavaPlugin implements Listener{
  22.  
  23. EffectManager em;
  24.  
  25. public void onEnable() {
  26. Bukkit.getPluginManager().registerEvents(this, this);
  27. EffectLib lib = EffectLib.instance();
  28. em = new EffectManager(lib);
  29. }
  30.  
  31. public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
  32. Player player = (Player)sender;
  33. if(cmd.getLabel().equalsIgnoreCase("flamey") && sender instanceof Player) {
  34. flamey(player);
  35.  
  36. }
  37. return true;
  38. }
  39.  
  40. private void flamey(Player player) {
  41. Location l = player.getLocation();
  42. double radius = 2;
  43. double maxHeight = 10;
  44. for(int i1 = 0; i1 < 1; i1++) {
  45. for(double y = 0; y < 2; y+= 0.1, radius--) {
  46. double x = Math.cos(y * radius) * 0.4; // Basically it is saying 3 * Math.cosine and sine, to make a helix around eachother.
  47. double z = Math.sin(y * radius) * 0.8;
  48.  
  49. net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles packet = new net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles("flame",
  50. ((float) (l.getX() + x)),
  51. ((float) (l.getY() + y)),
  52. ((float) (l.getZ() + z)),
  53. 0, 0, 0, 1, 0);
  54.  
  55.  
  56.  
  57. ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
  58. }
  59. }
  60.  
  61.  
  62.  
  63. }
  64. @EventHandler
  65. public void interact(PlayerInteractEvent e) {
  66. final Player player = e.getPlayer();
  67. if(e.getAction() == Action.LEFT_CLICK_AIR) {
  68. Location l = player.getEyeLocation();
  69. Vector direction = l.getDirection().normalize();
  70. Vector vector = new Vector();
  71. double radius = 1;
  72. double maxHeight = 10;
  73. double t = 0;
  74. t = t + Math.PI / 8;
  75. for(int i1 = 0; i1 < 80; i1++) {
  76. double y = t;
  77. double x = direction.getX(); // Basically it is saying 3 * Math.cosine and sine, to make a helix around eachother.
  78. double z = direction.getZ();
  79. l.add(x, y, z);
  80.  
  81. net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles packet = new net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles("flame",
  82. ((float) (l.getX() + 0.5)),
  83. ((float) (l.getY())),
  84. ((float) (l.getZ() + 0.5)),
  85. 0, 0, 0, 1, 0);
  86.  
  87.  
  88.  
  89. ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
  90. }
  91.  
  92. }
  93.  
  94.  
  95. }
  96. @EventHandler
  97. public void onPlayerJoin(final PlayerJoinEvent event) {
  98. new Runnable() {
  99.  
  100. @Override
  101. public void run() {
  102. Player player = event.getPlayer();
  103.  
  104. Location l = player.getLocation();
  105. double radius = 2;
  106. double maxHeight = 10;
  107. for(int i1 = 0; i1 < 20; i1++) {
  108. for(double y = 0; y < 5; y+= 0.005) {
  109. double x = Math.cos(y * radius); // Basically it is saying 3 * Math.cosine and sine, to make a helix around eachother.
  110. double z = Math.sin(y * radius);
  111.  
  112. net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles packet = new net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles("flame",
  113. ((float) (l.getX()
  114. + x)),
  115.  
  116. ((float) (l.getY()
  117. + y)),
  118.  
  119. ((float) (l.getZ()
  120. + z)),
  121.  
  122. 0, 0, 0, 1, 0);
  123.  
  124.  
  125. ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
  126.  
  127.  
  128. }
  129. }
  130. }
  131.  
  132. };
  133. }
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement