Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class GiDoRunnable extends BukkitRunnable {
- public GiDoRunnable(EventGiDo e) {
- this.event = e;
- }
- private EventGiDo event;
- int down = 6;
- @Override
- public void run() {
- Player p = event.getPlayer();
- String succu = time;
- down--;
- if (a.isEmpty()) {
- this.cancel();
- }
- String timeleft = "§a§l" + succu.substring(down) + "§7§l" + succu.substring(6 - down);
- p.sendTitle("§f§l" + down, timeleft, 0, 40, 0);
- p.playSound(p.getLocation(), Sound.BLOCK_LEVER_CLICK, 4F, 4F);
- if (down == 0) {
- a.clear();
- if (item.getAmount() > 1) {
- item.setAmount(item.getAmount() - 1);
- p.getInventory().setItem(slot, item);
- p.updateInventory();
- } else if (item.getAmount() <= 1) {
- p.getInventory().remove(item);
- p.updateInventory();
- }
- p.sendTitle("", "", 0, 0, 0);
- p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 4f, 4f);
- p.setHealth(p.getHealth() + 3.0);
- new BukkitRunnable() {
- @Override
- public void run() {
- p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 100, 1));
- }
- }.runTask(plugin);
- p.spigot().sendMessage(ChatMessageType.ACTION_BAR,
- TextComponent.fromLegacyText("§6§lNew Health: " +
- "§e§l" + health + " §f§l--> §a§l" + ((int) p.getHealth())));
- this.cancel();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment