Did the MC chat connection, at least a test

This commit is contained in:
Norbi Peti 2016-11-25 19:16:19 +01:00
parent 8069c71663
commit df75adb67a

View file

@ -1,7 +1,25 @@
package buttondevteam.discordplugin.listeners;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class MCChatListener implements Listener {
// Custom event
import buttondevteam.discordplugin.DiscordPlugin;
import buttondevteam.lib.TBMCChatEvent;
import buttondevteam.lib.chat.Channel;
import buttondevteam.lib.chat.TBMCChatAPI;
import sx.blah.discord.api.events.IListener;
import sx.blah.discord.handle.impl.events.MessageReceivedEvent;
public class MCChatListener implements Listener, IListener<MessageReceivedEvent> {
@EventHandler
public void onMCChat(TBMCChatEvent e) {
DiscordPlugin.sendMessageToChannel(DiscordPlugin.chatchannel,
"[" + e.getChannel().DisplayName + "] <" + e.getSender().getName() + "> " + e.getMessage());
}
@Override
public void handle(MessageReceivedEvent event) {
TBMCChatAPI.SendChatMessage(Channel.GlobalChat, Bukkit.getConsoleSender(), event.getMessage().getContent());
}
}