Add optional 2nd arg to broadcast format.

This commit is contained in:
KHobbits 2013-01-20 20:54:44 +00:00
parent f1e3d48248
commit 50dca9abf5
2 changed files with 14 additions and 2 deletions

View file

@ -1,6 +1,7 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@ -13,6 +14,17 @@ public class Commandbroadcast extends EssentialsCommand
super("broadcast");
}
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
ess.broadcastMessage(null, _("broadcast", Util.replaceFormat(getFinalArg(args, 0)), user.getDisplayName()));
}
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
@ -21,6 +33,6 @@ public class Commandbroadcast extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
ess.broadcastMessage(null, _("broadcast", Util.replaceFormat(getFinalArg(args, 0))));
ess.broadcastMessage(null, _("broadcast", Util.replaceFormat(getFinalArg(args, 0)), sender.getName()));
}
}

View file

@ -50,7 +50,7 @@ commands:
broadcast:
description: Broadcasts a message to the entire server.
usage: /<command> <msg>
aliases: [ebroadcast,bcast,ebcast]
aliases: [ebroadcast,shout,eshout,bc,ebc,bcast,ebcast]
bigtree:
description: Spawn a big tree where you are looking.
usage: /<command> <tree|redwood|jungle>