From 78e6da95043c05e073045e626f217b34947a63e7 Mon Sep 17 00:00:00 2001 From: GunfighterJ Date: Thu, 17 Jan 2013 17:36:27 -0600 Subject: [PATCH] Adds essentials.mute.notify --- .../essentials/commands/Commandmute.java | 41 +++++++++++++------ Essentials/src/messages.properties | 1 + Essentials/src/messages_cs.properties | 2 +- Essentials/src/messages_da.properties | 1 + Essentials/src/messages_de.properties | 1 + Essentials/src/messages_en.properties | 1 + Essentials/src/messages_es.properties | 1 + Essentials/src/messages_fi.properties | 1 + Essentials/src/messages_fr.properties | 1 + Essentials/src/messages_it.properties | 1 + Essentials/src/messages_nl.properties | 1 + Essentials/src/messages_pl.properties | 1 + Essentials/src/messages_pt.properties | 1 + Essentials/src/messages_se.properties | 1 + 14 files changed, 41 insertions(+), 14 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java index fa86a8a02..f9e051c91 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import org.bukkit.Server; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; public class Commandmute extends EssentialsCommand @@ -41,17 +42,31 @@ public class Commandmute extends EssentialsCommand } player.setMuteTimeout(muteTimestamp); final boolean muted = player.getMuted(); - sender.sendMessage( - muted - ? (muteTimestamp > 0 - ? _("mutedPlayerFor", player.getDisplayName(), Util.formatDateDiff(muteTimestamp)) - : _("mutedPlayer", player.getDisplayName())) - : _("unmutedPlayer", player.getDisplayName())); - player.sendMessage( - muted - ? (muteTimestamp > 0 - ? _("playerMutedFor", Util.formatDateDiff(muteTimestamp)) - : _("playerMuted")) - : _("playerUnmuted")); + if (muted) + { + if (muteTimestamp > 0) + { + sender.sendMessage(_("mutedPlayerFor", player.getDisplayName(), Util.formatDateDiff(muteTimestamp))); + player.sendMessage(_("playerMutedFor", Util.formatDateDiff(muteTimestamp))); + } + else + { + sender.sendMessage(_("mutedPlayer", player.getDisplayName())); + player.sendMessage(_("playerMuted")); + } + for (Player onlinePlayer : server.getOnlinePlayers()) + { + final User user = ess.getUser(onlinePlayer); + if (onlinePlayer != sender && user.isAuthorized("essentials.mute.notify")) + { + onlinePlayer.sendMessage(_("muteNotify", sender.getName(), player.getName())); + } + } + } + else + { + sender.sendMessage(_("unmutedPlayer", player.getDisplayName())); + player.sendMessage(_("playerUnmuted")); + } } -} +} \ No newline at end of file diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index ceca9beb4..c35e225f6 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index 5178598e8..a6c98d3bf 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -492,4 +492,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} - +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 106bea42a..c9d4870a9 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 6f02ec613..a113e164a 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index ceca9beb4..c35e225f6 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 25ae737ed..2349c824e 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index 6a18d49a1..4f1e3b785 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 40deed6bd..8e0a9a9be 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index addc32c3e..cc7fcf49b 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index de37ddd68..360d76db1 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index de9388897..a43b5f81f 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 028ea280f..d4e935d08 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index d47289567..3083a5b60 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -489,3 +489,4 @@ holdBook=\u00a74You are not holding a writable book fireworkColor=\u00a74You must apply a color to the firework to add an effect holdFirework=\u00a74You must be holding a firework to add effects invalidFireworkFormat=\u00a76The option \u00a74{0} \u00a76is not a valid value for \u00a74{1} +muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}