Class WorldEdit

java.lang.Object
com.ranull.graves.integration.WorldEdit

public final class WorldEdit extends Object
Provides integration with WorldEdit for schematic operations.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Map<UUID,Map<com.sk89q.worldedit.math.BlockVector3,com.sk89q.worldedit.world.block.BlockState>>
     
    private final Map<UUID,com.sk89q.worldedit.EditSession>
     
    private final Graves
     
    private final Map<String,com.sk89q.worldedit.extent.clipboard.Clipboard>
     
    private final com.sk89q.worldedit.WorldEdit
     
    private final org.bukkit.plugin.Plugin
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    WorldEdit(Graves plugin, org.bukkit.plugin.Plugin worldEditPlugin)
    Constructs a new WorldEdit integration instance with the specified plugin and WorldEdit plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    private org.bukkit.Location
    blockVector3ToLocation(org.bukkit.World world, com.sk89q.worldedit.math.BlockVector3 blockVector3)
     
    void
    buildSchematic(com.sk89q.worldedit.session.PasteBuilder pasteBuilder)
    Builds a schematic using the specified PasteBuilder.
    boolean
    canBuildSchematic(org.bukkit.Location location, org.bukkit.block.BlockFace blockFace, String name)
    Checks if a schematic can be built at the specified location based on the schematic's dimensions and block face.
    private void
     
    void
     
    private com.sk89q.worldedit.EditSession
    createEditSessionForGrave(UUID graveUUID, org.bukkit.World world)
     
    void
    createSchematic(org.bukkit.Location location, Grave grave)
    Creates and places a schematic at the specified location based on the configuration for the given grave.
    void
    getAreaSchematic(org.bukkit.Location location, float yaw, File file)
     
    private com.sk89q.worldedit.EditSession
    getEditSession(org.bukkit.World world)
     
    private com.sk89q.worldedit.EditSession
     
    private com.sk89q.worldedit.extent.clipboard.Clipboard
    getSchematic(org.bukkit.Location location, float yaw, String name, boolean ignoreAirBlocks)
    Retrieves a Clipboard for the specified schematic at the given location with rotation based on yaw.
    private com.sk89q.worldedit.extent.clipboard.Clipboard
    getSchematic(org.bukkit.Location location, float yaw, String name, Grave grave)
     
    private com.sk89q.worldedit.math.transform.AffineTransform
    getYawTransform(float yaw)
     
    boolean
    Checks if a schematic with the specified name exists.
    void
    Loads WorldEdit schematics from the Graves plugin's data folder into memory.
    private com.sk89q.worldedit.math.BlockVector3
    locationToBlockVector3(org.bukkit.Location location)
    Converts a Bukkit Location to a WorldEdit BlockVector3.
    com.sk89q.worldedit.extent.clipboard.Clipboard
    pasteSchematic(org.bukkit.Location location, float yaw, String name, Grave grave)
    Pastes a schematic at the specified location with rotation based on yaw.
    com.sk89q.worldedit.extent.clipboard.Clipboard
    pasteSchematic(org.bukkit.Location location, float yaw, String name, Grave grave, boolean ignoreAirBlocks)
     
    com.sk89q.worldedit.extent.clipboard.Clipboard
    pasteSchematic(org.bukkit.Location location, String name, Grave grave)
    Pastes a schematic at the specified location.
    private void
    restoreBlockState(com.sk89q.worldedit.EditSession editSession, Grave grave)
     
    private void
    saveCurrentBlockState(org.bukkit.Location location, com.sk89q.worldedit.EditSession editSession, Grave grave)
     
    void
    Saves WorldEdit schematics from the WorldEdit plugin's directory to the Graves plugin's data folder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plugin

      private final Graves plugin
    • worldEditPlugin

      private final org.bukkit.plugin.Plugin worldEditPlugin
    • worldEdit

      private final com.sk89q.worldedit.WorldEdit worldEdit
    • stringClipboardMap

      private final Map<String,com.sk89q.worldedit.extent.clipboard.Clipboard> stringClipboardMap
    • graveEditSessions

      private final Map<UUID,com.sk89q.worldedit.EditSession> graveEditSessions
    • graveBlockStates

      private final Map<UUID,Map<com.sk89q.worldedit.math.BlockVector3,com.sk89q.worldedit.world.block.BlockState>> graveBlockStates
  • Constructor Details

    • WorldEdit

      public WorldEdit(Graves plugin, org.bukkit.plugin.Plugin worldEditPlugin)
      Constructs a new WorldEdit integration instance with the specified plugin and WorldEdit plugin.
      Parameters:
      plugin - The Graves plugin instance.
      worldEditPlugin - The WorldEdit plugin instance.
  • Method Details

    • saveData

      public void saveData()
      Saves WorldEdit schematics from the WorldEdit plugin's directory to the Graves plugin's data folder.
    • loadData

      public void loadData()
      Loads WorldEdit schematics from the Graves plugin's data folder into memory.
    • createEditSessionForGrave

      private com.sk89q.worldedit.EditSession createEditSessionForGrave(UUID graveUUID, org.bukkit.World world)
    • getEditSessionForGrave

      private com.sk89q.worldedit.EditSession getEditSessionForGrave(UUID graveUUID)
    • clearEditSessionForGrave

      private void clearEditSessionForGrave(UUID graveUUID)
    • createSchematic

      public void createSchematic(org.bukkit.Location location, Grave grave)
      Creates and places a schematic at the specified location based on the configuration for the given grave.
      Parameters:
      location - The location to place the schematic.
      grave - The grave instance containing configuration details.
    • canBuildSchematic

      public boolean canBuildSchematic(org.bukkit.Location location, org.bukkit.block.BlockFace blockFace, String name)
      Checks if a schematic can be built at the specified location based on the schematic's dimensions and block face.
      Parameters:
      location - The location to check.
      blockFace - The block face to check against.
      name - The name of the schematic.
      Returns:
      true if the schematic can be built, otherwise false.
    • hasSchematic

      public boolean hasSchematic(String string)
      Checks if a schematic with the specified name exists.
      Parameters:
      string - The name of the schematic.
      Returns:
      true if the schematic exists, otherwise false.
    • getAreaSchematic

      public void getAreaSchematic(org.bukkit.Location location, float yaw, File file)
    • pasteSchematic

      public com.sk89q.worldedit.extent.clipboard.Clipboard pasteSchematic(org.bukkit.Location location, String name, Grave grave)
      Pastes a schematic at the specified location.
      Parameters:
      location - The location to paste the schematic.
      name - The name of the schematic.
      Returns:
      The Clipboard of the pasted schematic, or null if the schematic could not be pasted.
    • pasteSchematic

      public com.sk89q.worldedit.extent.clipboard.Clipboard pasteSchematic(org.bukkit.Location location, float yaw, String name, Grave grave)
      Pastes a schematic at the specified location with rotation based on yaw.
      Parameters:
      location - The location to paste the schematic.
      yaw - The yaw rotation for the schematic.
      name - The name of the schematic.
      Returns:
      The Clipboard of the pasted schematic, or null if the schematic could not be pasted.
    • pasteSchematic

      public com.sk89q.worldedit.extent.clipboard.Clipboard pasteSchematic(org.bukkit.Location location, float yaw, String name, Grave grave, boolean ignoreAirBlocks)
    • saveCurrentBlockState

      private void saveCurrentBlockState(org.bukkit.Location location, com.sk89q.worldedit.EditSession editSession, Grave grave)
    • getSchematic

      private com.sk89q.worldedit.extent.clipboard.Clipboard getSchematic(org.bukkit.Location location, float yaw, String name, Grave grave)
    • getSchematic

      private com.sk89q.worldedit.extent.clipboard.Clipboard getSchematic(org.bukkit.Location location, float yaw, String name, boolean ignoreAirBlocks)
      Retrieves a Clipboard for the specified schematic at the given location with rotation based on yaw.
      Parameters:
      location - The location to paste the schematic.
      yaw - The yaw rotation for the schematic.
      name - The name of the schematic.
      ignoreAirBlocks - Whether to ignore air blocks when pasting.
      Returns:
      A Clipboard for the schematic, or null if the schematic could not be found.
    • clearSchematic

      public void clearSchematic(Grave grave)
    • restoreBlockState

      private void restoreBlockState(com.sk89q.worldedit.EditSession editSession, Grave grave) throws com.sk89q.worldedit.MaxChangedBlocksException
      Throws:
      com.sk89q.worldedit.MaxChangedBlocksException
    • buildSchematic

      public void buildSchematic(com.sk89q.worldedit.session.PasteBuilder pasteBuilder)
      Builds a schematic using the specified PasteBuilder.
      Parameters:
      pasteBuilder - The PasteBuilder to use for building the schematic.
    • getYawTransform

      private com.sk89q.worldedit.math.transform.AffineTransform getYawTransform(float yaw)
    • locationToBlockVector3

      private com.sk89q.worldedit.math.BlockVector3 locationToBlockVector3(org.bukkit.Location location)
      Converts a Bukkit Location to a WorldEdit BlockVector3.
      Parameters:
      location - The Bukkit Location to convert.
      Returns:
      The equivalent WorldEdit BlockVector3.
    • blockVector3ToLocation

      private org.bukkit.Location blockVector3ToLocation(org.bukkit.World world, com.sk89q.worldedit.math.BlockVector3 blockVector3)
    • getEditSession

      private com.sk89q.worldedit.EditSession getEditSession(org.bukkit.World world)