From cb1c67e568262f6807287844ac889476b99bf282 Mon Sep 17 00:00:00 2001 From: speedxx <43330808+speedxx@users.noreply.github.com> Date: Fri, 17 Jul 2020 19:54:46 -0400 Subject: [PATCH] mute & unmute improvements - fix muted player messages being sent to discord - fix mute sending 2 messages - tell sender target has been unmuted --- .../totalfreedommod/ChatManager.java | 3 +-- .../totalfreedommod/command/Command_mute.java | 4 +--- .../command/Command_unmute.java | 21 ++++++++----------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java index 1fe5ec19..82aee7e6 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java @@ -1,7 +1,6 @@ package me.totalfreedom.totalfreedommod; import com.google.common.base.Strings; -import java.util.Date; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; @@ -138,7 +137,7 @@ public class ChatManager extends FreedomService event.setFormat(format); // Send to discord - if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist()) + if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted()) { plugin.dc.messageChatChannel(plugin.dc.deformat(player.getName()) + " \u00BB " + ChatColor.stripColor(message)); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java index 6a79f1ae..538ff60e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java @@ -142,8 +142,6 @@ public class Command_mute extends FreedomCommand FUtil.adminAction(sender.getName(), "Muting " + player.getName(), true); - msg(player, "You have been muted by " + ChatColor.YELLOW + sender.getName(), ChatColor.RED); - if (smite) { Command_smite.smite(sender, player, reason); @@ -180,4 +178,4 @@ public class Command_mute extends FreedomCommand return Collections.emptyList(); } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unmute.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unmute.java index ec329f91..a59ef189 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unmute.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unmute.java @@ -42,28 +42,25 @@ public class Command_unmute extends FreedomCommand } FPlayer playerdata = plugin.pl.getPlayer(player); - if (plugin.al.isAdmin(player)) - { - msg(player.getName() + " is an admin, and can't be muted."); - return true; - } - if (playerdata.isMuted()) { playerdata.setMuted(false); - msg(player, "You have been unmuted.", ChatColor.RED); player.sendTitle(ChatColor.RED + "You've been unmuted.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60); - if (!quiet) + + if (quiet) { - FUtil.adminAction(sender.getName(), "Unmuting " + player.getName(), true); + msg("Unmuted " + player.getName() + " quietly"); + return true; } - return true; + + FUtil.adminAction(sender.getName(), "Unmuting " + player.getName(), true); + msg("Unmuted " + player.getName()); + msg(player, "You have been unmuted.", ChatColor.RED); } else { msg(ChatColor.RED + "That player is not muted."); } - return true; } -} +} \ No newline at end of file