Advertisement
Guest User

code start

a guest
Sep 4th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.03 KB | None | 0 0
  1. public class StartCommand implements CommandExecutor {
  2.  
  3.       private Main instance;
  4.       public StartCommand(Main instance) {
  5.         this.instance = instance;
  6.       }
  7.  
  8.       public Integer counttime = ScoreboardAPI.counttime;
  9.       public Integer gametime = ScoreboardAPI.gametime;
  10.       ScoreboardAPI sc = new ScoreboardAPI();
  11.  
  12.     public boolean onCommand(CommandSender send, Command cmd, String label, String[] args) {
  13.         if (cmd.getName().equalsIgnoreCase("start")) {
  14.             new BukkitRunnable() {
  15.                 public void run() {
  16.                     for (Player p : Bukkit.getOnlinePlayers()) {
  17.                         if (counttime <= 0) {
  18.                             counttime+=10;
  19.                             p.sendTitle("ゲームスタート", "~~Mob_Attacker~~", 10, 10, 10);
  20.                             sc.mob.setDisplaySlot(DisplaySlot.SIDEBAR);
  21.                             this.cancel();
  22.                         }
  23.                         else {
  24.                             p.sendMessage("ゲーム開始まで " + String.valueOf(counttime) + "秒");
  25.                             p.playSound(p.getLocation(), Sound.UI_BUTTON_CLICK, 50, 50);
  26.                             counttime--;
  27.                         }
  28.                     }
  29.                     gametime--;
  30.                 }
  31.             }.runTaskTimer(instance, 0L, 20L);
  32.             new BukkitRunnable() {
  33.                 public void run() {
  34.                     for (Player p : Bukkit.getOnlinePlayers()) {
  35.                         if (gametime == 0) {
  36.                             gametime+=910;
  37.                             sc.mob.setDisplayName("Mob_Attacker");
  38.                             p.sendTitle("ゲーム終了", "~~Mob_Attacker~~", 10, 10, 10);
  39.                             this.cancel();
  40.                         }
  41.                         else {
  42.                             sc.board.resetScores(String.valueOf((gametime%3600) / 60) + ":" + String.valueOf(gametime % 60));
  43.                             sc.mob.getScore(String.valueOf((gametime%3600) / 60) + ":" + String.valueOf(gametime % 60)).setScore(22);
  44.                             gametime--;
  45.                         }
  46.                     }
  47.                 }
  48.             }.runTaskTimer(instance, 0L, 20L);
  49.         }
  50.         return false;
  51.     }
  52. }
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement