Adds essentials.mute.notify

This commit is contained in:
GunfighterJ 2013-01-17 17:36:27 -06:00
parent 0014d5cfcb
commit 78e6da9504
14 changed files with 41 additions and 14 deletions

View File

@ -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"));
}
}
}
}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}