Made msgs not send to Discord if cancelled

This commit is contained in:
Norbi Peti 2016-12-18 12:58:37 +01:00
parent f7b1090670
commit 41f6cc342d

View file

@ -22,6 +22,8 @@ import sx.blah.discord.handle.obj.IUser;
public class MCChatListener implements Listener, IListener<MessageReceivedEvent> { public class MCChatListener implements Listener, IListener<MessageReceivedEvent> {
@EventHandler // Minecraft @EventHandler // Minecraft
public void onMCChat(TBMCChatEvent e) { public void onMCChat(TBMCChatEvent e) {
if (e.isCancelled())
return;
if (e.getSender() instanceof DiscordSender || e.getSender() instanceof DiscordPlayerSender) if (e.getSender() instanceof DiscordSender || e.getSender() instanceof DiscordPlayerSender)
return; return;
if (e.getChannel().equals(Channel.GlobalChat)) if (e.getChannel().equals(Channel.GlobalChat))
@ -32,8 +34,8 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
+ DiscordPlugin.sanitizeString(e.getMessage())); + DiscordPlugin.sanitizeString(e.getMessage()));
} }
private static final String[] UnconnectedCmds = new String[] { "list", "u", "shrug", "tableflip", "unflip", private static final String[] UnconnectedCmds = new String[] { "list", "u", "shrug", "tableflip", "unflip", "mwiki",
"mwiki", "t" }; "t" };
public static final HashMap<String, DiscordSender> UnconnectedSenders = new HashMap<>(); public static final HashMap<String, DiscordSender> UnconnectedSenders = new HashMap<>();
public static final HashMap<String, DiscordPlayerSender> ConnectedSenders = new HashMap<>(); public static final HashMap<String, DiscordPlayerSender> ConnectedSenders = new HashMap<>();