Class Sanitizer

java.lang.Object
de.eldoria.schematicsanitizer.sanitizer.Sanitizer

public class Sanitizer extends Object
The core class to sanitize a schematic.

Create a Sanitizer instance via create(Path, Settings). After that you can either get a report via check() or directly fix() the schematic by removing invalid blocks and entities.

  • Method Details

    • create

      public static Sanitizer create(Path path, Settings settings) throws IOException
      Creates a new Sanitizer instance with the given path and settings.
      Parameters:
      path - the path to the file to be sanitized
      settings - the settings to be used for sanitizing the file
      Returns:
      a new Sanitizer instance
      Throws:
      IOException - if an I/O error occurs while creating the Sanitizer instance
    • check

      public SanitizerReport check() throws IOException
      Executes the sanitization process and returns the resulting SanitizerReport.
      Returns:
      the SanitizerReport containing the results of the sanitization process
      Throws:
      IOException - if an I/O error occurs during the sanitization process
    • fix

      public SanitizerReport fix() throws IOException
      Executes the fix process and returns the resulting SanitizerReport.
      Returns:
      the SanitizerReport containing the results of the fix process
      Throws:
      IOException - if an I/O error occurs during the fix process
    • fix

      public SanitizerReport fix(String newName) throws IOException
      Executes the fix process using the specified newName and returns the resulting SanitizerReport.
      Parameters:
      newName - the name of the fixed file
      Returns:
      the SanitizerReport containing the results of the fix process
      Throws:
      IOException - if an I/O error occurs during the fix process
    • fix

      public SanitizerReport fix(Path newPath) throws IOException
      Executes the fix process using the specified newPath and returns the resulting SanitizerReport.
      Parameters:
      newPath - the new path of the fixed file
      Returns:
      the SanitizerReport containing the results of the fix process
      Throws:
      IOException - if an I/O error occurs during the fix process
    • name

      public String name()
      Returns the name of the file without the file extension.
      Returns:
      the name of the file without the file extension.