IT WORKS! Chat works! With some bugs ofc
This commit is contained in:
parent
df75adb67a
commit
20d6cd7313
3 changed files with 11 additions and 27 deletions
|
@ -14,9 +14,9 @@ import com.google.gson.JsonElement;
|
|||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import buttondevteam.discordplugin.listeners.ChatListener;
|
||||
import buttondevteam.discordplugin.listeners.CommandListener;
|
||||
import buttondevteam.discordplugin.listeners.ExceptionListener;
|
||||
import buttondevteam.discordplugin.listeners.MCChatListener;
|
||||
import buttondevteam.discordplugin.listeners.MCListener;
|
||||
import buttondevteam.discordplugin.mccommands.DiscordMCCommandBase;
|
||||
import buttondevteam.lib.TBMCCoreAPI;
|
||||
|
@ -61,7 +61,9 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
|||
dc.getDispatcher().registerListener(this);
|
||||
for (IListener<?> listener : CommandListener.getListeners())
|
||||
dc.getDispatcher().registerListener(listener);
|
||||
dc.getDispatcher().registerListener(new ChatListener());
|
||||
MCChatListener mcchat = new MCChatListener();
|
||||
dc.getDispatcher().registerListener(mcchat);
|
||||
TBMCCoreAPI.RegisterEventsForExceptions(mcchat, this);
|
||||
Bukkit.getPluginManager().registerEvents(new ExceptionListener(), this);
|
||||
TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(), this);
|
||||
TBMCChatAPI.AddCommands(this, DiscordMCCommandBase.class);
|
||||
|
@ -96,16 +98,16 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
|||
annchannel = mainServer.getChannelByID("126795071927353344"); // announcements
|
||||
genchannel = mainServer.getChannelByID("125813020357165056"); // general
|
||||
chatchannel = mainServer.getChannelByID("249663564057411596"); // minecraft_chat
|
||||
issuechannel = devServer.getChannelByID("219643416496046081"); //server-issues
|
||||
debugchannel = devServer.getChannelByID("250332016199860224"); //debug-channel
|
||||
botroomchannel = devServer.getChannelByID("239519012529111040");//bot-room
|
||||
issuechannel = devServer.getChannelByID("219643416496046081"); // server-issues
|
||||
debugchannel = devServer.getChannelByID("250332016199860224"); // debug-channel
|
||||
botroomchannel = devServer.getChannelByID("239519012529111040");// bot-room
|
||||
dc.changeStatus(Status.game("on TBMC"));
|
||||
} else {
|
||||
botchannel = devServer.getChannelByID("239519012529111040"); // bot-room
|
||||
annchannel = devServer.getChannelByID("239519012529111040"); // bot-room
|
||||
genchannel = devServer.getChannelByID("239519012529111040"); // bot-room
|
||||
botroomchannel = devServer.getChannelByID("239519012529111040");//bot-room
|
||||
issuechannel = devServer.getChannelByID("239519012529111040"); //bot-room
|
||||
botroomchannel = devServer.getChannelByID("239519012529111040");// bot-room
|
||||
issuechannel = devServer.getChannelByID("239519012529111040"); // bot-room
|
||||
debugchannel = devServer.getChannelByID("239519012529111040"); // bot-room
|
||||
chatchannel = devServer.getChannelByID("248185455508455424"); // minecraft_chat_test
|
||||
dc.changeStatus(Status.game("testing"));
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package buttondevteam.discordplugin.listeners;
|
||||
|
||||
import buttondevteam.discordplugin.DiscordPlugin;
|
||||
import sx.blah.discord.api.events.IListener;
|
||||
import sx.blah.discord.handle.impl.events.MessageReceivedEvent;
|
||||
|
||||
public class ChatListener implements IListener<MessageReceivedEvent> {
|
||||
|
||||
@Override
|
||||
public void handle(MessageReceivedEvent event) {
|
||||
if (!event.getMessage().getChannel().getID().equals(DiscordPlugin.chatchannel.getID()))
|
||||
return;
|
||||
if (event.getMessage().getContent().startsWith("/"))
|
||||
; // Call API method
|
||||
else
|
||||
;
|
||||
}
|
||||
|
||||
}
|
|
@ -20,6 +20,7 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
|
|||
|
||||
@Override
|
||||
public void handle(MessageReceivedEvent event) {
|
||||
if (event.getMessage().getChannel().getID().equals(DiscordPlugin.chatchannel.getID()))
|
||||
TBMCChatAPI.SendChatMessage(Channel.GlobalChat, Bukkit.getConsoleSender(), event.getMessage().getContent());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue