-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from cg0/issues/124
Add plugin reload command
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/main/kotlin/io/hirasawa/server/commands/ReloadCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.hirasawa.server.commands | ||
|
||
import io.hirasawa.server.Hirasawa | ||
import io.hirasawa.server.bancho.chat.command.ChatCommand | ||
import io.hirasawa.server.bancho.chat.command.CommandContext | ||
import io.hirasawa.server.plugin.InternalPlugin | ||
import io.hirasawa.server.plugin.PluginDescriptor | ||
import java.io.File | ||
|
||
class ReloadCommand: ChatCommand("reload", "Reloads the loaded plugins", "hirasawa.command.reload") { | ||
override fun onCommand(context: CommandContext, command: String, args: List<String>): Boolean { | ||
val pluginNames = Hirasawa.pluginManager.loadedPlugins.keys.toMutableList() | ||
for (pluginName in pluginNames) { | ||
Hirasawa.pluginManager.unloadPlugin(pluginName) | ||
} | ||
|
||
Hirasawa.pluginManager.loadPluginsFromDirectory(File("plugins"), true) | ||
Hirasawa.pluginManager.loadPlugin(InternalPlugin(), PluginDescriptor("Internal Plugin", Hirasawa.version, | ||
"Hirasawa", "") | ||
) | ||
return true | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters