+Added command injection from plugins
This commit is contained in:
@@ -60,6 +60,15 @@ public class UserInput
|
|||||||
isValid = false;
|
isValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Used for injecting direct commands from plugins
|
||||||
|
public UserInput(String input, KittyGuild contextGuild)
|
||||||
|
{
|
||||||
|
int loc = FindFirstWhitespace(input);
|
||||||
|
key = input.substring(0, loc);
|
||||||
|
args = input.substring(loc);
|
||||||
|
isValid = true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean IsValid()
|
public boolean IsValid()
|
||||||
{
|
{
|
||||||
|
|||||||
+12
-2
@@ -91,8 +91,18 @@ public class Main extends ListenerAdapter
|
|||||||
|
|
||||||
if(pluginOutput != null && pluginOutput.size() > 0)
|
if(pluginOutput != null && pluginOutput.size() > 0)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < pluginOutput.size(); ++i)
|
for(int i = 0; i < pluginOutput.size(); ++i)
|
||||||
response.Call(pluginOutput.get(i));
|
{
|
||||||
|
if(pluginOutput.get(i).startsWith("!"))
|
||||||
|
{
|
||||||
|
commandManager.InvokeOnNewThread(guild, channel, user, new UserInput(pluginOutput.get(i).substring(1), guild), response);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response.Call(pluginOutput.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user