Why haven't I commited this

Only the plugin.yml and registering /discord is the current change.
This commit is contained in:
Norbi Peti 2016-10-30 23:10:02 +01:00
parent c6b831e035
commit cacb14a307
4 changed files with 14 additions and 6 deletions

View file

@ -2,9 +2,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.tbmcplugins</groupId>
<groupId>com.github.TBMCPlugins</groupId>
<artifactId>DiscordPlugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>master-SNAPSHOT</version>
<packaging>jar</packaging>
<name>DiscordPlugin</name>

View file

@ -34,9 +34,12 @@ public class CommandListener {
private static void runCommand(IMessage message) {
String cmdwithargs = message.getContent();
final String mention = DiscordPlugin.dc.getOurUser().mention();
if (message.getContent().startsWith(mention)) // TODO: Resolve mentions: Compound arguments, either a mention or text
cmdwithargs = cmdwithargs.substring(mention.length());
final String mention = DiscordPlugin.dc.getOurUser().mention(false);
final String mentionNick = DiscordPlugin.dc.getOurUser().mention(true);
if (message.getContent().startsWith(mention) && cmdwithargs.length() > mention.length() + 1) // TODO: Resolve mentions: Compound arguments, either a mention or text
cmdwithargs = cmdwithargs.substring(mention.length() + 1);
if (message.getContent().startsWith(mentionNick) && cmdwithargs.length() > mentionNick.length() + 1)
cmdwithargs = cmdwithargs.substring(mentionNick.length() + 1);
int index = cmdwithargs.indexOf(' ');
String cmd;
String args;
@ -45,7 +48,7 @@ public class CommandListener {
args = "";
} else {
cmd = cmdwithargs.substring(0, index);
args = cmdwithargs.substring(index);
args = cmdwithargs.substring(index + 1);
}
DiscordCommandBase.runCommand(cmd, args, message);
}

View file

@ -14,7 +14,9 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import buttondevteam.discordplugin.mccommands.DiscordMCCommandBase;
import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.chat.TBMCChatAPI;
import sx.blah.discord.api.*;
import sx.blah.discord.api.events.IListener;
import sx.blah.discord.handle.impl.events.ReadyEvent;
@ -54,6 +56,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
for (IListener<?> listener : CommandListener.getListeners())
dc.getDispatcher().registerListener(listener);
Bukkit.getPluginManager().registerEvents(new MCListener(), this);
TBMCChatAPI.AddCommands(this, DiscordMCCommandBase.class);
} catch (Exception e) {
e.printStackTrace();
Bukkit.getPluginManager().disablePlugin(this);

View file

@ -3,3 +3,5 @@ main: buttondevteam.discordplugin.DiscordPlugin
version: 1.0
author: TBMCPlugins
depend: []
commands:
discord: