Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void toggle(PlayerInteractEvent e) {
- final Player p = e.getPlayer();
- if (p.getItemInHand().getType().equals(Material.GOLD_NUGGET)) {
- new BukkitRunnable() {
- float acelerationY = 0.0075F;
- int i = 0;
- int a = 0;
- @Override
- public void run() {
- if (this.i == 0) {
- p.sendMessage("Usando");
- }
- if (this.i == 100) {
- p.sendMessage(ChatColor.RED + "Acabou");
- p.getWorld().playSound(p.getLocation(), Sound.ITEM_PICKUP, 1F, 1F);
- }
- p.setVelocity(new Vector(0, this.acelerationY, 0));
- Vector v = p.getLocation().getDirection();
- Bukkit.getWorld("world").spawnArrow(p.getLocation().add(0, 3, 0), v, 5.0F, 5.0F);
- if (this.i == 100) {
- this.cancel();
- }
- if (this.acelerationY != 0F) {
- this.acelerationY += 0.003F;
- }
- if (this.acelerationY > 0.2F) {
- this.acelerationY = 0F;
- }
- this.i++;
- }
- }.runTaskTimer(this, 0L, 1L);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement