Merged in feature/essx-discord-hook (pull request #10)

Add EssentialsX Discord Support

Approved-by: Aust1n46
This commit is contained in:
JRoy 2021-08-26 18:50:58 +00:00 committed by Aust1n46
commit 8991cb7edd
3 changed files with 36 additions and 10 deletions

20
pom.xml
View File

@ -96,6 +96,10 @@
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>essentialsx-repo</id>
<url>https://repo.essentialsx.net/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
@ -150,6 +154,22 @@
<version>0.96.7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.essentialsx</groupId>
<artifactId>EssentialsXDiscord</artifactId>
<version>2.19.0-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
</exclusion>
<exclusion>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>

View File

@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.Set;
import net.essentialsx.api.v2.services.discord.DiscordService;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -33,6 +34,7 @@ import mineverse.Aust1n46.chat.utilities.Format;
//This class listens to chat through the chat event and handles the bulk of the chat channels and formatting.
public class ChatListener implements Listener {
private final boolean essentialsDiscordHook = Bukkit.getPluginManager().isPluginEnabled("EssentialsDiscord");
private MineverseChat plugin = MineverseChat.getInstance();
@EventHandler(priority = EventPriority.NORMAL)
@ -525,6 +527,10 @@ public class ChatListener implements Listener {
Format.sendPacketPlayOutChat(p, packet);
}
Bukkit.getConsoleSender().sendMessage(consoleChat);
if (essentialsDiscordHook && channel.isDefaultchannel()) {
Bukkit.getServicesManager().load(DiscordService.class).sendChatMessage(mcp.getPlayer(), chat);
}
return;
}
else {

View File

@ -3,19 +3,19 @@ version: ${project.version}
api-version: 1.13
main: mineverse.Aust1n46.chat.MineverseChat
depend: [Vault, ProtocolLib, PlaceholderAPI]
softdepend: [Towny, Factions, Heroes]
softdepend: [Towny, Factions, Heroes, EssentialsDiscord]
author: Aust1n46
website: https://bitbucket.org/Aust1n46/venturechat/
description: #1 Channels Chat plugin! Spigot + Bungee. Supports PlaceholderAPI + JSON formatting. Moderation GUI!
commands:
mute:
usage: /mute [playername] [channel]
aliases: [mp,vmute]
description: Mutes player in a channel so they cannot talk.
permission-message: You don't have <permission>
unmute:
usage: /unmute [playername] [channel]
aliases: [ump,vunmute]
commands:
mute:
usage: /mute [playername] [channel]
aliases: [mp,vmute]
description: Mutes player in a channel so they cannot talk.
permission-message: You don't have <permission>
unmute:
usage: /unmute [playername] [channel]
aliases: [ump,vunmute]
description: Unmutes player in a channel so they can talk again.
permission-message: You don't have <permission>
msg: