コード例 #1
0
  // reverts a visualization by sending another block change list, this time with the real world
  // block values
  public static void Revert(Player player) {
    PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getName());

    // Visualization visualization = playerData.currentVisualization;

    if (playerData.ActiveVisualizations.size() > 0) {
      if (player.isOnline()) {
        for (Visualization visualization : playerData.ActiveVisualizations) {
          for (int i = 0; i < visualization.elements.size(); i++) {
            VisualizationElement element = visualization.elements.get(i);
            Block block = element.location.getBlock();
            player.sendBlockChange(element.location, block.getType(), block.getData());
          }
        }
      }

      playerData.ActiveVisualizations.clear();
    }
  }
コード例 #2
0
  public static void Apply(Player player, Visualization visualization, boolean CancelCurrent) {
    PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getName());

    // if he has any current visualization, clear it first
    if (playerData.ActiveVisualizations.size() > 0 && CancelCurrent) {
      Visualization.Revert(player);
    }

    // if he's online, create a task to send him the visualization in about half a second
    if (player.isOnline()) {
      GriefPrevention.instance
          .getServer()
          .getScheduler()
          .scheduleSyncDelayedTask(
              GriefPrevention.instance,
              new VisualizationApplicationTask(player, playerData, visualization),
              10L);
    }
  }