コード例 #1
0
  /**
   * Reverts any player's entire visualization buffer
   *
   * @param player
   */
  public void revert(Player player) {
    Visualization vis = visualizations.get(player.getName());

    if (vis != null) {
      visualizations.remove(player.getName());
      Visualize visualize = new Visualize(vis.getBlocks(), player, true, false, 0);
    }
  }
コード例 #2
0
  /** Reverts all current visualizations */
  public void revertAll() {
    for (String playerName : visualizations.keySet()) {
      Visualization vis = visualizations.get(playerName);
      Player player = Bukkit.getServer().getPlayerExact(playerName);

      if (player != null) {
        Visualize visualize = new Visualize(vis.getBlocks(), player, true, false, 0);
      }
    }
    visualizations.clear();
    counts.clear();
  }
コード例 #3
0
  /**
   * Displays contents of a player's visualization buffer to the player
   *
   * @param player
   * @param minusOverlap
   */
  public void displayVisualization(final Player player, boolean minusOverlap, int seconds) {
    Visualization vis = visualizations.get(player.getName());

    if (vis != null) {
      if (minusOverlap) {
        for (Iterator<BlockEntry> iter = vis.getBlocks().iterator(); iter.hasNext(); ) {
          BlockEntry bd = iter.next();
          Location loc = bd.getLocation();

          for (Field field : vis.getFields()) {
            if (field.envelops(loc)) {
              iter.remove();
              break;
            }
          }
        }

        Visualize visualize = new Visualize(vis.getBlocks(), player, false, false, seconds);
      } else {
        Visualize visualize = new Visualize(vis.getBlocks(), player, false, false, seconds);
      }
    }
  }