mirror of
https://github.com/plexusorg/Plex.git
synced 2026-06-04 05:26:55 +00:00
More API work for modules
This commit is contained in:
@@ -4,6 +4,7 @@ import dev.plex.Plex;
|
||||
import dev.plex.api.command.CommandApi;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.util.PlexLog;
|
||||
import java.util.List;
|
||||
|
||||
final class DefaultCommandApi implements CommandApi
|
||||
{
|
||||
@@ -14,6 +15,7 @@ final class DefaultCommandApi implements CommandApi
|
||||
@Override
|
||||
public void register(PlexCommand command)
|
||||
{
|
||||
command.bindApi(plugin.getApi());
|
||||
if (plugin.getCommandHandler() == null)
|
||||
{
|
||||
plugin.getPendingCommands().add(command);
|
||||
@@ -32,6 +34,16 @@ final class DefaultCommandApi implements CommandApi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlexCommand> registeredCommands()
|
||||
{
|
||||
if (plugin.getCommandHandler() == null)
|
||||
{
|
||||
return List.copyOf(plugin.getPendingCommands());
|
||||
}
|
||||
return plugin.getCommandHandler().getCommands();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresLifecycleReload()
|
||||
{
|
||||
|
||||
@@ -50,6 +50,11 @@ public class CommandHandler
|
||||
return lifecycleReloadRequired;
|
||||
}
|
||||
|
||||
public List<PlexCommand> getCommands()
|
||||
{
|
||||
return List.copyOf(commands);
|
||||
}
|
||||
|
||||
public @Nullable PlexCommand getCommand(String name)
|
||||
{
|
||||
String normalized = name.toLowerCase(Locale.ROOT);
|
||||
|
||||
Reference in New Issue
Block a user