Package com.ranull.graves.util
Class PluginDownloadUtil
java.lang.Object
com.ranull.graves.util.PluginDownloadUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
downloadAndReplacePlugin
(long pluginId, String pluginName, String pluginsFolder, org.bukkit.command.CommandSender commandSender) Downloads a plugin from Spiget and saves it to the plugins folder, replacing it if it exists.static void
downloadAndReplacePlugin
(String pluginId, String pluginName, String pluginsFolder, org.bukkit.command.CommandSender commandSender) Downloads a plugin from Spiget and saves it to the plugins folder, replacing it if it exists.private static File
downloadFile
(String fileUrl, org.bukkit.command.CommandSender commandSender) Downloads a file from the given URL to a temporary file.private static void
sendMessageToExecutor
(org.bukkit.command.CommandSender commandSender, String message)
-
Constructor Details
-
PluginDownloadUtil
public PluginDownloadUtil()
-
-
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.
-
downloadFile
private static File downloadFile(String fileUrl, org.bukkit.command.CommandSender commandSender) throws IOException Downloads a file from the given URL to a temporary file.- Parameters:
fileUrl
- The URL to download the file from.- Returns:
- A temporary file containing the downloaded data.
- Throws:
IOException
- If the download fails.
-
sendMessageToExecutor
private static void sendMessageToExecutor(org.bukkit.command.CommandSender commandSender, String message)
-