errorx.net

FxCustomTexture | FxStudio

Complete Minecraft Resource Pack & Custom Texture Generator

Develop a fully functional, optimized and production-ready Minecraft Java plugin named FxCustomTexture.

  1. Plugin Information
  • Plugin Name: FxCustomTexture
  • Author: FxStudio
  • Version: 1.0.0
  • Minecraft Version: 1.21.11
  • Server Software: Paper
  • Java Version: 21
  • Build System: Maven
  1. Main Purpose

FxCustomTexture is an advanced custom texture, font image and resource-pack generator.

Administrators must be able to:

  • Add custom PNG textures.
  • Register unlimited texture definitions.
  • Create custom texture codes.
  • Configure texture positioning and scaling.
  • Generate complete resource packs.
  • Export resource packs as ZIP.
  • Use MCPacks or other external hosting.
  • Configure resource-pack delivery.
  • Manage textures through commands and GUI.

The plugin must generate actual working resource packs, not just configuration files.

  1. Complete Project Structure

FxCustomTexture/ │ ├── src/main/java/me/fxstudio/fxcustomtexture/ │ ├── FxCustomTexture.java │ │ │ ├── commands/ │ │ └── FCTCommand.java │ │ │ ├── config/ │ │ └── ConfigManager.java │ │ │ ├── texture/ │ │ ├── TextureManager.java │ │ └── TextureData.java │ │ │ ├── generator/ │ │ ├── PackGenerator.java │ │ ├── FontGenerator.java │ │ └── ModelGenerator.java │ │ │ ├── gui/ │ │ └── TextureGUI.java │ │ │ ├── listeners/ │ │ └── GUIListener.java │ │ │ ├── hosting/ │ │ ├── HostingManager.java │ │ └── ResourcePackManager.java │ │ │ └── utils/ │ ├── ColorUtils.java │ ├── MessageUtils.java │ └── ZipUtils.java │ ├── src/main/resources/ │ ├── plugin.yml │ ├── config.yml │ └── texture.yml │ ├── contents/ ├── output/ ├── pom.xml └── README.md

  1. What Each File Does

File| Purpose FxCustomTexture.java| Main plugin initialization FCTCommand.java| All plugin commands ConfigManager.java| Configuration loading and saving TextureManager.java| Texture registration and management TextureData.java| Individual texture information PackGenerator.java| Complete resource-pack generation FontGenerator.java| Custom font and bitmap generation ModelGenerator.java| Required item model generation TextureGUI.java| Texture management GUI GUIListener.java| GUI interaction handling HostingManager.java| Resource-pack hosting configuration ResourcePackManager.java| Resource-pack delivery to players ColorUtils.java| HEX and legacy color processing MessageUtils.java| Prefix and message handling ZipUtils.java| ZIP creation and compression plugin.yml| Plugin metadata, commands and permissions config.yml| Main plugin configuration texture.yml| Individual texture definitions contents/| Original PNG texture files output/| Generated resource-pack ZIP files pom.xml| Maven dependencies and compilation README.md| Installation and usage documentation

  1. config.yml

Create an advanced, detailed and organized configuration system.

Use this configuration as the initial structure:

metrics: true update-checker: true

server: address: auto port: auto

resource-pack: uuid: "AUTO-GENERATE"

auto_apply: enabled: true before_join: true delay_ticks: 1

kick-player-on-decline: false kick-player-on-fail: false

hosting: no-host: enabled: false

lobfile: enabled: false

self-host: enabled: false server-ip: "127.0.0.1" pack-port: 8163 append-port: true

external-host: enabled: false provider: "MCPACKS" url: "" sha1: ""

title: enabled: true

fix_force_unicode_font_images: true

allow_other_plugins_resourcepacks: true notify_other_plugins_resourcepacks: true

zip: output-folder: "output" filename: "FxCustomTexture-Pack.zip"

