mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-10 10:20:44 -07:00
Live remove/reload
This commit is contained in:
parent
dc70d4406e
commit
c74e5f2a4d
1 changed files with 13 additions and 0 deletions
|
|
@ -1172,6 +1172,7 @@ object ReflectiveEditorView : View {
|
|||
|
||||
// Helper method to handle duplicate plugins (loaded and disabled)
|
||||
private fun handleDuplicatePlugins(loadedPluginNames: Set<String>, disabledPluginInfo: Map<String, String>) {
|
||||
var needsReload = false
|
||||
for (pluginName in loadedPluginNames) {
|
||||
if (disabledPluginInfo.containsKey(pluginName)) {
|
||||
System.out.println("Found duplicate plugin: $pluginName. Deleting disabled version.")
|
||||
|
|
@ -1181,6 +1182,7 @@ object ReflectiveEditorView : View {
|
|||
if (pluginDir.exists() && pluginDir.isDirectory) {
|
||||
if (deleteRecursively(pluginDir)) {
|
||||
System.out.println("Successfully deleted disabled version of $pluginName")
|
||||
needsReload = true
|
||||
} else {
|
||||
System.out.println("Failed to delete disabled version of $pluginName")
|
||||
}
|
||||
|
|
@ -1190,6 +1192,11 @@ object ReflectiveEditorView : View {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reload plugins if we deleted any disabled duplicates
|
||||
if (needsReload) {
|
||||
PluginRepository.reloadPlugins()
|
||||
}
|
||||
}
|
||||
|
||||
// Helper method to get disabled plugin names and their versions
|
||||
|
|
@ -1261,6 +1268,12 @@ object ReflectiveEditorView : View {
|
|||
// Recursively delete the directory
|
||||
if (deleteRecursively(pluginDir)) {
|
||||
showToast(mainPanel, "Plugin deleted successfully", JOptionPane.INFORMATION_MESSAGE)
|
||||
|
||||
// If we deleted a loaded plugin, reload plugins
|
||||
if (!isDisabled) {
|
||||
PluginRepository.reloadPlugins()
|
||||
}
|
||||
|
||||
// Refresh the plugin list view
|
||||
SwingUtilities.invokeLater {
|
||||
addPlugins(reflectiveEditorView!!)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue