-
Notifications
You must be signed in to change notification settings - Fork 0
Hotloading
Dan edited this page Oct 19, 2017
·
1 revision
Hotloading allows you to "track" a file. Any time the file changes in size, or it's date modified is changed, your runnable will be fired.
// Pass in the file you wish to track
// Also pass in a runnable to handle the event.
File f = new File(getDataFolder(), "config.yml");
Surge.getHotloadManager().track(f, new Runnable()
{
@Override
public void run()
{
D.v("The main config has changed!");
D.v("What a perfect time to load it back up!");
}
});
You can also hotload jars also. Simply reloading the plugin when the jar is modified / changed. (this is really helpful while developing, the plugin reloads itself when you compile) **However, your plugin is already set to reload on compile. To disable this, simply execute: **
Surge.getHotloadManager().untrack(Surge.getPluginJarFile());