Class PluginReloader

java.lang.Object
valorless.valorlessutils.reloader.PluginReloader

public class PluginReloader extends Object
Utility class for safely reloading plugins at runtime.

This reloader works by disabling a plugin immediately and then scheduling its re-enablement after a configurable delay. Useful for development or for plugins that support hot-reloading.

Note: Reloading plugins at runtime may cause side effects if the plugin is not designed to handle being disabled and re-enabled properly.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    reloadPlugin(org.bukkit.plugin.Plugin target, long delay, boolean silent)
    Handles the actual plugin reload logic.
    static void
    reloadPlugin(org.bukkit.plugin.Plugin target, long delay, boolean silent, org.bukkit.command.CommandSender sender)
    Handles the actual plugin reload logic.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PluginReloader

      public PluginReloader()
  • Method Details

    • reloadPlugin

      public static void reloadPlugin(org.bukkit.plugin.Plugin target, long delay, boolean silent)
      Handles the actual plugin reload logic.

      Disables the target plugin immediately, then schedules a re-enable after the given delay. If the plugin is not found, an error is logged.

      Parameters:
      target - The plugin to reload
      delay - The delay in ticks before re-enabling
      silent - Whether to suppress log messages during reload
    • reloadPlugin

      public static void reloadPlugin(org.bukkit.plugin.Plugin target, long delay, boolean silent, org.bukkit.command.CommandSender sender)
      Handles the actual plugin reload logic.

      Disables the target plugin immediately, then schedules a re-enable after the given delay. If the plugin is not found, an error is logged.

      Parameters:
      target - The plugin to reload
      delay - The delay in ticks before re-enabling
      silent - Whether to suppress log messages during reload
      sender - CommandSender to send status messages to during the reload process