mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-01-08 08:47:57 +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>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<!-- Bukkit API Version, change if out dated -->
|
<!-- 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>
|
<build.number>SNAPSHOT</build.number>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@ -427,7 +427,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.scarsz.discordsrv</groupId>
|
<groupId>com.scarsz.discordsrv</groupId>
|
||||||
<artifactId>DiscordSRV</artifactId>
|
<artifactId>DiscordSRV</artifactId>
|
||||||
<version>13.3</version>
|
<version>13.5</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ public class DiscordListener {
|
|||||||
public DiscordListener(PurpleIRC plugin) {
|
public DiscordListener(PurpleIRC plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(priority = ListenerPriority.MONITOR)
|
@Subscribe(priority = ListenerPriority.MONITOR)
|
||||||
public void discordMessageReceived(DiscordGuildMessageReceivedEvent event) {
|
public void onDiscordGuildMessageReceivedEvent(DiscordGuildMessageReceivedEvent event) {
|
||||||
for (PurpleBot ircBot : plugin.ircBots.values()) {
|
for (PurpleBot ircBot : plugin.ircBots.values()) {
|
||||||
ircBot.discordChat(event.getMessage().getAuthor().getName(),
|
ircBot.discordChat(event.getMessage().getAuthor().getName(),
|
||||||
event.getChannel().getName(),
|
event.getChannel().getName(),
|
||||||
|
@ -19,6 +19,7 @@ package com.cnaude.purpleirc.Hooks;
|
|||||||
import com.cnaude.purpleirc.GameListeners.DiscordListener;
|
import com.cnaude.purpleirc.GameListeners.DiscordListener;
|
||||||
import com.cnaude.purpleirc.PurpleIRC;import github.scarsz.discordsrv.DiscordSRV;
|
import com.cnaude.purpleirc.PurpleIRC;import github.scarsz.discordsrv.DiscordSRV;
|
||||||
import github.scarsz.discordsrv.dependancies.jda.core.entities.TextChannel;
|
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();
|
TextChannel chatChannel = DiscordSRV.getPlugin().getMainTextChannel();
|
||||||
plugin.logDebug("DiscordSRVHook: Message to be sent: " + message);
|
plugin.logDebug("DiscordSRVHook: Message to be sent: " + message);
|
||||||
if (textChannel != null) {
|
if (textChannel != null) {
|
||||||
plugin.logDebug("DiscordSRVHook: Sending mssage to channel " + channelName);
|
plugin.logDebug("DiscordSRVHook: Sending message to channel " + channelName);
|
||||||
textChannel.sendMessage(message);
|
DiscordUtil.sendMessage(textChannel, message);
|
||||||
} else {
|
} else {
|
||||||
plugin.logDebug("DiscordSRVHook: Unable to find channel: " + channelName);
|
plugin.logDebug("DiscordSRVHook: Unable to find channel: " + channelName);
|
||||||
plugin.logDebug("DiscordSRVHook: Channel list: " + DiscordSRV.getPlugin().getChannels().keySet());
|
plugin.logDebug("DiscordSRVHook: Channel list: " + DiscordSRV.getPlugin().getChannels().keySet());
|
||||||
plugin.logDebug("DiscordSRVHook: Sending message to ChatChannel instead: " + chatChannel.getName());
|
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 {
|
} else {
|
||||||
hookList.add(hookFormat(PL_DISCORDSRV, false));
|
hookList.add(hookFormat(PL_DISCORDSRV, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPluginEnabled(PL_UCHAT)) {
|
if (isPluginEnabled(PL_UCHAT)) {
|
||||||
getServer().getPluginManager().registerEvents(new UltimateChatListener(this), this);
|
getServer().getPluginManager().registerEvents(new UltimateChatListener(this), this);
|
||||||
|
hookList.add(hookFormat(PL_UCHAT, true));
|
||||||
} else {
|
} else {
|
||||||
hookList.add(hookFormat(PL_UCHAT, false));
|
hookList.add(hookFormat(PL_UCHAT, false));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user