mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-01 14:08:08 +01:00
Add registerCommandClass for loading external command classes.
This commit is contained in:
parent
08b463ac6b
commit
a8e9817c63
@ -118,7 +118,7 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
public Iterable<CommandInfo> getCommands(String base) {
|
||||
return commands.getCommands(base);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NPCRegistry getNPCRegistry() {
|
||||
return npcRegistry;
|
||||
@ -257,6 +257,15 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
Messaging.severeTr(Messages.CITIZENS_IMPLEMENTATION_DISABLED);
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
}
|
||||
|
||||
public void registerCommandClass(Class<?> clazz) {
|
||||
try {
|
||||
commands.register(clazz);
|
||||
} catch (Throwable ex) {
|
||||
Messaging.logTr(Messages.CITIZENS_INVALID_COMMAND_CLASS);
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void registerCommands() {
|
||||
commands.setInjector(new Injector(this));
|
||||
|
@ -24,6 +24,7 @@ public class Messages {
|
||||
public static final String CITIZENS_ENABLED = "citizens.notifications.enabled";
|
||||
public static final String CITIZENS_IMPLEMENTATION_DISABLED = "citizens.changed-implementation";
|
||||
public static final String CITIZENS_INCOMPATIBLE = "citizens.notifications.incompatible-version";
|
||||
public static final String CITIZENS_INVALID_COMMAND_CLASS = "citizens.commands.invalid.class";
|
||||
public static final String CITIZENS_RELOAD_ERROR = "citizens.notifications.error-reloading";
|
||||
public static final String CITIZENS_RELOADED = "citizens.notifications.reloaded";
|
||||
public static final String CITIZENS_RELOADING = "citizens.notifications.reloading";
|
||||
|
@ -5,6 +5,7 @@ citizens.commands.errors.missing-world=World not found.
|
||||
citizens.commands.help.command-missing=Command /{0} not found.
|
||||
citizens.commands.help.header=Help
|
||||
citizens.commands.id-not-found=Couldn''t find any NPC with ID {0}.
|
||||
citizens.commands.invalid.class=Invalid external commands class.
|
||||
citizens.commands.invalid-mobtype={0} is not a valid mobtype.
|
||||
citizens.commands.invalid-number=That is not a valid number.
|
||||
citizens.commands.npc.age.cannot-be-aged=The mob type {0} cannot be aged.
|
||||
|
Loading…
Reference in New Issue
Block a user