SHARE
TWEET

Untitled

a guest Feb 21st, 2020 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package de.godtitan.rushwars.phase.type;
  2.  
  3. import de.dytanic.cloudnet.bridge.CloudServer;
  4. import de.dytanic.cloudnet.lib.server.ServerState;
  5. import de.godtitan.rushwars.RushWars;
  6. import de.godtitan.rushwars.phase.GameStates;
  7. import lombok.Getter;
  8. import org.bukkit.Bukkit;
  9. import org.bukkit.Sound;
  10. import org.bukkit.entity.Player;
  11. import org.bukkit.scheduler.BukkitRunnable;
  12.  
  13. public class EndingPhase {
  14.  
  15.     private RushWars rushWars;
  16.     public EndingPhase(RushWars plugin) {
  17.         this.rushWars = plugin;
  18.     }
  19.  
  20.     @Getter
  21.     private GameStates state = GameStates.ENDING;
  22.  
  23.     int task;
  24.     int countdown;
  25.  
  26.     @Deprecated
  27.     public void start() {
  28.         CloudServer.getInstance().setServerState(ServerState.OFFLINE);
  29.         CloudServer.getInstance().updateAsync();
  30.         countdown = 15;
  31.  
  32.         task = Bukkit.getScheduler().scheduleSyncRepeatingTask(rushWars, new BukkitRunnable() {
  33.             @Override
  34.             public void run() {
  35.  
  36.                 if(countdown == 0) {
  37.                     Bukkit.getServer().shutdown();
  38.                     return;
  39.                 }
  40.  
  41.                 for (Player player : Bukkit.getOnlinePlayers()) {
  42.                     player.setExp((float) countdown / 15f);
  43.                     player.setLevel(countdown);
  44.                 }
  45.  
  46.                 if(countdown <= 6) {
  47.                     for(Player all : Bukkit.getOnlinePlayers())
  48.                         all.playSound(all.getLocation(), Sound.NOTE_BASS_DRUM, 1F, 1F);
  49.                 }
  50.  
  51.                 for(Player all : Bukkit.getOnlinePlayers()) {
  52.                     if(rushWars.getIngamePhase().getWinningTeam() != null)
  53.                         rushWars.getActionBarManager().sendActionBar(all, "§7Team " + rushWars.getIngamePhase().getWinningTeam().getColoredName() + " §7hat §agewonnen§7!");
  54.                 }
  55.  
  56.                 countdown--;
  57.  
  58.             }
  59.         }, 0L, 20L);
  60.     }
  61. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top