Package com.plotsquared.core.util
Class SchematicHandler
java.lang.Object
com.plotsquared.core.util.SchematicHandler
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSchematicHandler(@NonNull WorldUtil worldUtil, @NonNull ProgressSubscriberFactory subscriberFactory)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
CompletableFuture<com.sk89q.jnbt.CompoundTag>
getCompoundTag(@NonNull Plot plot)
Get the given plot asCompoundTag
matching the Sponge schematic format.@NonNull CompletableFuture<com.sk89q.jnbt.CompoundTag>
getCompoundTag(@NonNull String worldName, @NonNull Set<com.sk89q.worldedit.regions.CuboidRegion> regions)
Get the contents of the given regions in the given world asCompoundTag
matching the Sponge schematic format.getSchematic(@NonNull InputStream is)
getSchematic(@NonNull URL url)
getSchematic(File file)
Get a schematicgetSchematic(String name)
Get a schematicGet an immutable collection containing all schematic namesvoid
paste(Schematic schematic, Plot plot, int xOffset, int yOffset, int zOffset, boolean autoHeight, PlotPlayer<?> actor, RunnableVal<Boolean> whenDone)
Paste a schematic.abstract boolean
restoreTile(QueueCoordinator queue, com.sk89q.jnbt.CompoundTag tag, int x, int y, int z)
boolean
Saves a schematic to a file path.static void
upload(@Nullable UUID uuid, @Nullable String file, @NonNull String extension, @Nullable RunnableVal<OutputStream> writeTask, @NonNull RunnableVal<URL> whenDone)
Deprecated, for removal: This API element is subject to removal in a future version.void
upload(com.sk89q.jnbt.CompoundTag tag, UUID uuid, String file, RunnableVal<URL> whenDone)
Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
manager
-
-
Constructor Details
-
SchematicHandler
@Inject public SchematicHandler(@NonNull WorldUtil worldUtil, @NonNull ProgressSubscriberFactory subscriberFactory)
-
-
Method Details
-
upload
@Deprecated(forRemoval=true) public static void upload(@Nullable UUID uuid, @Nullable String file, @NonNull String extension, @Nullable RunnableVal<OutputStream> writeTask, @NonNull RunnableVal<URL> whenDone)Deprecated, for removal: This API element is subject to removal in a future version. -
exportAll
public boolean exportAll(Collection<Plot> collection, File outputDir, String namingScheme, Runnable ifSuccess) -
paste
public void paste(Schematic schematic, Plot plot, int xOffset, int yOffset, int zOffset, boolean autoHeight, PlotPlayer<?> actor, RunnableVal<Boolean> whenDone)Paste a schematic.- Parameters:
schematic
- the schematic object to pasteplot
- plot to paste inxOffset
- offset x to paste it from plot originyOffset
- offset y to paste it from plot originzOffset
- offset z to paste it from plot originautoHeight
- if to automatically choose height to paste fromactor
- the actor pasting the schematicwhenDone
- task to run when schematic is pasted
-
restoreTile
public abstract boolean restoreTile(QueueCoordinator queue, com.sk89q.jnbt.CompoundTag tag, int x, int y, int z) -
getSchematic
Get a schematic- Parameters:
name
- to check- Returns:
- schematic if found, else null
- Throws:
SchematicHandler.UnsupportedFormatException
- thrown if schematic format is unsupported
-
getSchematicNames
Get an immutable collection containing all schematic names- Returns:
- Immutable collection with schematic names
-
getSchematic
Get a schematic- Parameters:
file
- to check- Returns:
- schematic if found, else null
- Throws:
SchematicHandler.UnsupportedFormatException
- thrown if schematic format is unsupported
-
getSchematic
-
getSchematic
-
getSaves
-
upload
@Deprecated(forRemoval=true) public void upload(com.sk89q.jnbt.CompoundTag tag, UUID uuid, String file, RunnableVal<URL> whenDone)Deprecated, for removal: This API element is subject to removal in a future version. -
save
Saves a schematic to a file path.- Parameters:
tag
- to savepath
- to save in- Returns:
- true if succeeded
-
getCompoundTag
Get the given plot asCompoundTag
matching the Sponge schematic format.- Parameters:
plot
- The plot to get the contents from.- Returns:
- a
CompletableFuture
that provides the createdCompoundTag
.
-
getCompoundTag
public @NonNull CompletableFuture<com.sk89q.jnbt.CompoundTag> getCompoundTag(@NonNull String worldName, @NonNull Set<com.sk89q.worldedit.regions.CuboidRegion> regions)Get the contents of the given regions in the given world asCompoundTag
matching the Sponge schematic format.- Parameters:
worldName
- The world to get the contents from.regions
- The regions to get the contents from.- Returns:
- a
CompletableFuture
that provides the createdCompoundTag
.
-