Fix /helpop for console use.

This commit is contained in:
KHobbits 2013-05-26 16:23:11 +01:00
parent 3bcd3390fe
commit e4d041b9b0

View File

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