Class PluginDownloadUtil

java.lang.Object
dev.cwhead.GravesX.util.PluginDownloadUtil

public final class PluginDownloadUtil extends Object
Utility methods to download plugin jars from Spiget and place them in the server's plugins folder.

Note: This class uses simple HTTP requests with sensible timeouts and follows redirects.

  • Method Details

    • downloadAndReplacePlugin

      public static void downloadAndReplacePlugin(long pluginId, String pluginName, String pluginsFolder, org.bukkit.command.CommandSender commandSender) throws IOException
      Downloads a plugin from Spiget and saves it to the plugins folder, replacing it if it exists.
      Parameters:
      pluginId - The Spigot resource ID of the plugin.
      pluginName - The name of the plugin file (without the ".jar" extension).
      pluginsFolder - The path to the plugins' folder.
      Throws:
      IOException - If the download or file operations fail.
    • downloadAndReplacePlugin

      public static void downloadAndReplacePlugin(String pluginId, String pluginName, String pluginsFolder, org.bukkit.command.CommandSender commandSender) throws IOException
      Downloads a plugin from Spiget and saves it to the plugins folder, replacing it if it exists.
      Parameters:
      pluginId - The Spigot resource ID of the plugin.
      pluginName - The name of the plugin file (without the ".jar" extension).
      pluginsFolder - The path to the plugins' folder.
      Throws:
      IOException - If the download or file operations fail.