DetachedClassLoading

public final class DetachedClassLoading

Defines a copy of a class in a JDK class loader whose parent is the server's.

An object the server keeps after a plugin is disabled, such as a world's chunk generator, keeps the class loader of its class alive, and with it every class and static of that plugin copy. A copy defined here belongs to its own small loader instead, so a reloaded plugin can be collected. The class may therefore only reference JDK and Bukkit types: no lambdas, nested classes, enums, or other classes from the plugin jar.

Functions

Link copied to clipboard
public static Class<? extends Object> define(Class<? extends Object> template, Path directory)
Writes template's bytecode under directory and loads it from there.