summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Panić <david@panic.tk>2019-02-10 02:16:04 +0100
committerDavid Panić <david@panic.tk>2019-02-10 02:16:04 +0100
commitec716782e278dc92e3e3c75e036f08a345422d25 (patch)
treedca4c39a13ec10de98b12d0753ab119f4a640f63
parentd67e0015b67614c8c53826a598b8a26a0b3a2e8c (diff)
Made versions show directly in chat if you add -v to /modules
-rw-r--r--src/main/java/com/redstoner/coremods/moduleLoader/ModuleLoader.cmd12
-rw-r--r--src/main/java/com/redstoner/coremods/moduleLoader/ModuleLoader.java16
2 files changed, 25 insertions, 3 deletions
diff --git a/src/main/java/com/redstoner/coremods/moduleLoader/ModuleLoader.cmd b/src/main/java/com/redstoner/coremods/moduleLoader/ModuleLoader.cmd
index 4e06bd0..69dd38d 100644
--- a/src/main/java/com/redstoner/coremods/moduleLoader/ModuleLoader.cmd
+++ b/src/main/java/com/redstoner/coremods/moduleLoader/ModuleLoader.cmd
@@ -4,11 +4,23 @@ command modules {
perm moduleloader.modules.list;
run list;
}
+ -v {
+ help Lists all modules and their versions. Color indicates status: §aENABLED §cDISABLED;
+ perm moduleloader.modules.list;
+ run listversions;
+ }
+
+
list {
help Lists all modules. Color indicates status: §aENABLED §cDISABLED;
perm moduleloader.modules.list;
run list;
}
+ list -v {
+ help Lists all modules and their versions. Color indicates status: §aENABLED §cDISABLED;
+ perm moduleloader.modules.list;
+ run listversions;
+ }
load [string:name...] {
help (Re)-Loads a module. WARNING: Handle with care! This has direct affect on code being executed. This command will temporarily halt the main thread until the class loading operation was completed.;
perm moduleloader.modules.admin;
diff --git a/src/main/java/com/redstoner/coremods/moduleLoader/ModuleLoader.java b/src/main/java/com/redstoner/coremods/moduleLoader/ModuleLoader.java
index bdf8091..ec478a0 100644
--- a/src/main/java/com/redstoner/coremods/moduleLoader/ModuleLoader.java
+++ b/src/main/java/com/redstoner/coremods/moduleLoader/ModuleLoader.java
@@ -561,15 +561,25 @@ public final class ModuleLoader implements CoreModule {
return Main.plugin;
}
+ @Command (hook = "list", async = AsyncType.ALWAYS)
+ public boolean listModulesCommand(CommandSender sender) {
+ return listModules(sender, false);
+ }
+
+ @Command (hook = "listversions", async = AsyncType.ALWAYS)
+ public boolean listModulesVerionsCommand(CommandSender sender) {
+ return listModules(sender, true);
+ }
+
/**
* This method lists all modules to the specified CommandSender. The modules will be color coded correspondingly to their enabled status.
*
* @param sender The person to send the info to, usually the issuer of the command or the console sender.
+ * @param showVersions Should we show the versions directly in chat.
*
* @return true.
*/
- @Command (hook = "list", async = AsyncType.ALWAYS)
- public boolean listModulesCommand(CommandSender sender) {
+ public boolean listModules(CommandSender sender, boolean showVersions) {
boolean hasCategorys = hasCategories();
Message m = new Message(sender, null);
ModuleInfo ml_info = moduleInfos.get(instance);
@@ -587,7 +597,7 @@ public final class ModuleLoader implements CoreModule {
for (Module mod : mods) {
ModuleInfo info = moduleInfos.get(mod);
- m.appendTextHover((modules.get(mod) ? "§a" : "§c") + info.getDisplayName(), info.getModuleInfoHover());
+ m.appendTextHover((modules.get(mod) ? "§a" : "§c") + info.getDisplayName() + (showVersions ? " &e" + info.getVersion() : ""), info.getModuleInfoHover());
if (curModule != mods.size())
m.appendText("&7, ");