added mostly complete support for dual commands

basically writing one command for both dms and a guild or having one
file and different functions based on where it was called

Signed-off-by: deepCurse <leverplays@gmail.com>
This commit is contained in:
deepCurse 2021-12-06 14:01:02 -04:00
parent 1380bc2a22
commit 168e45d745
No known key found for this signature in database
GPG key ID: EEBCBB60C9DFC782
18 changed files with 304 additions and 280 deletions

View file

@ -1,49 +0,0 @@
package pkg.deepCurse.nopalmo.command;
import java.util.HashMap;
import org.jetbrains.annotations.Nullable;
import pkg.deepCurse.nopalmo.manager.Argument;
public abstract class AbstractCommand { // TODO rewrite to implement type args?
public abstract String[] getCommandCalls();
public String getCommandName() {
return getCommandCalls()[0];
}
public boolean isNSFW() {
return false;
}
public boolean isPremium() { // im probably never gonna use this, but ill leave it in for those who want to
// see how i would implement it
return false;
}
public abstract HelpPage getHelpPage();
public enum HelpPage {
General, DEV, EGG, Moderation, Fun, Info
}
public String getHelp() {
return null;
}
public String getUsage() {
return null;
}
public int getTimeout() {
return 0;
}
@Nullable
public HashMap<String, Argument> getArguments() {
return null;
}
}

View file

@ -0,0 +1,87 @@
package pkg.deepCurse.nopalmo.command;
import java.util.HashMap;
import org.jetbrains.annotations.Nullable;
import net.dv8tion.jda.api.Permission;
import pkg.deepCurse.nopalmo.manager.Argument;
import pkg.deepCurse.nopalmo.manager.CommandBlob;
import pkg.deepCurse.nopalmo.manager.DirectCommandBlob;
import pkg.deepCurse.nopalmo.manager.GuildCommandBlob;
public interface CommandInterface { // TODO rewrite to implement type args?
public abstract String[] getCommandCalls();
public default String getCommandName() {
return getCommandCalls()[0];
}
public default boolean isNSFW() {
return false;
}
public default boolean isPremium() { // im probably never gonna use this, but ill leave it in for those who want to
// see how i would implement it
return false;
}
public abstract HelpPage getHelpPage();
public enum HelpPage {
General, DEV, EGG, Moderation, Fun, Info
}
public default String getHelp() {
return null;
}
public default String getUsage() {
return null;
}
public default int getTimeout() {
return 0;
}
@Nullable
public default HashMap<String, Argument> getArguments() {
return null;
}
public interface DualCommandInterface extends DirectCommandInterface, GuildCommandInterface {
@Override
public default void runGuildCommand(GuildCommandBlob blob, HashMap<String, Argument> argumentMap)
throws Exception {
runDualCommand(new CommandBlob(blob), argumentMap);
}
@Override
public default void runDirectCommand(DirectCommandBlob blob, HashMap<String, Argument> argumentMap)
throws Exception {
runDualCommand(new CommandBlob(blob), argumentMap);
}
public void runDualCommand(CommandBlob blob, HashMap<String, Argument> argumentMap)
throws Exception;
}
public interface DirectCommandInterface extends CommandInterface {
public void runDirectCommand(DirectCommandBlob blob, HashMap<String, Argument> argumentList) throws Exception;
}
public interface GuildCommandInterface extends CommandInterface {
public void runGuildCommand(GuildCommandBlob blob, HashMap<String, Argument> argumentList) throws Exception;
public default Permission[] getRequiredPermissions() {
return null;
}
public default Permission getRequiredPermission() {
return null;
}
}
}

View file

@ -1,12 +0,0 @@
package pkg.deepCurse.nopalmo.command;
import java.util.HashMap;
import pkg.deepCurse.nopalmo.manager.Argument;
import pkg.deepCurse.nopalmo.manager.DirectCommandBlob;
public abstract class DirectCommand extends AbstractCommand {
public abstract void runCommand(DirectCommandBlob blob, HashMap<String, Argument> argumentList) throws Exception;
}

View file

