Package com.palmergames.bukkit.towny.object

Examples of com.palmergames.bukkit.towny.object.PlotBlockData


                town.setHomeBlock(townBlock);
                town.setSpawn(spawn);
                //world.addTown(town);
               
                if (world.isUsingPlotManagementRevert()) {
                  PlotBlockData plotChunk = TownyRegenAPI.getPlotChunk(townBlock);
                if (plotChunk != null) {
                  TownyRegenAPI.deletePlotChunk(plotChunk); // just claimed so stop regeneration.
                } else {
                  plotChunk = new PlotBlockData(townBlock); // Not regenerating so create a new snapshot.
                  plotChunk.initialize();
                }
                TownyRegenAPI.addPlotChunkSnapshot(plotChunk); // Save a snapshot.
                plotChunk = null;
                }
                TownyMessaging.sendDebugMsg("Creating new Town account: " + "town-"+name);
View Full Code Here


   
    // Take a snapshot of the next townBlock and save.
    if (TownyRegenAPI.hasWorldCoords()) {
      try {
        TownBlock townBlock = TownyRegenAPI.getWorldCoord().getTownBlock();
        PlotBlockData plotChunk = new PlotBlockData(townBlock);
          plotChunk.initialize(); // Create a new snapshot.

          if (!plotChunk.getBlockList().isEmpty() && !(plotChunk.getBlockList() == null))
            TownyRegenAPI.addPlotChunkSnapshot(plotChunk); // Save the snapshot.
       
          plotChunk = null;
         
          townBlock.setLocked(false);
View Full Code Here

    if (townBlock.getWorld().isUsingPlotManagementDelete())
      universe.deleteTownBlockIds(townBlock);

    // Move the plot to be restored
    if (townBlock.getWorld().isUsingPlotManagementRevert()) {
      PlotBlockData plotData = TownyRegenAPI.getPlotChunkSnapshot(townBlock);
      if (plotData != null && !plotData.getBlockList().isEmpty()) {
        TownyRegenAPI.addPlotChunk(plotData, true);
      }
    }

    universe.setChangedNotify(REMOVE_TOWN_BLOCK);
View Full Code Here

                // Set the plot permissions to mirror the towns.
                townBlock.setType(townBlock.getType());
                TownyUniverse.getDataSource().saveTownBlock(townBlock);
               
                if (town.getWorld().isUsingPlotManagementRevert()) {
                  PlotBlockData plotChunk = TownyRegenAPI.getPlotChunk(townBlock);
                if (plotChunk != null) {
                  TownyRegenAPI.deletePlotChunk(plotChunk); // just claimed so stop regeneration.
                  townBlock.setLocked(false);
                } else {
                  //plotChunk = new PlotBlockData(townBlock); // Not regenerating so create a new snapshot.
View Full Code Here

    sendDebugMsg("Loading Regen List");

    String line;
    BufferedReader fin;
    String[] split;
    PlotBlockData plotData;

    try {
      fin = new BufferedReader(new FileReader(rootFolder + dataFolder + FileMgmt.fileSeparator() + "regen.txt"));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
View Full Code Here

    String fileName = getPlotFilename(townBlock);

    int value;
   
    if (isFile(fileName)) {
      PlotBlockData plotBlockData = new PlotBlockData(townBlock);
      List<Integer>IntArr = new ArrayList<Integer>();
     
      try {
        BufferedReader fin = new BufferedReader(new FileReader(fileName));
        try {
          //read the first 3 characters to test for version info
          char[] key = new char[3];
          fin.read(key,0,3);
          String test = new String(key);
         
          switch (elements.fromString(test)) {
          case VER:
            // Read the file version
            int version = fin.read();
            plotBlockData.setVersion(version);
           
            // next entry is the plot height
            plotBlockData.setHeight(fin.read());
            break;
           
          default:
            /*
             * no version field so set height
             * and push rest to queue
             *
             */
            plotBlockData.setVersion(0);
            // First entry is the plot height
            plotBlockData.setHeight(key[0]);
            IntArr.add((int) key[1]);
            IntArr.add((int) key[2]);
          }
         
          // load remainder of file
          while ((value = fin.read()) >= 0) {
            IntArr.add(value)
          }
        } catch (IOException e) {
          e.printStackTrace();
        }
        fin.close();
      } catch (IOException e) {
        e.printStackTrace();
      }
      plotBlockData.setBlockList(IntArr);
      plotBlockData.resetBlockListRestored();
      return plotBlockData;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of com.palmergames.bukkit.towny.object.PlotBlockData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.