From ee4090941e5c5acb576d92aeb78cdbe96f377b7e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 31 Mar 2022 12:49:55 +0200 Subject: [PATCH] Add SilentMute Punishment type --- src/de/steamwar/bungeecore/BungeeCore.java | 1 + .../bungeecore/bot/listeners/IngameChatListener.java | 2 +- src/de/steamwar/bungeecore/commands/MsgCommand.java | 3 +++ src/de/steamwar/bungeecore/commands/RCommand.java | 3 +++ src/de/steamwar/bungeecore/listeners/ChatListener.java | 6 ++++++ src/de/steamwar/bungeecore/sql/Punishment.java | 1 + src/de/steamwar/messages/BungeeCore.properties | 4 ++++ 7 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index a43ead8..e4754ca 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -128,6 +128,7 @@ public class BungeeCore extends Plugin { // Punishment Commands: new PunishmentCommand("ban", Punishment.PunishmentType.Ban); new PunishmentCommand("mute", Punishment.PunishmentType.Mute); + new PunishmentCommand("silentmute", Punishment.PunishmentType.SilentMute); new PunishmentCommand("noschemreceiving", Punishment.PunishmentType.NoSchemReceiving); new PunishmentCommand("noschemsharing", Punishment.PunishmentType.NoSchemSharing); new PunishmentCommand("noschemsubmitting", Punishment.PunishmentType.NoSchemSubmitting); diff --git a/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java b/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java index e7b709d..23f7cec 100644 --- a/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java +++ b/src/de/steamwar/bungeecore/bot/listeners/IngameChatListener.java @@ -51,7 +51,7 @@ public class IngameChatListener extends BasicDiscordListener { event.getMessage().delete().queue(); return; } - if (steamwarUser.isPunished(Punishment.PunishmentType.Mute) || steamwarUser.isPunished(Punishment.PunishmentType.Ban)) { + if (steamwarUser.isPunished(Punishment.PunishmentType.Mute) || steamwarUser.isPunished(Punishment.PunishmentType.SilentMute) || steamwarUser.isPunished(Punishment.PunishmentType.Ban)) { event.getMessage().delete().queue(); return; } diff --git a/src/de/steamwar/bungeecore/commands/MsgCommand.java b/src/de/steamwar/bungeecore/commands/MsgCommand.java index 67f7013..af2e3db 100644 --- a/src/de/steamwar/bungeecore/commands/MsgCommand.java +++ b/src/de/steamwar/bungeecore/commands/MsgCommand.java @@ -49,6 +49,9 @@ public class MsgCommand extends BasicCommand { } SteamwarUser user = SteamwarUser.get(player); + if (user.isPunished(Punishment.PunishmentType.SilentMute)) { + return; + } if (user.isPunishedWithMessage(player, Punishment.PunishmentType.Mute)) { return; } diff --git a/src/de/steamwar/bungeecore/commands/RCommand.java b/src/de/steamwar/bungeecore/commands/RCommand.java index c9d70dd..d65e181 100644 --- a/src/de/steamwar/bungeecore/commands/RCommand.java +++ b/src/de/steamwar/bungeecore/commands/RCommand.java @@ -45,6 +45,9 @@ public class RCommand extends BasicCommand { } SteamwarUser user = SteamwarUser.get(player); + if (user.isPunished(Punishment.PunishmentType.SilentMute)) { + return; + } if (user.isPunishedWithMessage(player, Punishment.PunishmentType.Mute)) { return; } diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 54b9bb4..cfa8813 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -151,6 +151,9 @@ public class ChatListener extends BasicListener { } SteamwarUser user = SteamwarUser.get(sender); + if (user.isPunished(Punishment.PunishmentType.SilentMute)) { + return; + } if (user.isPunishedWithMessage(sender, Punishment.PunishmentType.Mute)) { e.setCancelled(true); return; @@ -235,6 +238,9 @@ public class ChatListener extends BasicListener { } SteamwarUser user = SteamwarUser.get(sender); + if (user.isPunished(Punishment.PunishmentType.SilentMute)) { + return; + } if (user.isPunishedWithMessage(sender, Punishment.PunishmentType.Mute)) { e.setCancelled(true); return; diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index c2344a6..a91be6c 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -131,6 +131,7 @@ public class Punishment { public enum PunishmentType { Ban(false, "BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN"), Mute( false, "MUTE_TEAM", "MUTE_PERMA", "MUTE_UNTIL", "UNMUTE_ERROR", "UNMUTE"), + SilentMute( false, "SILENTMUTE_TEAM", "", "", "UNSILENTMUTE_ERROR", "UNSILENTMUTE"), NoSchemReceiving(false, "NOSCHEMRECEIVING_TEAM", "NOSCHEMRECEIVING_PERMA", "NOSCHEMRECEIVING_UNTIL", "UNNOSCHEMRECEIVING_ERROR", "UNNOSCHEMRECEIVING"), NoSchemSharing(false, "NOSCHEMSHARING_TEAM", "NOSCHEMSHARING_PERMA", "NOSCHEMSHARING_UNTIL", "UNNOSCHEMSHARING_ERROR", "UNNOSCHEMSHARING"), NoSchemSubmitting(true, "NOSCHEMSUBMITTING_TEAM", "NOSCHEMSUBMITTING_PERMA", "NOSCHEMSUBMITTING_UNTIL", "UNNOSCHEMSUBMITTING_ERROR", "UNNOSCHEMSUBMITTING"), diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 6321e59..2866201 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -130,6 +130,10 @@ MUTE_UNTIL=§7Du bist §ebis zum {0} §e§lgemuted§8. §7Grund§8: §e{1} UNMUTE_ERROR=§cDer Spieler ist nicht gemuted. UNMUTE=§7Du hast §e{0} §e§lentmuted. +SILENTMUTE_TEAM={0} §e{1} §7wurde von §e{2} {3} §e§lgemuted§8. §7Grund§8: §f{4} +UNSILENTMUTE_ERROR=§cDer Spieler ist nicht gemuted. +UNSILENTMUTE=§7Du hast §e{0} §e§lentmuted. + NOSCHEMRECEIVING_TEAM={0} §e{1} §7wurde von §e{2} {3} §7vom §e§lSchematicerhalten ausgeschlossen§8. §7Grund§8: §f{4} NOSCHEMRECEIVING_PERMA=§7Du bist §epermanent §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{0} NOSCHEMRECEIVING_UNTIL=§7Du bist §ebis zum {0} §7vom Erhalten von §e§lSchematics ausgeschlossen§8. §7Grund§8: §e{1}