Package com.ranull.graves.integration
Class WorldEdit
java.lang.Object
com.ranull.graves.integration.WorldEdit
Provides integration with WorldEdit for schematic operations.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate 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
clearEditSessionForGrave
(UUID graveUUID) void
clearSchematic
(Grave grave) 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
getEditSessionForGrave
(UUID graveUUID) 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
hasSchematic
(String string) Checks if a schematic with the specified name exists.void
loadData()
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
saveData()
Saves WorldEdit schematics from the WorldEdit plugin's directory to the Graves plugin's data folder.
-
Field Details
-
plugin
-
worldEditPlugin
private final org.bukkit.plugin.Plugin worldEditPlugin -
worldEdit
private final com.sk89q.worldedit.WorldEdit worldEdit -
stringClipboardMap
-
graveEditSessions
-
graveBlockStates
-
-
Constructor Details
-
WorldEdit
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
-
clearEditSessionForGrave
-
createSchematic
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, otherwisefalse
.
-
hasSchematic
Checks if a schematic with the specified name exists.- Parameters:
string
- The name of the schematic.- Returns:
true
if the schematic exists, otherwisefalse
.
-
getAreaSchematic
-
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
-
saveCurrentBlockState
private void saveCurrentBlockState(org.bukkit.Location location, com.sk89q.worldedit.EditSession editSession, Grave grave) -
getSchematic
-
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
-
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)
-