Rename to default if no name was specified

This commit is contained in:
Ridan Vandenbergh 2019-01-20 22:10:33 +01:00
parent b96f0cb778
commit 71fc4a847e
2 changed files with 5 additions and 4 deletions

View File

@ -18,9 +18,6 @@ public class RenameModuleCommand extends Command {
if (args.length == 0) { if (args.length == 0) {
sendChatMessage("Please specify a module!"); sendChatMessage("Please specify a module!");
return; return;
} else if (args.length == 1) {
sendChatMessage("Please specify a name!");
return;
} }
Module module = ModuleManager.getModuleByName(args[0]); Module module = ModuleManager.getModuleByName(args[0]);
@ -29,7 +26,7 @@ public class RenameModuleCommand extends Command {
return; return;
} }
String name = args[1]; String name = args.length == 1 ? module.getOriginalName() : args[1];
if (!(name.matches("[a-zA-Z]+"))) { if (!(name.matches("[a-zA-Z]+"))) {
sendChatMessage("Name must be alphabetic!"); sendChatMessage("Name must be alphabetic!");

View File

@ -61,6 +61,10 @@ public class Module {
ModuleManager.updateLookup(); ModuleManager.updateLookup();
} }
public String getOriginalName() {
return originalName;
}
public enum Category public enum Category
{ {
COMBAT("Combat", false), COMBAT("Combat", false),