emopedia

Write me a skript addon that obfuscates all skripts and packs each sk file into its own "jar" file that is just obfuscated skript

Kodari AI
KodariSep 29 at 2:29 am 1
SkriptObfuscator
Creates a Skript addon that obfuscates all .sk files by transforming variable names, function names, and command identifiers into randomized tokens while preserving syntax structure. Each obfuscated script is packaged into its own .jar archive containing the encrypted .sk file plus a manifest. The addon provides commands to obfuscate individual scripts, all scripts in a folder, or the entire scripts directory, with configurable obfuscation strength and optional comment stripping. Includes a deobfuscation tool using stored mapping files for development recovery.
  1. Create a Skript-dependent Bukkit addon with an admin command to process every .sk file recursively.

  2. Strip comments and compact formatting without changing script logic, then write each obfuscated script as the sole entry in its own .jar.

  3. Add the Gradle build and plugin metadata.

Created the Skript addon. Use /skobfuscate (or /skobfuscate all) to process every .sk file under plugins/Skript/scripts, including subfolders. It strips comments, compacts formatting, and writes one .jar per script under plugins/SkriptObfuscator/output; each archive contains only that obfuscated .sk file.

This is lightweight obfuscation, not encryption. Skript does not load these generated JARs directly—the scripts are packaged archives, not executable plugin JARs.

emopedia

make this much more heavy, it needs to be a full obfuscator

Kodari AI
KodariSep 29 at 2:34 am 1

I’ll upgrade the text cleanup into a syntax-aware obfuscation pass: consistently rename static variables and declared functions across the whole script set, rename per-file options, preserve placeholders/strings, strip comments, and keep one .sk entry per output JAR.

Expanded the obfuscation pass to consistently rename static variables and declared functions across all .sk files, rename each script’s options and references, preserve quoted text and Skript placeholders, and remove comments and blank lines before packaging.

This is source-level obfuscation, not encryption: Skript is interpreted text, so bytecode-style transformations aren’t available, and Skript does not load these generated JARs directly. Each JAR still contains only its obfuscated .sk file.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 670
src/main/java/com/kodari/skriptobfuscator/SkriptObfuscatorPlugin.java
package com.kodari.skriptobfuscator;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Objects;
import java.util.logging.Level;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class SkriptObfuscatorPlugin extends JavaPlugin {
    private ObfuscationService obfuscationService;

    @Override
    public void onEnable() {
        Path pluginsDirectory = Objects.requireNonNull(getDataFolder().toPath().getParent());
        Path scriptsDirectory = pluginsDirectory.resolve("Skript").resolve("scripts");
        Path outputDirectory = getDataFolder().toPath().resolve("output");

        try {
            Files.createDirectories(scriptsDirectory);
        } catch (IOException exception) {
            getLogger().log(Level.SEVERE, "Could not access Skript's scripts directory.", exception);
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        obfuscationService = new ObfuscationService(scriptsDirectory, outputDirectory);
        PluginCommand command = Objects.requireNonNull(getCommand("skobfuscate"));
        command.setExecutor((sender, executedCommand, label, args) -> {
            if (args.length > 0 && !(args.length == 1 && args[0].equalsIgnoreCase("all"))) {
                sender.sendMessage("Usage: /skobfuscate [all]");
                return true;
            }

            try {
                int count = obfuscationService.packageAll();
                sender.sendMessage(count == 0
                        ? "No Skript files were found."
                        : "Packaged " + count + " Skript file(s) in " + outputDirectory + ".");
            } catch (IOException exception) {
                getLogger().log(Level.SEVERE, "Failed to obfuscate Skript files.", exception);
                sender.sendMessage("Could not package Skript files. Check the server console.");
            }
            return true;
        });
    }
}