Class Schematic

java.lang.Object
de.eldoria.schematicbrush.schematics.Schematic
All Implemented Interfaces:
Comparable<Schematic>

public class Schematic extends Object implements Comparable<Schematic>
A loaded schematic which allows to load a schematic into a clipboard
  • Method Details

    • of

      public static Schematic of(File file) throws InvalidClipboardFormatException
      Create a schematic by file
      Parameters:
      file - file
      Returns:
      schematic
      Throws:
      InvalidClipboardFormatException - when the format could not be determined
    • of

      public static Schematic of(Path path) throws InvalidClipboardFormatException
      Create a schematic by path
      Parameters:
      path - path
      Returns:
      schematic
      Throws:
      InvalidClipboardFormatException - when the format could not be determined
    • isSchematic

      public boolean isSchematic(Pattern pattern)
      Matches a pattern against the file name.
      Parameters:
      pattern - pattern to match
      Returns:
      true if the pattern matches the file name with or without extension
    • path

      public String path()
      Get the path to the file.
      Returns:
      path of file as string
    • name

      public String name()
      Get the name of the file without file extension
      Returns:
      name of file
    • loadSchematic

      public com.sk89q.worldedit.extent.clipboard.Clipboard loadSchematic() throws IOException
      Load the schematic from file.
      Returns:
      the schematic wrapped in a clipboard object
      Throws:
      IOException - if the file could not be loaded. This should only happen, if the schematic was deleted or moved.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getFile

      public File getFile()
      Schematic file
      Returns:
      file
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • effectiveSize

      public int effectiveSize()
      The effective size of the schematic without air.
      Returns:
      effective schematic size
    • size

      public int size()
      The total block size of the schematic. Including air blocks.
      Returns:
      block count of schematics
    • blockCount

      public Map<Material,Integer> blockCount()
      Calculates and returns a map which contains the block count of every material in this schematic.
      Returns:
      map with block counts
    • compareTo

      public int compareTo(@NotNull @NotNull Schematic other)
      Specified by:
      compareTo in interface Comparable<Schematic>
    • format

      public com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat format()
    • toString

      public String toString()
      Overrides:
      toString in class Object