DiscordSRV now ignores shadow mute players

+ Added DiscordSRV as a softdepend
+ Added a listener to cancel DiscordSRV events for players who are shadow muted
pull/3/head
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>
<artifactId>QoL</artifactId>
<!-- Version is used in plugin.yml -->
<version>1.9</version>
<version>1.10</version>
<packaging>jar</packaging>
<!-- Plugin Information -->
@ -31,7 +31,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<version>1.16.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -54,7 +54,12 @@
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.discordsrv</groupId>
<artifactId>discordsrv</artifactId>
<version>1.19.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
@ -62,6 +67,10 @@
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>Scarsz-Nexus</id>
<url>https://nexus.scarsz.me/content/groups/public/</url>
</repository>
<repository>
<id>etztech-repo</id>
<url>http://repo.etztech.xyz</url>
@ -80,7 +89,7 @@
</repository>
<repository> <!-- This repo fixes issues with transitive dependencies -->
<id>jcenter</id>
<url>http://jcenter.bintray.com</url>
<url>https://jcenter.bintray.com</url>
</repository>
<repository>
<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() ) {
// Add listeners

View File

@ -54,7 +54,7 @@ public class ShadowMuteCommand implements CommandExecutor {
}
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);
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}
website: ${url}
main: ${mainClass}
softdepend: [Essentials, dynmap]
softdepend: [Essentials, dynmap, DiscordSRV]
commands:
qol:
description: Base command