From b42b5eadc9cc4495a1699c9982b4bd6b48e6e055 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Sun, 1 Dec 2013 17:33:44 +1100 Subject: [PATCH] Add optional 2nd arg to broadcast format. 50dca9abf54d5a2 --- .../net/ess3/commands/Commandbroadcast.java | 18 ++++++++++++++++-- Essentials/src/plugin.yml | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Essentials/src/net/ess3/commands/Commandbroadcast.java b/Essentials/src/net/ess3/commands/Commandbroadcast.java index 52854ce87..4519eef86 100644 --- a/Essentials/src/net/ess3/commands/Commandbroadcast.java +++ b/Essentials/src/net/ess3/commands/Commandbroadcast.java @@ -1,12 +1,26 @@ package net.ess3.commands; -import static net.ess3.I18n._; +import net.ess3.api.IUser; import net.ess3.utils.FormatUtil; +import org.bukkit.command.Command; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import static net.ess3.I18n._; public class Commandbroadcast extends EssentialsCommand { + @Override + public void run(final IUser user, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + ess.broadcastMessage(null, _("§r§6[§4Broadcast§6]§a {0}", FormatUtil.replaceFormat(getFinalArg(args, 0)), user.getPlayer().getDisplayName())); + } + @Override public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { @@ -14,6 +28,6 @@ public class Commandbroadcast extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - ess.broadcastMessage(null, _("§r§6[§4Broadcast§6]§a {0}", FormatUtil.replaceFormat(getFinalArg(args, 0)))); + ess.broadcastMessage(null, _("§r§6[§4Broadcast§6]§a {0}", FormatUtil.replaceFormat(getFinalArg(args, 0)), sender.getName())); } } diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index a35fe7db2..fc62ac9cd 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -50,7 +50,7 @@ commands: broadcast: description: Broadcasts a message to the entire server. usage: / - aliases: [ebroadcast,bcast,ebcast] + aliases: [ebroadcast,bcast,ebcast,shout,eshout,bc,ebc] bigtree: description: Spawn a big tree where you are looking. usage: /