mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-11 17:51:52 +00:00
added template for command not found, when disabling a command in a group
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package dev.sheldan.abstracto.core.service;
|
||||
|
||||
import dev.sheldan.abstracto.core.command.exception.ChannelGroupNotFoundException;
|
||||
import dev.sheldan.abstracto.core.command.exception.CommandException;
|
||||
import dev.sheldan.abstracto.core.command.exception.CommandNotFoundException;
|
||||
import dev.sheldan.abstracto.core.command.models.database.ACommand;
|
||||
import dev.sheldan.abstracto.core.command.service.management.ChannelGroupCommandManagementService;
|
||||
import dev.sheldan.abstracto.core.command.service.management.CommandManagementService;
|
||||
@@ -104,7 +104,7 @@ public class ChannelGroupServiceBean implements ChannelGroupService {
|
||||
}
|
||||
ACommand command = commandManagementService.findCommandByName(commandName);
|
||||
if(command == null) {
|
||||
throw new CommandException(String.format(COMMAND_NOT_FOUND, commandName));
|
||||
throw new CommandNotFoundException();
|
||||
}
|
||||
channelGroupCommandManagementService.setCommandInGroupTo(command, channelGroup, false);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public class ChannelGroupServiceBean implements ChannelGroupService {
|
||||
}
|
||||
ACommand command = commandManagementService.findCommandByName(commandName);
|
||||
if(command == null) {
|
||||
throw new CommandException(String.format(COMMAND_NOT_FOUND, commandName));
|
||||
throw new CommandNotFoundException();
|
||||
}
|
||||
channelGroupCommandManagementService.setCommandInGroupTo(command, channelGroup, true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<#include "command_not_found_exception_text">
|
||||
@@ -1,9 +0,0 @@
|
||||
package dev.sheldan.abstracto.core.command.exception;
|
||||
|
||||
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||
|
||||
public class CommandException extends AbstractoRunTimeException {
|
||||
public CommandException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package dev.sheldan.abstracto.core.command.exception;
|
||||
|
||||
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||
import dev.sheldan.abstracto.templating.Templatable;
|
||||
|
||||
public class CommandNotFoundException extends AbstractoRunTimeException implements Templatable {
|
||||
public CommandNotFoundException() {
|
||||
super("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return "command_not_found_exception_text";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
return new Object();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Command not found.
|
||||
Reference in New Issue
Block a user