Advertisement
Guest User

rage gun

a guest
Jul 2nd, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. @EventHandler
  2. public void toggle(PlayerInteractEvent e) {
  3. final Player p = e.getPlayer();
  4. if (p.getItemInHand().getType().equals(Material.GOLD_NUGGET)) {
  5.  
  6. new BukkitRunnable() {
  7. float acelerationY = 0.0075F;
  8. int i = 0;
  9. int a = 0;
  10.  
  11. @Override
  12. public void run() {
  13. if (this.i == 0) {
  14. p.sendMessage("Usando");
  15. }
  16. if (this.i == 100) {
  17. p.sendMessage(ChatColor.RED + "Acabou");
  18. p.getWorld().playSound(p.getLocation(), Sound.ITEM_PICKUP, 1F, 1F);
  19. }
  20. p.setVelocity(new Vector(0, this.acelerationY, 0));
  21. Vector v = p.getLocation().getDirection();
  22.  
  23. Bukkit.getWorld("world").spawnArrow(p.getLocation().add(0, 3, 0), v, 5.0F, 5.0F);
  24.  
  25. if (this.i == 100) {
  26. this.cancel();
  27. }
  28. if (this.acelerationY != 0F) {
  29. this.acelerationY += 0.003F;
  30. }
  31. if (this.acelerationY > 0.2F) {
  32. this.acelerationY = 0F;
  33. }
  34. this.i++;
  35. }
  36. }.runTaskTimer(this, 0L, 1L);
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement