Guest User

Untitled

a guest
Oct 19th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.48 KB | None | 0 0
  1. String time = "▃▃▃▃▃▃";
  2.             int loop = 20;
  3.  
  4.             a.put(p, p.getUniqueId());
  5.  
  6.             g = new BukkitRunnable() {
  7.  
  8.                 int down = 6;
  9.  
  10.                 @Override
  11.                 public void run() {
  12.                    
  13.                     String succu = time;
  14.                    
  15.                     down--;
  16.                    
  17.                     if (a.isEmpty()) {
  18.                         this.cancel();
  19.                     }
  20.  
  21.                     String timeleft = "§a§l" + succu.substring(down) + "§7§l" + succu.substring(6 - down);
  22.  
  23.                     p.sendTitle("§f§l" + down, timeleft, 0, 40, 0);
  24.  
  25.                     p.playSound(p.getLocation(), Sound.BLOCK_LEVER_CLICK, 4F, 4F);
  26.  
  27.                     if (down == 0) {
  28.                        
  29.                         a.clear();
  30.                        
  31.                         if (item.getAmount() > 1) {
  32.                             item.setAmount(item.getAmount() - 1);
  33.                             p.getInventory().setItem(slot, item);
  34.                             p.updateInventory();
  35.                         } else if (item.getAmount() <= 1) {
  36.                             p.getInventory().remove(item);
  37.                             p.updateInventory();
  38.                         }
  39.                        
  40.                         p.sendTitle("", "", 0, 0, 0);
  41.  
  42.                         p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 4f, 4f);
  43.  
  44.                         p.setHealth(p.getHealth() + 3.0);
  45.  
  46.                         new BukkitRunnable() {
  47.                             @Override
  48.                             public void run() {
  49.                                 p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 100, 1));
  50.                             }
  51.                         }.runTask(plugin);
  52.  
  53.                         p.spigot().sendMessage(ChatMessageType.ACTION_BAR,
  54.                                 TextComponent.fromLegacyText("§6§lNew Health: " +
  55.                                         "§e§l" + health + " §f§l--> §a§l" + ((int) p.getHealth())));
  56.  
  57.                         this.cancel();
  58.                     }
  59.  
  60.                 }
  61.             }.runTaskTimerAsynchronously(plugin, 0, loop);
Advertisement
Add Comment
Please, Sign In to add comment