コード例 #1
0
  public void refreshSingleLines() {
    if (world.isChunkLoaded(chunkX, chunkZ)) {

      double currentY = this.y;
      boolean first = true;

      for (CraftHologramLine line : lines) {

        currentY -= line.getHeight();

        if (first) {
          first = false;
        } else {
          currentY -= Configuration.spaceBetweenLines;
        }

        if (line.isSpawned()) {
          line.teleport(x, currentY, z);
        } else {
          line.spawn(world, x, currentY, z);
          if (allowPlaceholders && line instanceof CraftTextLine) {
            PlaceholdersManager.trackIfNecessary((CraftTextLine) line);
          }
        }
      }
    }
  }
コード例 #2
0
  @Override
  public void setAllowPlaceholders(boolean allowPlaceholders) {
    if (this.allowPlaceholders != allowPlaceholders) {

      if (allowPlaceholders) {
        // Now allowed, previously weren't
        for (CraftHologramLine line : lines) {
          if (line instanceof CraftTextLine) {
            PlaceholdersManager.trackIfNecessary((CraftTextLine) line);
          }
        }

      } else {

        // Now not allowed
        for (CraftHologramLine line : lines) {
          if (line instanceof CraftTextLine) {
            PlaceholdersManager.untrack((CraftTextLine) line);
          }
        }
      }

      this.allowPlaceholders = allowPlaceholders;
    }
  }
コード例 #3
0
  /** Forces the entities to spawn, without checking if the chunk is loaded. */
  public void spawnEntities() {
    Validator.isTrue(!deleted, "hologram already deleted");

    despawnEntities();

    double currentY = this.y;
    boolean first = true;

    for (CraftHologramLine line : lines) {

      currentY -= line.getHeight();

      if (first) {
        first = false;
      } else {
        currentY -= Configuration.spaceBetweenLines;
      }

      line.spawn(world, x, currentY, z);
      if (allowPlaceholders && line instanceof CraftTextLine) {
        PlaceholdersManager.trackIfNecessary((CraftTextLine) line);
      }
    }
  }