Auto stash before merge of "develop" and "master"
This commit is contained in:
@@ -47,6 +47,7 @@ import commands.general.CommandTweet;
|
||||
import commands.general.CommandWolfram;
|
||||
import commands.general.CommandYeet;
|
||||
import commands.guildrole.CommandGuildRoleMain;
|
||||
import commands.mod.CommandModMain;
|
||||
import commands.poll.CommandPollMain;
|
||||
import commands.raffle.CommandRaffleMain;
|
||||
import dataStructures.KittyChannel;
|
||||
@@ -115,6 +116,7 @@ public class CommandManager
|
||||
// Mod
|
||||
this.register(LocCommands.stub("givebeans"), new CommandGiveBeans(KittyRole.Mod, KittyRating.Safe));
|
||||
this.register(LocCommands.stub("rpg"), new CommandRPG(KittyRole.Mod, KittyRating.Safe));
|
||||
this.register(LocCommands.stub("mod"), new CommandModMain(KittyRole.Mod, KittyRating.Safe));
|
||||
|
||||
// General
|
||||
this.register(LocCommands.stub("fetch"), new CommandFetch(KittyRole.General, KittyRating.Safe));
|
||||
|
||||
@@ -42,7 +42,7 @@ public abstract class SubCommand
|
||||
|
||||
// Called by the Command manager - this will run the command
|
||||
// if the issuing user has the permission to do so!
|
||||
protected final SubCommandFormattable Invoke(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
||||
protected final SubCommandFormattable Invoke(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||
{
|
||||
if(!CanCall(guild, channel, user))
|
||||
return null;
|
||||
@@ -60,5 +60,5 @@ public abstract class SubCommand
|
||||
return roleLevel;
|
||||
}
|
||||
|
||||
public abstract SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, String input);
|
||||
public abstract SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input);
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||
import dataStructures.KittyChannel;
|
||||
import dataStructures.KittyGuild;
|
||||
import dataStructures.KittyUser;
|
||||
import dataStructures.UserInput;
|
||||
import utils.GlobalLog;
|
||||
|
||||
public class SubCommandFramework
|
||||
@@ -25,18 +26,22 @@ public class SubCommandFramework
|
||||
GlobalLog.log("Registered SubCommand " + name);
|
||||
}
|
||||
|
||||
public SubCommandFormattable run(KittyGuild guild, KittyChannel channel, KittyUser user, String input)
|
||||
public SubCommandFormattable run(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||
{
|
||||
SubCommandFormattable res = null;
|
||||
try
|
||||
SubCommand res = commands.get(input.args.split(" ")[0].toLowerCase());
|
||||
try
|
||||
{
|
||||
res = commands.get(input.split(" ")[0].toLowerCase()).Invoke(guild, channel, user, input.substring(input.indexOf(" ")));
|
||||
input.args = input.args.substring(input.args.indexOf(' ')).trim();
|
||||
}
|
||||
catch(Exception e){}
|
||||
|
||||
try
|
||||
{
|
||||
return res.Invoke(guild, channel, user, input);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
res = commands.get(input.split(" ")[0].toLowerCase()).Invoke(guild, channel, user, "");
|
||||
return new SubCommandFormattable("That's not a valid subcommand!");
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user