DiscordSRV now ignores shadow mute players

+ Added DiscordSRV as a softdepend
+ Added a listener to cancel DiscordSRV events for players who are shadow muted
mauberries/main
Joey Hines 2020-10-02 18:12:34 -05:00
parent c9434b916e
commit fc163baf51
5 changed files with 42 additions and 6 deletions

17
pom.xml
View File

@ -3,7 +3,7 @@
<groupId>xyz.etztech</groupId> <groupId>xyz.etztech</groupId>
<artifactId>QoL</artifactId> <artifactId>QoL</artifactId>
<!-- Version is used in plugin.yml --> <!-- Version is used in plugin.yml -->
<version>1.9</version> <version>1.10</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<!-- Plugin Information --> <!-- Plugin Information -->
@ -31,7 +31,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version> <version>1.16.3-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -54,7 +54,12 @@
<artifactId>commons-lang</artifactId> <artifactId>commons-lang</artifactId>
<version>2.6</version> <version>2.6</version>
</dependency> </dependency>
<dependency>
<groupId>com.discordsrv</groupId>
<artifactId>discordsrv</artifactId>
<version>1.19.1</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
@ -62,6 +67,10 @@
<id>spigotmc-repo</id> <id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url> <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository> </repository>
<repository>
<id>Scarsz-Nexus</id>
<url>https://nexus.scarsz.me/content/groups/public/</url>
</repository>
<repository> <repository>
<id>etztech-repo</id> <id>etztech-repo</id>
<url>http://repo.etztech.xyz</url> <url>http://repo.etztech.xyz</url>
@ -80,7 +89,7 @@
</repository> </repository>
<repository> <!-- This repo fixes issues with transitive dependencies --> <repository> <!-- This repo fixes issues with transitive dependencies -->
<id>jcenter</id> <id>jcenter</id>
<url>http://jcenter.bintray.com</url> <url>https://jcenter.bintray.com</url>
</repository> </repository>
<repository> <repository>
<id>jitpack.io</id> <id>jitpack.io</id>

View File

@ -84,6 +84,10 @@ public class QoL extends JavaPlugin {
} }
} }
if (Bukkit.getPluginManager().isPluginEnabled("DiscordSRV")) {
new DiscordSRVListener(this);
}
if( isEnabled() ) { if( isEnabled() ) {
// Add listeners // Add listeners

View File

@ -54,7 +54,7 @@ public class ShadowMuteCommand implements CommandExecutor {
} }
EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Shadow Muting " + ChatColor.YELLOW + EtzTechUtil.sms(commandSender, ChatColor.GREEN + "Shadow Muting " + ChatColor.YELLOW +
player.getName() + ChatColor.GREEN + " for " + ChatColor.YELLOW + duration.toString()); player.getName() + ChatColor.GREEN + " for " + ChatColor.YELLOW + duration.getDuration().toMinutes() + "minutes.");
QoL.addSM(player); QoL.addSM(player);
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() { Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {

View File

@ -0,0 +1,23 @@
package xyz.etztech.qol.listeners;
import github.scarsz.discordsrv.DiscordSRV;
import github.scarsz.discordsrv.api.events.GameChatMessagePreProcessEvent;
import xyz.etztech.qol.QoL;
import github.scarsz.discordsrv.api.Subscribe;
public class DiscordSRVListener {
private final QoL plugin;
public DiscordSRVListener(QoL plugin) {
this.plugin = plugin;
DiscordSRV.api.subscribe(this);
}
@Subscribe
public void gameChatMessagePreProcess(GameChatMessagePreProcessEvent event) {
if (QoL.hasSM(event.getPlayer())) {
event.setCancelled(true);
}
}
}

View File

@ -4,7 +4,7 @@ description: ${description}
author: ${author} author: ${author}
website: ${url} website: ${url}
main: ${mainClass} main: ${mainClass}
softdepend: [Essentials, dynmap] softdepend: [Essentials, dynmap, DiscordSRV]
commands: commands:
qol: qol:
description: Base command description: Base command