Resolve command registration (for some users)

This commit is contained in:
Lennart ten Wolde 2017-07-28 23:29:19 +02:00
parent 8f00f9c30f
commit 82ff7cfa73
3 changed files with 30 additions and 6 deletions

View file

@ -77,8 +77,9 @@ public interface Marriage {
* Register a subcommand to the /marry command.
*
* @param commandClass Class of the sub command to be registered.
* @param commandClasses Additional command classes
*/
void register(Class<? extends Command> commandClass);
void register(Class<? extends Command> commandClass, Class<? extends Command>... commandClasses);
/**
* Get the plugin logger instance.

View file

@ -39,8 +39,11 @@ public abstract class MarriageBase implements Marriage {
}
@Override
public void register(Class<? extends Command> commandClass) {
public void register(Class<? extends Command> commandClass, Class<? extends Command>... commandClasses) {
commandExecutor.register(commandClass);
for(Class<? extends Command> cmdclass : commandClasses) {
commandExecutor.register(cmdclass);
}
}
@Override

View file

@ -2,7 +2,7 @@ package com.lenis0012.bukkit.marriage2.internal;
import com.lenis0012.bukkit.marriage2.MData;
import com.lenis0012.bukkit.marriage2.MPlayer;
import com.lenis0012.bukkit.marriage2.commands.Command;
import com.lenis0012.bukkit.marriage2.commands.*;
import com.lenis0012.bukkit.marriage2.config.Message;
import com.lenis0012.bukkit.marriage2.config.Permissions;
import com.lenis0012.bukkit.marriage2.config.Settings;
@ -95,9 +95,29 @@ public class MarriageCore extends MarriageBase {
@Register(name = "commands", type = Register.Type.ENABLE)
public void registerCommands() {
for(Class<? extends Command> command : findClasses("com.lenis0012.bukkit.marriage2.commands", Command.class)) {
register(command);
}
register(
CommandChat.class,
CommandChatSpy.class,
CommandDivorce.class,
CommandGender.class,
CommandGift.class,
CommandHeal.class,
CommandHelp.class,
CommandHome.class,
CommandList.class,
CommandMarry.class,
CommandMigrate.class,
CommandPriest.class,
CommandPVP.class,
CommandReload.class,
CommandSeen.class,
CommandSethome.class,
CommandTeleport.class,
CommandUpdate.class
);
// for(Class<? extends Command> command : findClasses("com.lenis0012.bukkit.marriage2.commands", Command.class)) {
// register(command);
// }
}
@Register(name = "updater", type = Type.ENABLE, priority = 9)