@ -1,23 +0,0 @@
package pkg.deepCurse.nopalmo.command;
import java.util.HashMap;
import net.dv8tion.jda.api.Permission;
import pkg.deepCurse.nopalmo.manager.Argument;
import pkg.deepCurse.nopalmo.manager.GuildCommandBlob;
public abstract class GuildCommand extends AbstractCommand {
public abstract void runCommand(GuildCommandBlob blob, HashMap<String, Argument> argumentList) throws Exception;
public abstract String[] getCommandCalls();
public Permission[] getRequiredPermissions() {
return null;
}
public Permission getRequiredPermission() {
return null;
}
}

View file

@ -0,0 +1,26 @@
package pkg.deepCurse.nopalmo.command.commands;
import java.util.HashMap;
import pkg.deepCurse.nopalmo.command.CommandInterface.DualCommandInterface;
import pkg.deepCurse.nopalmo.manager.Argument;
import pkg.deepCurse.nopalmo.manager.CommandBlob;
public class Git implements DualCommandInterface {
@Override
public void runDualCommand(CommandBlob blob, HashMap<String, Argument> argumentMap) throws Exception {
blob.getChannel().sendMessage("Heres the link: https://github.com/lever1209/nopalmo").queue();
}
@Override
public String[] getCommandCalls() {
return new String[] { "git", "source", "github" };
}
@Override
public HelpPage getHelpPage() {
return HelpPage.Info;
}
}

View file

