-DiscordSRV integration for halt notifications

This commit is contained in:
KyTDK committed 2023-11-14 21:11:15 +11:00
1 parent 6a1a3b9b5b
commit c3b6519fbb
13 files changed
+39 -9

No files matched your search

+6 -1
View File
@@ -116,7 +116,7 @@
<dependency>
<groupId>com.discordsrv</groupId>
<artifactId>discordsrv</artifactId>
<version>1.26.2</version>
<version>1.27.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -137,5 +137,10 @@
<id>Scarsz-Nexus</id>
<url>https://nexus.scarsz.me/content/groups/public/</url>
</repository>
<repository>
<id>dv8tion</id>
<name>m2-dv8tion</name>
<url>https://m2.dv8tion.net/releases</url>
</repository>
</repositories>
</project>
@@ -1,7 +1,7 @@
package com.neomechanical.neoperformance.integrations.discorsrv;
import github.scarsz.discordsrv.DiscordSRV;
import net.dv8tion.jda.api.entities.TextChannel;
import github.scarsz.discordsrv.dependencies.jda.api.entities.TextChannel;
public class DiscordSRVHook {
@@ -13,7 +13,7 @@ public class DiscordSRVHook {
TextChannel textChannel = DiscordSRV.getPlugin().getMainTextChannel();
if (textChannel != null) {
textChannel.sendMessage(message).complete();
textChannel.sendMessage("`[NeoPerformance] " + message + "`").complete();
}
}
@@ -1,8 +1,8 @@
package com.neomechanical.neoperformance.integrations.discorsrv;
import com.neomechanical.neoconfig.neoutils.NeoUtils;
import net.dv8tion.jda.api.events.guild.GuildUnavailableEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import github.scarsz.discordsrv.dependencies.jda.api.events.guild.GuildUnavailableEvent;
import github.scarsz.discordsrv.dependencies.jda.api.hooks.ListenerAdapter;
import org.jetbrains.annotations.NotNull;
public class JDAListener extends ListenerAdapter {
@@ -4,7 +4,6 @@ import com.neomechanical.neoconfig.neoutils.NeoUtils;
import com.neomechanical.neoconfig.neoutils.ServerMetrics;
import com.neomechanical.neoconfig.neoutils.messages.MessageUtil;
import com.neomechanical.neoconfig.neoutils.server.ServerInfo;
import com.neomechanical.neoperformance.integrations.discorsrv.DiscordSRVHook;
import com.neomechanical.neoperformance.performance.managers.DataManager;
import com.neomechanical.neoperformance.utils.mail.EmailClient;
@@ -30,7 +29,7 @@ public class HaltNotifier {
NeoUtils.getNeoUtilities().getFancyLogger().fancyLog(message, true);
//Send DiscordSRV mesage
new DiscordSRVHook().sendMessage(message);
dataManager.getHookIntegrations().getDiscordSRVHook().sendMessage(getLanguageManager().getString("discord.serverHalted", null));
if (dataManager.getPerformanceConfig().getPerformanceTweakSettings().isBroadcastHalt()) {
MessageUtil.sendMMAll(message);
@@ -50,7 +49,7 @@ public class HaltNotifier {
NeoUtils.getNeoUtilities().getFancyLogger().fancyLog(message, true);
//Send DiscordSRV message
dataManager.getHookIntegrations().getDiscordSRVHook().sendMessage(message);
dataManager.getHookIntegrations().getDiscordSRVHook().sendMessage(getLanguageManager().getString("discord.serverHalted", null));
if (dataManager.getPerformanceConfig().getPerformanceTweakSettings().isBroadcastHalt()) {
MessageUtil.sendMMAll(message);
@@ -13,6 +13,9 @@ email_notifications:
body_halted: "Der Server wurde angehalten, weil der TPS zu niedrig ist.\nDer TPS liegt derzeit bei %TPS% und der TPS-Schwellenwert ist %TPSHALT%."
subject_resumed: 'TPS ist wieder normal und der Server wird wiederhergestellt'
body_resumed: "Der Server wurde wiederhergestellt und verfügt nun über eine TPS von %TPS%"
discord:
serverHalted: ':octagonal_sign: *TPS ist zu niedrig, Server wird angehalten*'
serverResumed: ':white_check_mark: *TPS wieder normal, Wiederherstellung des Servers*'
#Befehle
commandGeneric:
errorPlayerNotFound: '<red><bold>Spieler nicht gefunden'
@@ -13,7 +13,9 @@ email_notifications:
body_halted: "The server has halted because the TPS is too low.\nThe TPS is currently at %TPS% and the TPS threshold is %TPSHALT%."
subject_resumed: 'TPS back to normal, recovering the server'
body_resumed: "The server has been restored and now has a tps of %TPS%"
discord:
serverHalted: ':octagonal_sign: *TPS is too low, halting server*'
serverResumed: ':white_check_mark: *TPS back to normal, recovering the server*'
#commands
commandGeneric:
errorPlayerNotFound: '<red><bold>Player not found'
@@ -13,6 +13,9 @@ email_notifications:
body_halted: "El servidor se detuvo porque los TPS eran demasiado bajos.\nLos TPS están actualmente en %TPS% y el umbral de TPS es %TPSHALT%."
subject_resumed: 'TPS vuelve a la normalidad, recuperando el servidor'
body_resumed: "El servidor ha sido restaurado y ahora tiene un tps de %TPS%"
discord:
serverHalted: ':octagonal_sign: *Los TPS son demasiado bajos, deteniendo la actividad del servidor...*'
serverResumed: ':white_check_mark: *Los TPS han vuelto a la normalidad, reanudando la actividad del servidor...*'
# Comandos
commandGeneric:
errorPlayerNotFound: '<red><bold>Jugador no encontrado'
@@ -13,6 +13,9 @@ email_notifications:
body_halted: "Le serveur s'est arrêté car le TPS est trop bas.\nLe TPS est actuellement à %TPS% et le seuil TPS est %TPSHALT%."
subject_resumed: 'TPS revenu à la normale, récupération du serveur'
body_resumed: "Le serveur a été restauré et a désormais un tps de %TPS%"
discord:
serverHalted: ':octagonal_sign: *TPS est trop bas, arrêt du serveur*'
serverResumed: ':white_check_mark: *TPS retour à la normale, récupération du serveur*'
#commandes
commandGeneric:
errorPlayerNotFound: '<red><bold>Joueur introuvable'
@@ -13,6 +13,9 @@ email_notifications:
body_halted: "O servidor parou porque o TPS está muito baixo.\nO TPS está atualmente em %TPS% e o limite de TPS é %TPSHALT%."
subject_resumed: 'TPS volta ao normal, recuperando o servidor'
body_resumed: "O servidor foi restaurado e agora tem um tps de %TPS%"
discord:
serverHalted: ':octagonal_sign: *TPS está muito baixo, parando o servidor*'
serverResumed: ':white_check_mark: *TPS voltou ao normal, recuperando o servidor*'
#commands
commandGeneric:
errorPlayerNotFound: '<red><bold>Jogador não encontrado'
@@ -13,6 +13,9 @@ email_notifications:
body_halted: "O servidor parou devido ao TPS estar muito baixo.\nO TPS está atualmente a %TPS% e o limite de TPS é %TPSHALT%."
subject_resumed: 'TPS volta ao normal, recuperando o servidor'
body_resumed: "O servidor foi restaurado e agora tem um tps de %TPS%"
discord:
serverHalted: ':octagonal_sign: *TPS está muito baixo, a parar o servidor*'
serverResumed: ':white_check_mark: *TPS voltou ao normal, a recuperar o servidor*'
#comandos
commandGeneric:
errorPlayerNotFound: '<red><bold>Jogador não encontrado'
@@ -13,6 +13,9 @@ email_notifications:
body_halted: 'Активность сервера была отключена в связи с низким ТПС На данный момент показатель тпс равен %TPS% в то время как минимальное значение %TPSHALT%.'
subject_resumed: 'TPS возвращается в нормальное состояние, восстанавливается сервер'
body_resumed: "Сервер восстановлен и теперь имеет tps %TPS%"
discord:
serverHalted: ':octagonal_sign: *ТПС слишком низкий. Выполняется остановка активности*'
serverResumed: ':white_check_mark: *ТПС выглядит нормальным. Активность возобновлена*'
#команды
commandGeneric:
errorPlayerNotFound: '<red><bold>Игрок не найден'
@@ -13,6 +13,9 @@ email_notifications:
body_halted: "TPS çok düşük olduğu için sunucu durdu.\nTPS şu anda %TPS%'de ve TPS eşiği %TPSHALT%."
subject_resumed: 'TPS normale döndü, sunucu kurtarılıyor'
body_resumed: "Sunucu geri yüklendi ve artık %TPS% tps'ye sahip"
discord:
serverHalted: ':octagonal_sign: *TPS çok düşük, sunucu durduruluyor*'
serverResumed: ':white_check_mark: *TPS normale döndü, sunucu kurtarılıyor*'
#komutlar
commandGeneric:
errorPlayerNotFound: '<red><bold>Oyuncu bulunamadı'
@@ -13,6 +13,9 @@ email_notifications:
body_halted: "由于 TPS 太低,服务器已停止。\nTPS 当前为 %TPS%,TPS 阈值为 %TPSHALT%。"
subject_resumed: 'TPS恢复正常,服务器恢复'
body_resumed: "服务器已恢复,现在 tps 为 %TPS%"
discord:
serverHalted: ':octagonal_sign: *TPS 太低,正在停止服务器*'
serverResumed: ':white_check_mark: *TPS 恢复正常,正在恢复服务器*'
#命令
commandGeneric:
errorPlayerNotFound: '<red><bold>玩家未找到'