Exemplo n.º 1
0
  public GameTimer(GameManager game, int time) {
    gameManager = game;

    timeLeft = time;
    timeState =
        Bukkit.getScheduler().scheduleSyncRepeatingTask(HotPotato.getPlugin(), this, 20L, 20L);
  }
Exemplo n.º 2
0
  public void run() {
    if (gm.isBomb()) {
      int timer = gm.getBombTimer();

      if (timer != 0) {
        timer--;
        gm.setLobbyTimer(timer);

        for (Player p : gm.getArenaPlayers()) {
          p.setLevel(timer);
        }
      } else {
        gm.removePlayer(gm.getPotatoCarrier());

        for (Player p : gm.getArenaPlayers()) {
          p.setLevel(0);
          p.setExp(0);
          p.playSound(p.getLocation(), Sound.LEVEL_UP, 1, 10);
        }

        plugin.getServer().getScheduler().cancelTask(gm.getBomb());
        gm.setBombTimer(-1);
      }
    }
  }
Exemplo n.º 3
0
  @Override
  public void runCommand(CommandSender sender, String[] args) {
    String maps = "";
    for (GameManager gameManager : HotPotato.getGames()) {
      String key =
          MessageUtil.getText(
              "gameListGame",
              gameManager.getGameName(),
              Integer.toString(gameManager.getGamePlayers().size()),
              Integer.toString(FileHandler.ConfigFile.getFile().getInt("maxPlayers")));
      maps = maps + ", " + key;
    }

    MessageUtil.sendTextMessage(sender, "gameList", maps.substring(2));
  }