mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-14 18:44:48 +02:00
Helpop should use broadcast method
Add local echo's to helpop and mute commands.
This commit is contained in:
@@ -5,9 +5,8 @@ import com.earth2me.essentials.Console;
|
|||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.utils.FormatUtil;
|
import com.earth2me.essentials.utils.FormatUtil;
|
||||||
|
import java.util.logging.Level;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
|
|
||||||
public class Commandhelpop extends EssentialsCommand
|
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
|
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
user.setDisplayNick();
|
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
|
@Override
|
||||||
@@ -30,23 +33,15 @@ public class Commandhelpop extends EssentialsCommand
|
|||||||
sendMessage(server, sender, Console.NAME, args);
|
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)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
final String message = tl("helpOp", from, FormatUtil.stripFormat(getFinalArg(args, 0)));
|
final String message = tl("helpOp", from, FormatUtil.stripFormat(getFinalArg(args, 0)));
|
||||||
CommandSender cs = Console.getCommandSender(server);
|
server.getLogger().log(Level.INFO, message);
|
||||||
cs.sendMessage(message);
|
ess.broadcastMessage("essentials.helpop.receive", message);
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
return message;
|
||||||
{
|
|
||||||
final User player = ess.getUser(onlinePlayer);
|
|
||||||
if (!player.isAuthorized("essentials.helpop.receive"))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
player.sendMessage(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ import static com.earth2me.essentials.I18n.tl;
|
|||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.utils.DateUtil;
|
import com.earth2me.essentials.utils.DateUtil;
|
||||||
|
import java.util.logging.Level;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@@ -81,7 +82,9 @@ public class Commandmute extends EssentialsCommand
|
|||||||
sender.sendMessage(tl("mutedPlayer", user.getDisplayName()));
|
sender.sendMessage(tl("mutedPlayer", user.getDisplayName()));
|
||||||
user.sendMessage(tl("playerMuted"));
|
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
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user