compress-png-files: true compress-json-files: true

validate-json: true validate-textures: true generate-font-files: true generate-model-files: true

fix-font-ascent: true

minecraft-version: "1.21.11"

custom-font: enabled: false name: "custom.ttf" shift: "[0,0]" size: 11.0 oversample: 2.0

items:

CustomModelData-starting-value:

ALL: 10000 DIAMOND: 11000

config_files: lang: "en"

cache_font_images_and_effects_replacements: true

font_images: chat: enabled: true add_hover_suggestion: true tab_autocompletion: true

command: enabled: true

customitem_name_and_lore: enabled: true

sign: enabled: true

book: enabled: true

anvil: enabled: true

inventory-title: enabled: true

text_effects: enabled: true legacy_colors_compatibility: true

chat: enabled: true

customitem_name_and_lore: enabled: true

sign: enabled: true

book: enabled: true

anvil: enabled: true

debug: benchmark: false

resourcepacks: log_player_install: false log_compression: false

performance: loading-ms: true

issues: log_font_image_replace_json_syntax_exception: true

messages: prefix: "&#FFB930&lCustomTexture &8» &r"

no-permission: "%prefix%&cYou don't have permission." player-only: "%prefix%&cThis command can only be used by players."

reload: "%prefix%&aConfiguration reloaded successfully."

zip-start: "%prefix%&eGenerating resource pack..." zip-success: "%prefix%&aResource pack generated successfully!" zip-failed: "%prefix%&cResource pack generation failed."

texture-not-found: "%prefix%&cTexture not found." texture-created: "%prefix%&aTexture created successfully." texture-deleted: "%prefix%&aTexture deleted successfully."

invalid-usage: "%prefix%&cInvalid command usage." no-textures: "%prefix%&cNo textures registered."

validation-success: "%prefix%&aValidation completed." validation-error: "%prefix%&cErrors found in texture configurations."

gui-open: "%prefix%&aOpening texture GUI."

hosting-missing: "%prefix%&cResource-pack hosting URL is missing." hosting-invalid: "%prefix%&cInvalid resource-pack URL." pack-applied: "%prefix%&aResource pack applied successfully."

Configuration Requirements

  • Every setting must actually work.
  • All messages must be configurable.
  • Support HEX and legacy colors.
  • Preserve manually configured values during reload.
  • Generate UUID automatically if missing.
  • Validate URLs and SHA-1 hashes.
  • Do not create fake hosting links.
  • Invalid configuration must produce understandable console errors.
  • Do not implement unsupported settings as decoration.

The configuration should be modular and easy to expand.

  1. texture.yml

Example:

textures: heart: path: "contents/heart.png" use_code: ":heart:" permission: "" show_in_gui: true scale_ratio: 1.0 y_position: 0

crown: path: "contents/crown.png" use_code: ":crown:" permission: "fxcustomtexture.crown" show_in_gui: true scale_ratio: 1.0 y_position: 0

Texture Options

  • "path": PNG file location.
  • "use_code": Custom texture code.
  • "permission": Required permission.
  • "show_in_gui": GUI visibility.
  • "scale_ratio": Texture scaling.
  • "y_position": Vertical positioning.

Support unlimited configurable texture entries within practical Minecraft and resource-pack limitations.

  1. All Commands

Implement:

/fct /fct help /fct reload /fct zip /fct list /fct info <texture> /fct gui /fct give <player> <texture> /fct preview <texture> /fct create <name> /fct delete <name> /fct validate /fct version

Command Functions

  • "/fct": Main help menu.
  • "/fct help": Complete command list.
  • "/fct reload": Reload all configurations.
  • "/fct zip": Generate resource-pack ZIP.
  • "/fct list": List registered textures.
  • "/fct info": Display texture information.
  • "/fct gui": Open texture GUI.
  • "/fct give": Give a configured custom texture item where supported.
  • "/fct preview": Preview texture information.
  • "/fct create": Create a texture configuration template.
  • "/fct delete": Delete a texture definition safely.
  • "/fct validate": Validate all texture definitions and files.
  • "/fct version": Display plugin version.

