Framework

Since this is a framework I designed a system that can connect runnables to the UIFrameworks reload command for simplicity. You can register a reload runnable and it will run whenever the user types /ui reload to reload UIF, it is best to do it this way so that the user can reload all custom item addon plugins with just one command and not need to struggle to find the right plugin reload command. Here is how you can easily register a reload runnable in your onEnable:

public class ExamplePlugin extends JavaPlugin {
    
    public void onEnable() {
        Plugin uiframework = getServer().getPluginManager().getPlugin("UIFramework");
	    if (uiframework == null) {
		getLogger().info("ERROR Cannot start plugin because UIFramework is not detected!");
		this.setEnabled(false);
		return;
	    }
	//this line registers the runnable so that everytime the user reloads UIF it will run your reload() method too!
	((com.jewishbanana.uiframework.UIFramework) uiframework).registerReloadRunnable(() -> reload());
    }
    
    public static void reload() {
        //reload code here
    }
}

Last updated