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.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
import buttondevteam.discordplugin.listeners.ChatListener;
|
|
||||||
import buttondevteam.discordplugin.listeners.CommandListener;
|
import buttondevteam.discordplugin.listeners.CommandListener;
|
||||||
import buttondevteam.discordplugin.listeners.ExceptionListener;
|
import buttondevteam.discordplugin.listeners.ExceptionListener;
|
||||||
|
import buttondevteam.discordplugin.listeners.MCChatListener;
|
||||||
import buttondevteam.discordplugin.listeners.MCListener;
|
import buttondevteam.discordplugin.listeners.MCListener;
|
||||||
import buttondevteam.discordplugin.mccommands.DiscordMCCommandBase;
|
import buttondevteam.discordplugin.mccommands.DiscordMCCommandBase;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
@ -61,7 +61,9 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
dc.getDispatcher().registerListener(this);
|
dc.getDispatcher().registerListener(this);
|
||||||
for (IListener<?> listener : CommandListener.getListeners())
|
for (IListener<?> listener : CommandListener.getListeners())
|
||||||
dc.getDispatcher().registerListener(listener);
|
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);
|
Bukkit.getPluginManager().registerEvents(new ExceptionListener(), this);
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new MCListener(), this);
|
||||||
TBMCChatAPI.AddCommands(this, DiscordMCCommandBase.class);
|
TBMCChatAPI.AddCommands(this, DiscordMCCommandBase.class);
|
||||||
|
|
|
@ -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
|
@Override
|
||||||
public void handle(MessageReceivedEvent event) {
|
public void handle(MessageReceivedEvent event) {
|
||||||
|
if (event.getMessage().getChannel().getID().equals(DiscordPlugin.chatchannel.getID()))
|
||||||
TBMCChatAPI.SendChatMessage(Channel.GlobalChat, Bukkit.getConsoleSender(), event.getMessage().getContent());
|
TBMCChatAPI.SendChatMessage(Channel.GlobalChat, Bukkit.getConsoleSender(), event.getMessage().getContent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue