better way to check for in game, discord and console
This commit is contained in:
parent
442cf9ba00
commit
f038c4f54f
4 changed files with 9 additions and 10 deletions
|
@ -58,7 +58,7 @@ public class ChatCommandHandlerPlugin extends ChatPlugin.Listener {
|
|||
|
||||
final PlayerCommandContext context = new PlayerCommandContext(bot, displayName, prefix, "@a", message.sender);
|
||||
|
||||
final Component output = bot.commandHandler.executeCommand(commandString, context, true, false, false, null);
|
||||
final Component output = bot.commandHandler.executeCommand(commandString, context, null);
|
||||
|
||||
if (output != null) context.sendOutput(output);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class ChatCommandHandlerPlugin extends ChatPlugin.Listener {
|
|||
|
||||
final PlayerCommandContext context = new PlayerCommandContext(bot, displayName, prefix, selector, sender);
|
||||
|
||||
final Component output = bot.commandHandler.executeCommand(commandString, context, true, false, false, null);
|
||||
final Component output = bot.commandHandler.executeCommand(commandString, context, null);
|
||||
|
||||
if (output != null) context.sendOutput(output);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package land.chipmunk.chayapak.chomens_bot.plugins;
|
||||
|
||||
import land.chipmunk.chayapak.chomens_bot.Bot;
|
||||
import land.chipmunk.chayapak.chomens_bot.command.Command;
|
||||
import land.chipmunk.chayapak.chomens_bot.command.CommandContext;
|
||||
import land.chipmunk.chayapak.chomens_bot.command.TrustLevel;
|
||||
import land.chipmunk.chayapak.chomens_bot.command.*;
|
||||
import land.chipmunk.chayapak.chomens_bot.commands.*;
|
||||
import land.chipmunk.chayapak.chomens_bot.util.ExceptionUtilities;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
@ -73,13 +71,14 @@ public class CommandHandlerPlugin {
|
|||
public Component executeCommand (
|
||||
String input,
|
||||
CommandContext context,
|
||||
boolean inGame,
|
||||
boolean discord,
|
||||
boolean console,
|
||||
MessageReceivedEvent event
|
||||
) {
|
||||
if (disabled) return null;
|
||||
|
||||
final boolean inGame = context instanceof PlayerCommandContext;
|
||||
final boolean discord = context instanceof DiscordCommandContext;
|
||||
final boolean console = context instanceof ConsoleCommandContext;
|
||||
|
||||
final String[] splitInput = input.trim().split("\\s+");
|
||||
|
||||
final String commandName = splitInput[0];
|
||||
|
|
|
@ -70,7 +70,7 @@ public class ConsolePlugin {
|
|||
if (line.startsWith(prefix)) {
|
||||
final ConsoleCommandContext context = new ConsoleCommandContext(bot, prefix);
|
||||
|
||||
final Component output = bot.commandHandler.executeCommand(line.substring(prefix.length()), context, false, false, true, null);
|
||||
final Component output = bot.commandHandler.executeCommand(line.substring(prefix.length()), context, null);
|
||||
|
||||
if (output != null) {
|
||||
context.sendOutput(output);
|
||||
|
|
|
@ -133,7 +133,7 @@ public class DiscordPlugin {
|
|||
if (message.startsWith(prefix)) {
|
||||
final DiscordCommandContext context = new DiscordCommandContext(bot, prefix, event);
|
||||
|
||||
final Component output = bot.commandHandler.executeCommand(message.substring(prefix.length()), context, false, true, false, event);
|
||||
final Component output = bot.commandHandler.executeCommand(message.substring(prefix.length()), context, event);
|
||||
|
||||
if (output != null) {
|
||||
context.sendOutput(output);
|
||||
|
|
Loading…
Reference in a new issue