Include tab completion and permission checks.

  1. Permissions

fxcustomtexture.admin fxcustomtexture.use fxcustomtexture.gui fxcustomtexture.zip fxcustomtexture.reload fxcustomtexture.list fxcustomtexture.info fxcustomtexture.give fxcustomtexture.create fxcustomtexture.delete fxcustomtexture.validate

Individual texture permissions must work.

  1. Resource Pack Generator

The "/fct zip" command must:

  1. Load texture.yml.
  2. Read all configured PNG files.
  3. Validate PNG files.
  4. Generate the correct Minecraft 1.21.11 resource-pack structure.
  5. Generate font JSON files.
  6. Generate required model files.
  7. Register custom texture codes.
  8. Apply scaling and positioning.
  9. Generate pack metadata.
  10. Compress files where configured.
  11. Validate generated JSON.
  12. Generate a working ZIP.
  13. Save the ZIP in output/.

Never generate an empty ZIP or an archive containing only PNG files.

  1. Previous Critical Error Fix

Previously, resource-pack generation failed with:

bitmap height/ascent out of range (y must be <= 0)

Investigate and permanently fix the underlying cause.

Requirements:

  • Follow Minecraft 1.21.11 bitmap font specifications.
  • Validate ascent and height values.
  • Validate PNG dimensions.
  • Validate character grids.
  • Calculate positioning correctly.
  • Generate valid font JSON.
  • Preserve scale_ratio and y_position functionality.
  • Never hide the error.
  • Never use random hardcoded values as a workaround.

Test generated font files before ZIP creation.

  1. MCPacks Integration

The plugin must support manual external hosting configuration.

Example:

resource-pack: hosting: external-host: enabled: true provider: "MCPACKS" url: "" sha1: ""

Intended Workflow

  1. Run "/fct zip".
  2. Obtain the generated ZIP.
  3. Upload the ZIP to MCPacks manually.
  4. Obtain the actual resource-pack link.
  5. Obtain the required SHA-1 hash.
  6. Paste the link into "url".
  7. Paste the SHA-1 into "sha1".
  8. Run "/fct reload".
  9. The plugin loads the configured resource-pack details.

Requirements:

  • Support manually configured external URLs.
  • Support SHA-1 validation.
  • Preserve entered values.
  • Never invent a URL.
  • Never invent a hash.
  • Do not pretend automatic MCPacks uploading exists.
  • Automatic uploading is optional and only allowed if an actual supported API exists.
  1. Resource Pack Hosting

Support:

No Hosting

Allow generating ZIP without hosting.

Self Hosting

Allow serving the generated resource pack through the configured server IP and port.

External Hosting

Allow using manually configured hosting URLs.

LobFile

Provide a hosting integration only if a supported method is available.

Do not claim unsupported hosting integrations work.

  1. Automatic Resource Pack Delivery

If enabled:

  • Send the configured resource pack to players.
  • Support configurable delay.
  • Support before-join delivery where technically possible.
  • Handle declined packs.
  • Handle failed downloads.
  • Respect kick-player-on-decline.
  • Respect kick-player-on-fail.
  • Validate hosting URL and SHA-1 before sending.
  1. GUI

Create a clean texture GUI.

Features:

  • Configurable title.
  • Configurable rows.
  • Texture display.
  • Permission-based visibility.
  • Pagination.
  • Previous and next buttons.
  • Safe click handling.
  • No unauthorized item movement.
  1. Optimization
  • Java 21.
  • Paper API 1.21.11.
  • Maven.
  • Async ZIP generation where appropriate.
  • Efficient texture caching.
  • Safe file handling.
  • No unnecessary dependencies.
  • No memory leaks.
  • No unnecessary server lag.
  • Proper exception handling.
  • No duplicate texture registration.
  1. Testing