@ -1,4 +1,4 @@
package pkg.deepCurse.nopalmo.command.guildCommand.info;
package pkg.deepCurse.nopalmo.command.commands;
import java.time.Instant;
import java.util.HashMap;
@ -6,13 +6,13 @@ import java.util.Random;
import java.util.concurrent.TimeUnit;
import net.dv8tion.jda.api.EmbedBuilder;
import pkg.deepCurse.nopalmo.command.GuildCommand;
import pkg.deepCurse.nopalmo.command.CommandInterface.GuildCommandInterface;
import pkg.deepCurse.nopalmo.database.DatabaseTools.Tools.Global;
import pkg.deepCurse.nopalmo.manager.Argument;
import pkg.deepCurse.nopalmo.manager.GuildCommandBlob;
import pkg.deepCurse.nopalmo.manager.GuildCommandManager;
public class Help extends GuildCommand {
public class Help implements GuildCommandInterface {
public final GuildCommandManager manager;
@ -21,14 +21,14 @@ public class Help extends GuildCommand {
}
@Override
public void runCommand(GuildCommandBlob blob, HashMap<String, Argument> argumentMap) throws Exception {
public void runGuildCommand(GuildCommandBlob blob, HashMap<String, Argument> argumentMap) throws Exception {
if (argumentMap.isEmpty()) {
EmbedBuilder embed = new EmbedBuilder().setTitle("Commands:");
HashMap<HelpPage, String> commandHash = new HashMap<HelpPage, String>();
for (GuildCommand command : manager.getGuildCommands()) {
for (GuildCommandInterface command : manager.getGuildCommands()) {
commandHash.put(command.getHelpPage(),
commandHash.get(command.getHelpPage()) + command.getCommandName());
@ -37,12 +37,12 @@ public class Help extends GuildCommand {
StringBuilder sB = new StringBuilder();
GuildCommand ping = blob.getCommandManager().getCommand("ping");
GuildCommandInterface ping = blob.getCommandManager().getCommand("ping");
if (ping != null) {
sB.append("`" + ping.getUsage() + "`\n");
}
GuildCommand help = blob.getCommandManager().getCommand("help");
GuildCommandInterface help = blob.getCommandManager().getCommand("help");
if (help != null) {
sB.append("`" + help.getUsage() + "`\n");
}
@ -86,7 +86,7 @@ public class Help extends GuildCommand {
// ##########################################################################################################################
try {
GuildCommand command = manager.getCommand(String.join("", blob.getArgs()));
GuildCommandInterface command = manager.getCommand(String.join("", blob.getArgs()));
// event.getChannel().sendMessage("Command help for `" + command.commandName() +
// "`:\n\tUsage: "+ command.usageString() + "\n" +

View file

@ -1,32 +1,44 @@
package pkg.deepCurse.nopalmo.command.guildCommand.info;
package pkg.deepCurse.nopalmo.command.commands;
import java.util.HashMap;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import pkg.deepCurse.nopalmo.command.GuildCommand;
import net.dv8tion.jda.api.entities.MessageChannel;
import pkg.deepCurse.nopalmo.command.CommandInterface.DirectCommandInterface;
import pkg.deepCurse.nopalmo.command.CommandInterface.GuildCommandInterface;
import pkg.deepCurse.nopalmo.database.DatabaseTools.Tools.Global;
import pkg.deepCurse.nopalmo.manager.Argument;
import pkg.deepCurse.nopalmo.manager.CommandBlob;
import pkg.deepCurse.nopalmo.manager.DirectCommandBlob;
import pkg.deepCurse.nopalmo.manager.GuildCommandBlob;
import pkg.deepCurse.nopalmo.utils.UptimePing;
public class Ping extends GuildCommand {
public class Ping implements GuildCommandInterface, DirectCommandInterface {
@Override
public void runCommand(GuildCommandBlob blob, HashMap<String, Argument> argumentMap) throws Exception {
GuildMessageReceivedEvent event = blob.getEvent();
public void runGuildCommand(GuildCommandBlob blob, HashMap<String, Argument> argumentMap) throws Exception {
dualCommand(new CommandBlob(blob), argumentMap);
}
@Override
public void runDirectCommand(DirectCommandBlob blob, HashMap<String, Argument> argumentMap) throws Exception {
dualCommand(new CommandBlob(blob), argumentMap);
}
private void dualCommand(CommandBlob blob, HashMap<String, Argument> argumentMap) throws Exception {
MessageChannel channel = blob.getChannel();
if (argumentMap.isEmpty()) {
event.getChannel().sendMessage("Pong!\n" + event.getJDA().getGatewayPing() + "ms\n").queue();
channel.sendMessage("Pong!\n" + blob.getJDA().getGatewayPing() + "ms\n").queue();
return;
}
if (argumentMap.get("all") != null) {
event.getChannel().sendMessage("Gathering data. . .").queue(msg -> {
channel.sendMessage("Gathering data. . .").queue(msg -> {
long timeToProcess = System.currentTimeMillis();
long jdaPing = event.getJDA().getGatewayPing();
long jdaPing = blob.getJDA().getGatewayPing();
long googlePing = -1;
try {
googlePing = UptimePing.sendPing("www.google.com");
@ -50,21 +62,6 @@ public class Ping extends GuildCommand {
.queue();
});
}
// if (argumentArray == null || argumentArray.isEmpty()) {
//
// return;
// } else {
//
// for (Argument i : argumentArray) {
// if (i.getArgName().contentEquals("all")) {
//
// } else {
// Tools.wrongUsage(event.getChannel(), this);
// }
// }
// return;
// }
}
@Override

View file

@ -1,84 +0,0 @@
package pkg.deepCurse.nopalmo.command.directCommand.info;
import java.util.HashMap;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import pkg.deepCurse.nopalmo.command.DirectCommand;
import pkg.deepCurse.nopalmo.database.DatabaseTools.Tools.Global;
import pkg.deepCurse.nopalmo.manager.Argument;
import pkg.deepCurse.nopalmo.manager.DirectCommandBlob;
import pkg.deepCurse.nopalmo.utils.UptimePing;
public class DirectMessagePing extends DirectCommand {
@Override
public void runCommand(DirectCommandBlob blob,
HashMap<String, Argument> argumentMap) throws Exception {
MessageReceivedEvent event = blob.getEvent();
if (argumentMap.isEmpty()) {
event.getChannel().sendMessage("Pong!\n" + event.getJDA().getGatewayPing() + "ms\n").queue();
return;
}
if (argumentMap.get("all") != null) {
event.getChannel().sendMessage("Gathering data. . .").queue(msg -> {
long timeToProcess = System.currentTimeMillis();
try { // TODO rewrite this block, all tries are not good practice
String out = "Pong!\n" + "Google: " + UptimePing.sendPing("www.google.com") + "ms\n"
+ "JDA Gateway: " + event.getJDA().getGatewayPing() + "ms\n" + "www.discord.com: "
+ UptimePing.sendPing("www.discord.com") + "ms";
msg.editMessage(out + "\nTime to process: " + (System.currentTimeMillis() - timeToProcess) + "ms")
.queue();
} catch (Exception e) {
e.printStackTrace();
}
});
}
// if (argumentArray == null || argumentArray.isEmpty()) {
//
// return;
// } else {
//
// for (Argument i : argumentArray) {
// if (i.getArgName().contentEquals("all")) {
//
// } else {
// Tools.wrongUsage(event.getChannel(), this);
// }
// }
// return;
// }
}
@Override
public String[] getCommandCalls() {
return new String[] { "ping" };
}
@Override
public String getUsage() {
return Global.prefix + "ping [" + Argument.argumentPrefix + "all]";
}
@Override
public HelpPage getHelpPage() {
return HelpPage.Info;
}
@Override
public HashMap<String, Argument> getArguments() {
HashMap<String, Argument> args = new HashMap<String, Argument>();
args.put("all", new Argument("all").setPrefixRequirement(true));
return args;
}
}

View file

@ -1,28 +0,0 @@
package pkg.deepCurse.nopalmo.command.guildCommand.info;
import java.util.HashMap;
import pkg.deepCurse.nopalmo.command.GuildCommand;
import pkg.deepCurse.nopalmo.manager.Argument;
import pkg.deepCurse.nopalmo.manager.GuildCommandBlob;
public class Git extends GuildCommand {
@Override
public void runCommand(GuildCommandBlob blob, HashMap<String, Argument> argumentList) throws Exception {
blob.getEvent().getChannel().sendMessage("Heres the link: https://github.com/lever1209/nopalmo").queue();
}
@Override
public String[] getCommandCalls() {
// TODO Auto-generated method stub
return new String[] { "git", "source", "github" };
}
@Override
public HelpPage getHelpPage() {
// TODO Auto-generated method stub
return HelpPage.Info;
}
}

View file

@ -1,18 +1,16 @@
package pkg.deepCurse.nopalmo.global;
import net.dv8tion.jda.api.entities.MessageChannel;
import net.dv8tion.jda.api.entities.TextChannel;
import pkg.deepCurse.nopalmo.command.DirectCommand;
import pkg.deepCurse.nopalmo.command.GuildCommand;
import pkg.deepCurse.nopalmo.command.CommandInterface;
public class Tools {
public static void wrongUsage(TextChannel tc, GuildCommand c) {
tc.sendMessage("Wrong Command Usage!\n" + c.getUsage()).queue();
public static void wrongUsage(MessageChannel messageChannel, CommandInterface command) {
messageChannel.sendMessage("Wrong Command Usage!\n" + command.getUsage()).queue();
}
public static void wrongUsage(MessageChannel tc, DirectCommand c) {
tc.sendMessage("Wrong Command Usage!\n" + c.getUsage()).queue();
}
// public static void wrongUsage(MessageChannel tc, DirectCommandInterface c) {
// tc.sendMessage("Wrong Command Usage!\n" + c.getUsage()).queue();
// }
}

View file

@ -21,16 +21,12 @@ public class DirectMessageReceivedListener extends ListenerAdapter {
public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
Message message = event.getMessage();
String messageRaw = message.getContentRaw();
System.out.println(messageRaw + "\n<@!" + event.getJDA().getSelfUser().getIdLong() + ">");
if (messageRaw.contentEquals(Global.prefix + Global.prefix)
&& DatabaseTools.Tools.Developers.canPowerOffBot(event.getAuthor().getIdLong())) {
// message.addReaction(Reactions.getReaction("galaxyThumb")).complete(); TODO re
// enable
// message.delete().complete();
// pause thread as last resort
// message.addReaction(Reactions.getReaction("galaxyThumb")).complete();
// TODO re enable
event.getJDA().shutdown();
System.exit(0);
@ -43,7 +39,6 @@ public class DirectMessageReceivedListener extends ListenerAdapter {
for (String i : prefixArray) { // TODO switch to [] to skip for loop?
if (messageRaw.startsWith(i)) {
// System.out.println("breaking");
shouldReturn = false;
}
}
@ -51,7 +46,6 @@ public class DirectMessageReceivedListener extends ListenerAdapter {
// TODO add pre manager commands
if (shouldReturn) {
return;
}

View file

@ -27,13 +27,11 @@ public class GuildMessageReceivedListener extends ListenerAdapter {
if (messageRaw.contentEquals(Global.prefix + Global.prefix)
&& DatabaseTools.Tools.Developers.canPowerOffBot(event.getAuthor().getIdLong())) {
// message.addReaction(Reactions.getReaction("galaxyThumb")).complete(); TODO re
// enable
// message.addReaction(Reactions.getReaction("galaxyThumb")).complete();
// TODO re enable
message.delete().complete();
// pause thread as last resort
event.getJDA().shutdown();
System.exit(0);
}

View file

@ -0,0 +1,119 @@
package pkg.deepCurse.nopalmo.manager;
import java.util.ArrayList;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.MessageChannel;
import net.dv8tion.jda.api.entities.PrivateChannel;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.events.Event;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
public class CommandBlob {
// CONTAINER/TRANSLATOR CLASS FOR COMMAND BLOBS
private Event event = null;
private CommandManager commandManager = null;
private ArrayList<String> args = null;
private JDA bot = null;
private long userID = 0;
private long channelID = 0;
public CommandBlob(GuildMessageReceivedEvent event) {
this.event = event;
this.bot = event.getJDA();
}
public CommandBlob(MessageReceivedEvent event) {
this.event = event;
this.bot = event.getJDA();
}
public CommandBlob(GuildCommandBlob blob) {
this.args = blob.getArgs();
this.channelID = blob.getChannelID();
this.commandManager = blob.getCommandManager();
this.event = blob.getEvent();
this.userID = blob.getUserID();
this.bot = blob.getEvent().getJDA();
}
public CommandBlob(DirectCommandBlob blob) {
this.args = blob.getArgs();
this.channelID = blob.getChannelID();
this.commandManager = blob.getCommandManager();
this.event = blob.getEvent();
this.userID = blob.getUserID();
this.bot = blob.getEvent().getJDA();
}
public long getChannelID() {
return channelID;
}
public CommandBlob setChannelID(long channelID) {
this.channelID = channelID;
return this;
}
public MessageChannel getChannel() {
TextChannel textChannel = bot.getTextChannelById(channelID);
if (textChannel != null){
return textChannel;
}
PrivateChannel privateChannel = bot.getPrivateChannelById(channelID);
if (privateChannel != null){
return privateChannel;
}
return null;
}
public MessageChannel getMessageChannel(long channelID) {
return bot.getTextChannelById(channelID);
}
public long getUserID() {
return userID;
}
public JDA getJDA() {
return bot;
}
public CommandBlob setUserID(long userID) {
this.userID = userID;
return this;
}
public ArrayList<String> getArgs() {
return args;
}
public CommandBlob setArgs(ArrayList<String> args) {
this.args = args;
return this;
}
public CommandManager getCommandManager() {
return commandManager;
}
public CommandBlob setCommandManager(CommandManager commandManager) {
this.commandManager = commandManager;
return this;
}
public Event getEvent() {
if (event instanceof GuildMessageReceivedEvent) {
return (GuildMessageReceivedEvent) event;
} else if (event instanceof MessageReceivedEvent) {
return (MessageReceivedEvent) event;
} else
return null;
}
}

View file

@ -0,0 +1,7 @@
package pkg.deepCurse.nopalmo.manager;
public abstract class CommandManager {
}

View file

@ -7,13 +7,12 @@ import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class DirectCommandBlob {
private DirectCommandManager commandManager = null;
private ArrayList<String> args = null;
private ArrayList<String> args = null;
private MessageReceivedEvent event = null;
private long userID = 0;
private long channelID = 0;
private MessageReceivedEvent event = null;
public DirectCommandBlob(MessageReceivedEvent event) {
setUserID(event.getAuthor().getIdLong());
setChannelID(event.getChannel().getIdLong());this.event = event;

View file

@ -12,15 +12,15 @@ import java.util.concurrent.Executors;
import java.util.regex.Pattern;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import pkg.deepCurse.nopalmo.command.DirectCommand;
import pkg.deepCurse.nopalmo.command.directCommand.info.DirectMessagePing;
import pkg.deepCurse.nopalmo.command.CommandInterface.DirectCommandInterface;
import pkg.deepCurse.nopalmo.command.commands.Ping;
import pkg.deepCurse.nopalmo.core.Boot;
import pkg.deepCurse.nopalmo.database.DatabaseTools;
import pkg.deepCurse.nopalmo.global.Tools;
public class DirectCommandManager {
public class DirectCommandManager extends CommandManager {
private final Map<String, DirectCommand> directCommandMap = new HashMap<>();
private final Map<String, DirectCommandInterface> directCommandMap = new HashMap<>();
private static Executor executor = null;
public DirectCommandManager() {
@ -30,11 +30,11 @@ public class DirectCommandManager {
public void init() {
addCommand(new DirectMessagePing());
addCommand(new Ping());
}
private void addCommand(DirectCommand c) {
private void addCommand(DirectCommandInterface c) {
if (!directCommandMap.containsKey(c.getCommandName())) {
directCommandMap.put(c.getCommandName(), c);
} else {
@ -43,11 +43,11 @@ public class DirectCommandManager {
}
}
public Collection<DirectCommand> getDirectCommands() {
public Collection<DirectCommandInterface> getDirectCommands() {
return directCommandMap.values();
}
public DirectCommand getCommand(String commandName) {
public DirectCommandInterface getCommand(String commandName) {
if (commandName != null) {
return directCommandMap.get(commandName);
}
@ -69,11 +69,8 @@ public class DirectCommandManager {
long commandStartTime = System.currentTimeMillis();
try {
// ArrayList<String> newArguments = new ArrayList<String>();
// ArrayList<String> commandFlags = new ArrayList<String>();
DirectCommandBlob commandBlob = new DirectCommandBlob(messageReceivedEvent);
DirectCommand directCommand = directCommandMap.get(command);
DirectCommandInterface directCommand = directCommandMap.get(command);
HashMap<String, Argument> argumentList = new HashMap<String, Argument>();
boolean printTime = false;
@ -142,7 +139,7 @@ public class DirectCommandManager {
commandBlob.setCommandManager(this);
if (remainsValid) {
directCommand.runCommand(commandBlob, argumentList);
directCommand.runDirectCommand(commandBlob, argumentList);
}
if (printTime) {

View file

@ -12,17 +12,17 @@ import java.util.concurrent.Executors;
import java.util.regex.Pattern;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import pkg.deepCurse.nopalmo.command.GuildCommand;
import pkg.deepCurse.nopalmo.command.guildCommand.info.Git;
import pkg.deepCurse.nopalmo.command.guildCommand.info.Help;
import pkg.deepCurse.nopalmo.command.guildCommand.info.Ping;
import pkg.deepCurse.nopalmo.command.CommandInterface.GuildCommandInterface;
import pkg.deepCurse.nopalmo.command.commands.Git;
import pkg.deepCurse.nopalmo.command.commands.Help;
import pkg.deepCurse.nopalmo.command.commands.Ping;
import pkg.deepCurse.nopalmo.core.Boot;
import pkg.deepCurse.nopalmo.database.DatabaseTools;
import pkg.deepCurse.nopalmo.global.Tools;
public class GuildCommandManager {
public class GuildCommandManager extends CommandManager {
private final Map<String, GuildCommand> guildCommandMap = new HashMap<>();
private final Map<String, GuildCommandInterface> guildCommandMap = new HashMap<>();
private static Executor executor = null;
public GuildCommandManager() {
@ -36,7 +36,7 @@ public class GuildCommandManager {
addCommand(new Git());
}
private void addCommand(GuildCommand c) {
private void addCommand(GuildCommandInterface c) {
if (!guildCommandMap.containsKey(c.getCommandName())) {
guildCommandMap.put(c.getCommandName(), c);
} else {
@ -45,11 +45,11 @@ public class GuildCommandManager {
}
}
public Collection<GuildCommand> getGuildCommands() {
public Collection<GuildCommandInterface> getGuildCommands() {
return guildCommandMap.values();
}
public GuildCommand getCommand(String commandName) {
public GuildCommandInterface getCommand(String commandName) {
if (commandName != null) {
return guildCommandMap.get(commandName);
}
@ -75,7 +75,7 @@ public class GuildCommandManager {
// ArrayList<String> commandFlags = new ArrayList<String>();
GuildCommandBlob commandBlob = new GuildCommandBlob(guildMessage);
GuildCommand guildCommand = guildCommandMap.get(command);
GuildCommandInterface guildCommand = guildCommandMap.get(command);
HashMap<String, Argument> argumentList = new HashMap<String, Argument>();
boolean printTime = false;
@ -144,7 +144,7 @@ public class GuildCommandManager {
commandBlob.setCommandManager(this);
if (remainsValid) {
guildCommand.runCommand(commandBlob, argumentList);
guildCommand.runGuildCommand(commandBlob, argumentList);
}
if (printTime) {

View file

@ -1,9 +1,7 @@
package pkg.deepCurse.nopalmo.utils;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.nio.channels.SocketChannel;
import java.util.Date;