示例#1
0
  @Override
  public void run() {
    plugin.debug.log("PlantTimer (" + getTaskId() + ") is running: " + duration);
    if (cancelled) return;
    duration = duration - 1;

    player.sendMessage("" + duration);
    plugin.playPlantDefuseNoise(BOMB_LOCATION, arena.getMatch().getPlayers());

    if (duration == 0) {
      Set<ArenaPlayer> allplayers = arena.getMatch().getPlayers();
      for (ArenaPlayer p : allplayers) {
        p.getPlayer()
            .sendMessage(
                "The bomb will detonate in " + plugin.getDetonationTime() + " seconds !!!");
      }
      if (player.getInventory() != null
          && player.getInventory().getHelmet() != null
          && player.getInventory().getHelmet().getType() == Material.TNT) {
        player.getInventory().setHelmet(new ItemStack(Material.AIR));
      }
      if (player.getInventory() != null && player.getInventory().contains(plugin.getBombBlock())) {
        player.getInventory().remove(plugin.getBombBlock());
        player.updateInventory();
      }
      this.detTimer = new DetonationTimer(arena, BOMB_LOCATION).start();

      player.closeInventory();
      // MatchUtil.continueMatchOnExpiration(arena.getMatch());
      MatchUtil.setTime(arena.getMatch(), plugin.getDetonationTime());
    }
  }
示例#2
0
 public PlantTimer(EodArena arena) {
   this.plugin = (BombPlugin) Bukkit.getPluginManager().getPlugin("BombArena");
   this.duration = this.plugin.getPlantTime() + 1;
   this.arena = arena;
   this.player = Bukkit.getPlayer(arena.getBombCarrier());
   this.BOMB_LOCATION = plugin.getExactLocation(player.getLocation());
 }