From e4d041b9b03e36984ed108913bb2749ea7f5c4fd Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 26 May 2013 16:23:11 +0100 Subject: [PATCH] Fix /helpop for console use. --- .../essentials/commands/Commandhelpop.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java index 948cfa769..3a00c86e3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java @@ -1,10 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; -import java.util.logging.Level; import org.bukkit.Server; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -17,14 +18,26 @@ public class Commandhelpop extends EssentialsCommand @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + user.setDisplayNick(); + sendMessage(server, user, user.getDisplayName(), args); + } + + @Override + public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + sendMessage(server, sender, Console.NAME, args); + } + + private void sendMessage(final Server server, final CommandSender sender, final String from, final String[] args) throws Exception { if (args.length < 1) { throw new NotEnoughArgumentsException(); } - user.setDisplayNick(); - final String message = _("helpOp", user.getDisplayName(), Util.stripFormat(getFinalArg(args, 0))); - logger.log(Level.INFO, message); + final String message = _("helpOp", from, Util.stripFormat(getFinalArg(args, 0))); + CommandSender cs = Console.getCommandSender(server); + cs.sendMessage(message); for (Player onlinePlayer : server.getOnlinePlayers()) { final User player = ess.getUser(onlinePlayer);