mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-01-07 16:27:43 +01:00
Use DiscordUtil for sending messages to Discord. #30
This commit is contained in:
parent
f31bec89b7
commit
3050b42dc9
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<!-- Bukkit API Version, change if out dated -->
|
||||
<bukkit.version>1.11.1</bukkit.version>
|
||||
<bukkit.version>1.11.2</bukkit.version>
|
||||
<build.number>SNAPSHOT</build.number>
|
||||
</properties>
|
||||
|
||||
@ -427,7 +427,7 @@
|
||||
<dependency>
|
||||
<groupId>com.scarsz.discordsrv</groupId>
|
||||
<artifactId>DiscordSRV</artifactId>
|
||||
<version>13.3</version>
|
||||
<version>13.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -37,9 +37,9 @@ public class DiscordListener {
|
||||
public DiscordListener(PurpleIRC plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(priority = ListenerPriority.MONITOR)
|
||||
public void discordMessageReceived(DiscordGuildMessageReceivedEvent event) {
|
||||
public void onDiscordGuildMessageReceivedEvent(DiscordGuildMessageReceivedEvent event) {
|
||||
for (PurpleBot ircBot : plugin.ircBots.values()) {
|
||||
ircBot.discordChat(event.getMessage().getAuthor().getName(),
|
||||
event.getChannel().getName(),
|
||||
|
@ -19,6 +19,7 @@ package com.cnaude.purpleirc.Hooks;
|
||||
import com.cnaude.purpleirc.GameListeners.DiscordListener;
|
||||
import com.cnaude.purpleirc.PurpleIRC;import github.scarsz.discordsrv.DiscordSRV;
|
||||
import github.scarsz.discordsrv.dependancies.jda.core.entities.TextChannel;
|
||||
import github.scarsz.discordsrv.util.DiscordUtil;
|
||||
;
|
||||
|
||||
/**
|
||||
@ -49,13 +50,13 @@ public class DiscordSRVHook {
|
||||
TextChannel chatChannel = DiscordSRV.getPlugin().getMainTextChannel();
|
||||
plugin.logDebug("DiscordSRVHook: Message to be sent: " + message);
|
||||
if (textChannel != null) {
|
||||
plugin.logDebug("DiscordSRVHook: Sending mssage to channel " + channelName);
|
||||
textChannel.sendMessage(message);
|
||||
plugin.logDebug("DiscordSRVHook: Sending message to channel " + channelName);
|
||||
DiscordUtil.sendMessage(textChannel, message);
|
||||
} else {
|
||||
plugin.logDebug("DiscordSRVHook: Unable to find channel: " + channelName);
|
||||
plugin.logDebug("DiscordSRVHook: Channel list: " + DiscordSRV.getPlugin().getChannels().keySet());
|
||||
plugin.logDebug("DiscordSRVHook: Sending message to ChatChannel instead: " + chatChannel.getName());
|
||||
chatChannel.sendMessage(message);
|
||||
DiscordUtil.sendMessage(chatChannel, message);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1774,9 +1774,9 @@ public class PurpleIRC extends JavaPlugin {
|
||||
} else {
|
||||
hookList.add(hookFormat(PL_DISCORDSRV, false));
|
||||
}
|
||||
|
||||
if (isPluginEnabled(PL_UCHAT)) {
|
||||
getServer().getPluginManager().registerEvents(new UltimateChatListener(this), this);
|
||||
hookList.add(hookFormat(PL_UCHAT, true));
|
||||
} else {
|
||||
hookList.add(hookFormat(PL_UCHAT, false));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user