Skip to content

Patch addons to make them compatible with new Skript versions

License

Notifications You must be signed in to change notification settings

SkriptLang/AddonPatcher

Repository files navigation

AddonPatcher

The addon patcher is a tool that patches your addons to be more compatible with new versions of Skript.

The following is a list of changes in Skript this tool fixes, along with the exceptions generated by incompatible addons:

  • Parallel Script Loading #3924:
    • java.lang.NoSuchFieldError: currentScript
    • java.lang.NoSuchFieldError: currentSections
    • java.lang.NoSuchFieldError: currentLoops
    • java.lang.NoSuchFieldError: hasDelayBefore
  • Structure API #4108
    • java.lang.NoSuchMethodError: 'ch.njol.skript.config.Config ch.njol.skript.lang.parser.ParserInstance.getCurrentScript()'
    • java.lang.NoSuchMethodError: 'java.io.File ch.njol.skript.lang.Trigger.getScript()'
    • java.lang.NoSuchMethodError: 'void ch.njol.skript.lang.Trigger.<init>(java.io.File, java.lang.String, ch.njol.skript.lang.SkriptEvent, java.util.List)'

Variants

The addon patcher has 3 variants: Replacer, Agent and Java:

Agent (Recommended)

The Agent variant is a plugin that, when installed on your server, automatically patches each addon class used.

This variant requires you to run the server with a JDK instead of JRE.

Replacer

The Replacer variant is a plugin that, when installed on your server, automatically patches all addons the moment you start the server. The Replacer variant will modify your addon.jar file for the addons that require patching.

This variant does not fully work on Paper 1.19+. It can be used on those Paper versions, but requires you to restart your server (twice) after initially installing AddonPatcher, and when installing new addons.

Java

The Java variant is not a plugin: it is a standalone Java program that you can run to modify your addon.jar files, with the command java -jar AddonPatcher.jar <addon.jar> in a terminal / command prompt window in the folder with both your addon and AddonPatcher .jar files. Alternatively, you can run java -jar AddonPatcher.jar <folder> in a folder with AddonPatcher.jar and the given folder, to patch all addons in the given folder.

Compiling

Two possible commands, depending on which variant you want (if you want Java, flip a coin):

  • gradlew clean agentJar
  • gradlew clean replacerJar

The current build script isn't great, so the clean task beforehand is very much recommended. PRs improving the build script would be greatly appreciated.