๐Ÿ“‚ stewbeet.plugins.copy_to_destination

๐Ÿ“„ Source Code: stewbeet/plugins/copy_to_destination/__init__.py ๐Ÿ”—

๐Ÿ”— Dependencies

  • โœ… Required: Generated pack archives from archive plugin
  • โœ… Required: Configured destination paths in project metadata
  • ๐Ÿ“ Position: Should run after archive and merge_smithed_weld plugins
  • ๐Ÿ”ง Optional: Custom libraries in libs folder
  • ๐Ÿ”ง Optional: Official libraries (copies only used ones)
  • ๐Ÿ“‹ Related: Works with output from archive and merge plugins

๐Ÿ“‹ Overview

The copy_to_destination plugin automatically copies generated packs to configured destinations.
It handles copying datapacks, resource packs, library dependencies, and official libraries
to multiple destination folders with intelligent merge detection, retry logic for permission
handling, and proper directory structure management for development and testing workflows.

Some Features Showcase

Datapack and all dependencies are copied to destination

๐ŸŽฏ Purpose

  • ๐Ÿ“‚ Copies generated packs to configured destination folders
  • ๐Ÿ”— Handles both individual datapacks and merged resource packs
  • ๐Ÿ“š Automatically copies library dependencies and official libraries
  • ๐Ÿ”„ Provides retry logic for handling permission errors
  • ๐ŸŽฏ Supports multiple destinations for different environments (local and remote)
  • ๐ŸŒ Supports SFTP remote destinations with optional credentials file
  • ๐Ÿ› ๏ธ Facilitates development workflows with automatic deployment

โš™๏ธ Configuration

๐ŸŽฏ Basic Example Configuration

pipeline: - ... - stewbeet.plugins.copy_to_destination meta: stewbeet: build_copy_destinations: datapack: - "path/to/minecraft/saves/world/datapacks" - "path/to/development/datapacks" - "sftp://user@host/remote/path/datapacks" resource_pack: - "path/to/minecraft/resourcepacks" - "path/to/server/resourcepacks" - "sftp://user@host/remote/path/resourcepacks" libs_folder: "libs" # Optional: custom libraries folder

๐Ÿ“‹ Configuration Options

OptionTypeDefaultDescription
build_copy_destinationsobject{}Configuration for copy destinations
build_copy_destinations.datapackarray[]List of datapack destination paths (local or sftp://)
build_copy_destinations.resource_packarray[]List of resource pack destination paths (local or sftp://)
libs_folderstring"libs"Folder containing custom library archives
Retry Logicautomatic10 attemptsMaximum retry attempts for permission errors (local only)

๐Ÿ” SFTP Credentials

SFTP destinations use the URL format sftp://user@host/remote/path. The password is resolved in this order:

  1. Inline in the URL โ€” sftp://user:password@host/remote/path (not recommended for version-controlled files)
  2. Credentials file โ€” ~/stewbeet/credentials.yml (recommended)

~/stewbeet/credentials.yml structure

sftp: user@host: # must match the user@host part of the SFTP URL exactly password: "your_password"

โš ๏ธ If the remote directory does not exist, the copy is skipped with a warning. The plugin will not create remote directories.

โœจ Features

๐Ÿ“ฆ Datapack Distribution System

Copies main datapacks and library dependencies to configured destinations:

  • ๐Ÿ“ Copies main project datapack to all configured destinations
  • ๐Ÿ“š Automatically includes all library datapacks from libs folder
  • ๐Ÿ” Scans for .zip files in the libraries datapack directory
  • โœ… Creates destination directories if they don't exist

๐ŸŽจ Resource Pack Management

Handles resource pack copying with merge detection:

  • ๐Ÿ”— Prioritizes merged resource packs over individual ones
  • ๐Ÿ“ฆ Falls back to normal resource pack if merged version unavailable
  • ๐Ÿท๏ธ Preserves appropriate naming for merged vs normal packs
  • ๐Ÿ“ Maintains proper file organization in destination folders

๐Ÿ›๏ธ Official Library Distribution

Copies used official libraries to datapack destinations:

  • ๐Ÿ“š Only copies libraries marked as used in the project
  • ๐Ÿ” Validates library existence before copying
  • ๐Ÿ“ Organizes libraries in appropriate destination folders
  • โœ… Provides informative logging for each copied library

๐Ÿ”„ Retry Logic System

Implements robust file copying with error handling:

  • ๐Ÿ›ก๏ธ Handles permission errors with automatic retry logic
  • โฐ Uses configurable delay between retry attempts
  • ๐Ÿงน Attempts to remove existing files before copying
  • โš ๏ธ Provides warnings during retry attempts with clear messaging

๐ŸŒ SFTP Remote Destinations

Copies files to remote servers over SFTP:

  • ๐Ÿ”— Accepts sftp://user@host/path URLs alongside local paths
  • ๐Ÿ” Resolves passwords from inline URL or ~/stewbeet/credentials.yml
  • โš ๏ธ Skips copy with a warning if the remote directory does not exist
  • ๐Ÿšซ No retry logic for SFTP (handled by the underlying fsspec library)

๐Ÿ“Š Smart Copy Detection

Intelligently determines which files to copy based on availability:

  • ๐Ÿ” Checks for pack existence before attempting copies
  • ๐Ÿ“‹ Skips operations when no destinations are configured
  • ๐ŸŽฏ Validates project configuration requirements
  • โœ… Provides early exit for efficiency when no work is needed