Before delivering:

  1. Compile the complete project.
  2. Fix compilation errors.
  3. Test plugin startup.
  4. Test all commands.
  5. Test configuration loading.
  6. Test texture registration.
  7. Test PNG validation.
  8. Test font generation.
  9. Test ZIP generation.
  10. Test ZIP integrity.
  11. Test Minecraft 1.21.11 compatibility.
  12. Test the previous bitmap ascent/height error.
  13. Test hosting configuration.
  14. Test resource-pack delivery where an actual test environment is available.

Never claim tests passed unless they were actually performed.

  1. Final Deliverables

Provide:

  • Complete Java source code.
  • plugin.yml.
  • config.yml.
  • texture.yml.
  • pom.xml.
  • README.md.
  • Compiled FxCustomTexture.jar.
  • Generated resource-pack ZIP when test textures are available.
  • Installation instructions.
  • Complete configuration explanation.
  • Texture creation instructions.
  • MCPacks setup instructions.
  • Troubleshooting guide.

FINAL INSTRUCTION

Build a genuinely working plugin.

Do not provide pseudocode, incomplete methods, fake commands, fake hosting integrations or placeholder implementations.

Prioritize correctness, optimization and Minecraft 1.21.11 compatibility over unnecessary features.

If a feature cannot be implemented or tested, clearly explain the limitation instead of pretending it works.

Kodari AI
KodariYesterday at 4:49 am 5
FxCustomTexture
Advanced Minecraft resource-pack generator for custom textures and font images. Administrators register PNG textures with custom codes, positioning, and scaling. The plugin generates complete Minecraft 1.21.11 resource packs with valid font JSON, item models, and pack metadata, then exports them as ZIP files. Supports external hosting configuration, automatic pack delivery, permission-based texture usage, and an interactive GUI for texture management. Includes comprehensive commands for texture creation, validation, and pack generation with proper ascent/height calculations to prevent bitmap font errors.
  • Build the texture registry, validation, pack generator, and management commands.

  • Add a permission-aware GUI and external or self-hosted pack delivery.

  • Document supported settings and any features that cannot be verified here.

Built the plugin source with texture management, ZIP generation, a paginated GUI, and external or self-hosted pack delivery. Setup and configuration are in README.md.

Not verified: compilation, server startup, client compatibility, and pack delivery were not tested. No JAR or resource-pack ZIP was generated; the ZIP requires source PNGs.

The implementation omits several requested features, including pre-join delivery, automatic uploads, custom TTFs, text effects, and replacement outside chat. The README lists the limitations.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
8 525
src/main/java/me/fxstudio/fxcustomtexture/FxCustomTexture.java
package me.fxstudio.fxcustomtexture;

import com.sun.net.httpserver.HttpServer;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.command.*;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.*;
import org.bukkit.event.inventory.*;
import org.bukkit.event.player.*;
import org.bukkit.inventory.*;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.*;
import java.net.*;
import java.nio.file.*;
import java.security.MessageDigest;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.*;

public final class FxCustomTexture extends JavaPlugin implements Listener, CommandExecutor, TabCompleter {
    private TextureRegistry registry;
    private HttpServer server;
    private volatile String packUrl;
    private volatile byte[] packHash;
    private final AtomicBoolean generating = new AtomicBoolean();

