summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2014-03-26 20:06:01 +0000
committerKHobbits <rob@khobbits.co.uk>2014-03-26 20:06:01 +0000
commitae1804758ade0085727de47e87165b1dc3815e3a (patch)
treed034f212169dc3fbb00994b64e60400af0e410e7
parent4b470b32c5a7ff217552abecfd19e2e836b92d0d (diff)
downloadEssentials-ae1804758ade0085727de47e87165b1dc3815e3a.tar
Essentials-ae1804758ade0085727de47e87165b1dc3815e3a.tar.gz
Essentials-ae1804758ade0085727de47e87165b1dc3815e3a.tar.lz
Essentials-ae1804758ade0085727de47e87165b1dc3815e3a.tar.xz
Essentials-ae1804758ade0085727de47e87165b1dc3815e3a.zip
Helpop should use broadcast method
Add local echo's to helpop and mute commands.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java25
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmute.java5
2 files changed, 14 insertions, 16 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java
index 945f7c688..b83b5b695 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java
@@ -5,9 +5,8 @@ import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n.tl;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil;
+import java.util.logging.Level;
import org.bukkit.Server;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
public class Commandhelpop extends EssentialsCommand
@@ -21,7 +20,11 @@ public class Commandhelpop extends EssentialsCommand
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
user.setDisplayNick();
- sendMessage(server, user.getSource(), user.getDisplayName(), args);
+ final String message = sendMessage(server, user.getSource(), user.getDisplayName(), args);
+ if (!user.isAuthorized("essentials.helpop.receive"))
+ {
+ user.sendMessage(message);
+ }
}
@Override
@@ -30,23 +33,15 @@ public class Commandhelpop extends EssentialsCommand
sendMessage(server, sender, Console.NAME, args);
}
- private void sendMessage(final Server server, final CommandSource sender, final String from, final String[] args) throws Exception
+ private String sendMessage(final Server server, final CommandSource sender, final String from, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
final String message = tl("helpOp", from, FormatUtil.stripFormat(getFinalArg(args, 0)));
- CommandSender cs = Console.getCommandSender(server);
- cs.sendMessage(message);
- for (Player onlinePlayer : server.getOnlinePlayers())
- {
- final User player = ess.getUser(onlinePlayer);
- if (!player.isAuthorized("essentials.helpop.receive"))
- {
- continue;
- }
- player.sendMessage(message);
- }
+ server.getLogger().log(Level.INFO, message);
+ ess.broadcastMessage("essentials.helpop.receive", message);
+ return message;
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java
index e27c97ead..a2ee68556 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java
@@ -5,6 +5,7 @@ import static com.earth2me.essentials.I18n.tl;
import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.DateUtil;
+import java.util.logging.Level;
import org.bukkit.Server;
@@ -81,7 +82,9 @@ public class Commandmute extends EssentialsCommand
sender.sendMessage(tl("mutedPlayer", user.getDisplayName()));
user.sendMessage(tl("playerMuted"));
}
- ess.broadcastMessage("essentials.mute.notify", tl("muteNotify", sender.getSender().getName(), user.getName(), muteTime));
+ final String message = tl("muteNotify", sender.getSender().getName(), user.getName(), muteTime);
+ server.getLogger().log(Level.INFO, message);
+ ess.broadcastMessage("essentials.mute.notify", message);
}
else
{