mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-11-22 11:55:54 +01:00
GriefPrevention integration
This commit is contained in:
parent
1fa290402a
commit
a25e1a2449
@ -70,6 +70,7 @@ dependencies {
|
||||
|
||||
// Chat Integrations
|
||||
compileOnly(libs.chatty)
|
||||
compileOnly(libs.griefprevention)
|
||||
compileOnly(libs.lunachat)
|
||||
compileOnly(libs.mcmmo)
|
||||
compileOnly(libs.townychat)
|
||||
|
@ -248,6 +248,7 @@ public class BukkitDiscordSRV extends ServerDiscordSRV<DiscordSRVBukkitBootstrap
|
||||
|
||||
// Chat Integrations
|
||||
registerIntegration("com.discordsrv.bukkit.integration.chat.ChattyChatIntegration");
|
||||
registerIntegration("com.discordsrv.bukkit.integration.chat.GriefPreventionChatIntegration");
|
||||
registerIntegration("com.discordsrv.bukkit.integration.chat.LunaChatIntegration");
|
||||
registerIntegration("com.discordsrv.bukkit.integration.chat.McMMOChatIntegration");
|
||||
registerIntegration("com.discordsrv.bukkit.integration.chat.TownyChatIntegration");
|
||||
|
@ -0,0 +1,48 @@
|
||||
package com.discordsrv.bukkit.integration.chat;
|
||||
|
||||
import com.discordsrv.api.event.bus.EventPriority;
|
||||
import com.discordsrv.api.event.bus.Subscribe;
|
||||
import com.discordsrv.api.event.events.message.receive.game.GameChatMessageReceiveEvent;
|
||||
import com.discordsrv.api.player.DiscordSRVPlayer;
|
||||
import com.discordsrv.bukkit.BukkitDiscordSRV;
|
||||
import com.discordsrv.common.logging.NamedLogger;
|
||||
import com.discordsrv.common.module.type.PluginIntegration;
|
||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class GriefPreventionChatIntegration extends PluginIntegration<BukkitDiscordSRV> {
|
||||
|
||||
public GriefPreventionChatIntegration(BukkitDiscordSRV discordSRV) {
|
||||
super(discordSRV, new NamedLogger(discordSRV, "GRIEFPREVENTION"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getIntegrationName() {
|
||||
return "GriefPrevention";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
try {
|
||||
Class.forName("me.ryanhamshire.GriefPrevention.GriefPrevention");
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.isEnabled();
|
||||
}
|
||||
|
||||
@Subscribe(priority = EventPriority.EARLY)
|
||||
public void onGameChatMessageReceive(GameChatMessageReceiveEvent event) {
|
||||
GriefPrevention griefPrevention = (GriefPrevention) discordSRV.server().getPluginManager().getPlugin(getIntegrationName());
|
||||
if (griefPrevention == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
DiscordSRVPlayer player = event.getPlayer();
|
||||
if (griefPrevention.dataStore.isSoftMuted(player.uniqueId())) {
|
||||
logger().debug(player.username() + " is softmuted");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -64,7 +64,11 @@ public class McMMOChatIntegration extends PluginIntegration<BukkitDiscordSRV> im
|
||||
return;
|
||||
}
|
||||
|
||||
if (ChatAPI.isUsingPartyChat(player) || ChatAPI.isUsingAdminChat(player)) {
|
||||
if (ChatAPI.isUsingPartyChat(player)) {
|
||||
logger().debug(player.getName() + " is using party chat");
|
||||
event.setCancelled(true);
|
||||
} else if (ChatAPI.isUsingAdminChat(player)) {
|
||||
logger().debug(player.getName() + " is using admin chat");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,7 @@ dependencyResolutionManagement {
|
||||
library('chatty', 'ru.mrbrikster', 'chatty-api').version('2.19.13')
|
||||
library('lunachat', 'com.github.ucchyocean.lc', 'LunaChat').version('3.0.16')
|
||||
library('mcmmo', 'com.gmail.nossr50', 'mcmmo').version('2.1.220')
|
||||
library('griefprevention', 'me.ryanhamshire', 'GriefPrevention').version('16.18.1')
|
||||
|
||||
// Logging
|
||||
library('slf4j-api', 'org.slf4j', 'slf4j-api').version('1.7.36')
|
||||
|
Loading…
Reference in New Issue
Block a user