    @Override public void onEnable() {
        saveDefaultConfig();
        if (!new File(getDataFolder(), "texture.yml").exists()) saveResource("texture.yml", false);
        if (!new File(getDataFolder(), "contents").isDirectory() && !new File(getDataFolder(), "contents").mkdirs()) getLogger().warning("Cannot create contents directory");
        registry = new TextureRegistry(this);
        Objects.requireNonNull(getCommand("fct")).setExecutor(this);
        Objects.requireNonNull(getCommand("fct")).setTabCompleter(this);
        getServer().getPluginManager().registerEvents(this, this);
        configureHosting();
    }
    @Override public void onDisable() { if (server != null) server.stop(0); }
    private String color(String text) {
        Matcher matcher = Pattern.compile("&#([A-Fa-f0-9]{6})").matcher(text);
        StringBuffer result = new StringBuffer();
        while (matcher.find()) matcher.appendReplacement(result, Matcher.quoteReplacement(ChatColor.of("#" + matcher.group(1)).toString()));
        matcher.appendTail(result);
        return org.bukkit.ChatColor.translateAlternateColorCodes('&', result.toString());
    }
    private void message(CommandSender sender, String key, String detail) {
        String prefix = getConfig().getString("messages.prefix", "");
        String text = getConfig().getString("messages." + key, "%prefix%" + key + " %detail%");
        sender.sendMessage(color(text.replace("%prefix%", prefix).replace("%detail%", detail)));
    }
    private void error(CommandSender sender, String text) { message(sender, "error", text); }
    private void success(CommandSender sender, String text) { message(sender, "success", text); }
    private Path outputPath() {
        Path base = getDataFolder().toPath().toAbsolutePath().normalize();
        Path folder = base.resolve(getConfig().getString("resource-pack.zip.output-folder", "output")).normalize();
        String name = getConfig().getString("resource-pack.zip.filename", "FxCustomTexture-Pack.zip");
        if (!folder.startsWith(base) || name == null || name.contains("/") || name.contains("\\") || !name.endsWith(".zip") || name.equals(".zip")) throw new IllegalArgumentException("Output must be a ZIP file inside the plugin data folder");
        return folder.resolve(name);
    }
    private static String checkedUrl(String url) {
        try {
            URI uri = URI.create(url);
            if (!("http".equalsIgnoreCase(uri.getScheme()) || "https".equalsIgnoreCase(uri.getScheme())) || uri.getHost() == null || uri.getUserInfo() != null || uri.getFragment() != null) throw new IllegalArgumentException();
            return uri.toASCIIString();
        } catch (Exception ex) { throw new IllegalArgumentException("Resource pack URL must be a valid HTTP(S) URL"); }
    }
    private static byte[] checkedHash(String hash) {
        if (hash == null || !hash.matches("(?i)[0-9a-f]{40}")) throw new IllegalArgumentException("SHA-1 must contain exactly 40 hexadecimal characters");
        return HexFormat.of().parseHex(hash);
    }
    private static byte[] hash(Path path) throws Exception {
        MessageDigest digest = MessageDigest.getInstance("SHA-1");
        try (InputStream in = Files.newInputStream(path)) { byte[] buffer = new byte[8192]; int n; while ((n = in.read(buffer)) != -1) digest.update(buffer, 0, n); }
        return digest.digest();
    }
    private void configureHosting() {
        if (server != null) { server.stop(0); server = null; }
        packUrl = null; packHash = null;
        String mode = getConfig().getString("resource-pack.hosting.mode", "none").toLowerCase(Locale.ROOT);
        try {
            if (mode.equals("none")) return;
            if (mode.equals("external")) {
                String url = checkedUrl(getConfig().getString("resource-pack.hosting.external.url", ""));
                byte[] sha = checkedHash(getConfig().getString("resource-pack.hosting.external.sha1", ""));
                packHash = sha; packUrl = url;
            } else if (mode.equals("self")) {
                String url = checkedUrl(getConfig().getString("resource-pack.hosting.self.public-url", ""));
                Path file = outputPath();
                int port = getConfig().getInt("resource-pack.hosting.self.port", 8163);
                if (port < 1 || port > 65535) throw new IllegalArgumentException("Self-host port must be between 1 and 65535");
                String bind = getConfig().getString("resource-pack.hosting.self.bind-address", "127.0.0.1");
                server = HttpServer.create(new InetSocketAddress(bind, port), 0);
                server.createContext("/", exchange -> {
                    try {
                        if (!exchange.getRequestMethod().equals("GET") || !Files.isRegularFile(file)) { exchange.sendResponseHeaders(404, -1); return; }
                        exchange.getResponseHeaders().set("Content-Type", "application/zip");
                        exchange.sendResponseHeaders(200, Files.size(file));
                        try (OutputStream out = exchange.getResponseBody(); InputStream in = Files.newInputStream(file)) { in.transferTo(out); }
                    } finally { exchange.close(); }
                });
                server.start();
                if (Files.isRegularFile(file)) { packHash = hash(file); packUrl = url; }
                else getLogger().warning("Self-hosting started; generate a ZIP before sending the pack.");
            } else throw new IllegalArgumentException("Hosting mode must be none, external, or self");
        } catch (Exception ex) { if (server != null) { server.stop(0); server = null; } getLogger().severe("Resource pack hosting: " + ex.getMessage()); }
    }
    @EventHandler public void join(PlayerJoinEvent event) {
        if (!getConfig().getBoolean("resource-pack.auto_apply.enabled", true)) return;
        long delay = Math.max(1, getConfig().getLong("resource-pack.auto_apply.delay_ticks", 1));
        Player player = event.getPlayer();
        Bukkit.getScheduler().runTaskLater(this, () -> {
            String url = packUrl; byte[] sha = packHash;
            if (player.isOnline() && url != null && sha != null) player.setResourcePack(url, sha);
            else if (player.isOnline()) getLogger().warning("No valid hosted resource pack is configured; not sending to " + player.getName());
        }, delay);
    }
    @EventHandler public void packStatus(PlayerResourcePackStatusEvent event) {
        String status = event.getStatus().name();
        if (status.equals("DECLINED") && getConfig().getBoolean("resource-pack.kick-player-on-decline")) event.getPlayer().kickPlayer(color("&cResource pack declined."));
        if ((status.equals("FAILED_DOWNLOAD") || status.equals("INVALID_URL") || status.equals("FAILED_RELOAD")) && getConfig().getBoolean("resource-pack.kick-player-on-fail")) event.getPlayer().kickPlayer(color("&cResource pack could not be loaded."));
    }
    @EventHandler(ignoreCancelled = true) public void chat(AsyncPlayerChatEvent event) {
        if (!getConfig().getBoolean("font-images.chat", true) || !event.getPlayer().hasPermission("fxcustomtexture.use")) return;
        String text = event.getMessage();
        for (TextureRegistry.Texture t : registry.all()) if (t.allowed(event.getPlayer())) text = text.replace(t.code(), t.glyph());
        event.setMessage(text);
    }
    private boolean permitted(CommandSender sender, String permission) {
        if (sender.hasPermission("fxcustomtexture." + permission)) return true;
        message(sender, "no-permission", ""); return false;
    }
    @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        String sub = args.length == 0 ? "help" : args[0].toLowerCase(Locale.ROOT);
        if (sub.equals("help")) {
            if (!permitted(sender, "use")) return true;
            success(sender, "/fct help|version|reload|zip|list|info <texture>|gui|give <player> <texture>|preview <texture>|create <name>|delete <name>|validate"); return true;
        }
        if (sub.equals("version")) { if (permitted(sender, "use")) success(sender, "FxCustomTexture 1.0.0 by FxStudio"); return true; }
        String permission = sub.equals("preview") ? "info" : sub;
        if (!Set.of("reload", "zip", "list", "info", "gui", "give", "preview", "create", "delete", "validate").contains(sub)) { error(sender, "Unknown command. Use /fct help."); return true; }
        if (!permitted(sender, permission)) return true;
        try {
            switch (sub) {
                case "reload" -> { reloadConfig(); registry.reload(); configureHosting(); message(sender, "reload", ""); }
                case "zip" -> generate(sender);
                case "validate" -> {
                    List<String> problems = PackGenerator.validate(registry.all(), registry.errors());
                    if (problems.isEmpty()) success(sender, "All texture definitions and PNG files are valid."); else for (String problem : problems) error(sender, problem);
                }
                case "list" -> success(sender, "Textures: " + (registry.all().isEmpty() ? "none" : String.join(", ", registry.all().stream().map(TextureRegistry.Texture::name).toList())));
                case "create", "delete" -> {
                    if (args.length != 2) { error(sender, "Usage: /fct " + sub + " <name>"); break; }
                    if (sub.equals("create")) { registry.create(args[1]); success(sender, "Template created. Put its PNG in contents/ and generate the pack."); }
                    else { registry.delete(args[1]); success(sender, "Definition deleted; original PNG was retained. Regenerate the pack."); }
                }
                case "info", "preview" -> {
                    if (args.length != 2) { error(sender, "Usage: /fct " + sub + " <texture>"); break; }
                    TextureRegistry.Texture t = registry.get(args[1]);
                    if (t == null || sender instanceof Player p && !t.allowed(p)) { error(sender, "Texture not found or unavailable."); break; }
                    success(sender, t.name() + " | code: " + t.code() + " | glyph: " + t.glyph() + " | scale: " + t.scale() + " | y: " + t.y() + " | file: " + t.path());
                }
                case "gui" -> { if (!(sender instanceof Player p)) message(sender, "player-only", ""); else openGui(p, 0); }
                case "give" -> {
                    if (args.length != 3) { error(sender, "Usage: /fct give <player> <texture>"); break; }
                    Player target = Bukkit.getPlayerExact(args[1]); TextureRegistry.Texture t = registry.get(args[2]);
                    if (target == null || t == null || !t.allowed(target) || sender instanceof Player p && !t.allowed(p)) { error(sender, "Player or permitted texture not found."); break; }
                    ItemStack item = new ItemStack(Objects.requireNonNull(org.bukkit.Material.matchMaterial("PAPER"))); ItemMeta meta = item.getItemMeta();
                    meta.setDisplayName(color("&f" + t.name())); meta.setItemModel(new NamespacedKey(this, t.name())); item.setItemMeta(meta);
                    Map<Integer, ItemStack> remaining = target.getInventory().addItem(item);
                    remaining.values().forEach(stack -> target.getWorld().dropItemNaturally(target.getLocation(), stack));
                    success(sender, "Gave " + t.name() + " to " + target.getName() + ".");
                }
            }
        } catch (Exception ex) { error(sender, ex.getMessage() == null ? ex.getClass().getSimpleName() : ex.getMessage()); }
        return true;
    }
    private void generate(CommandSender sender) {
        if (!generating.compareAndSet(false, true)) { error(sender, "A generation is already running."); return; }
        registry.reload();
        List<TextureRegistry.Texture> textures = List.copyOf(registry.all()); List<String> errors = List.copyOf(registry.errors());
        Path output;
        try { output = outputPath(); } catch (Exception ex) { generating.set(false); error(sender, ex.getMessage()); return; }
        boolean compress = getConfig().getBoolean("resource-pack.zip.compress", true);
        message(sender, "zip-start", "");
        Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
            String failure = null;
            try { PackGenerator.generate(textures, errors, output, compress); } catch (Exception ex) { failure = ex.getMessage(); }
            String result = failure;
            generating.set(false);
            if (!isEnabled()) return;
            Bukkit.getScheduler().runTask(this, () -> {
                if (result == null) { if (getConfig().getString("resource-pack.hosting.mode", "none").equalsIgnoreCase("self")) configureHosting(); message(sender, "zip-success", output.toString()); }
                else { getLogger().warning("Pack generation failed: " + result); message(sender, "zip-failed", result); }
            });
        });
    }
    private static final class Menu implements InventoryHolder {