This commit is contained in:
drtshock 2015-04-14 23:06:16 -05:00
parent ad13062117
commit dde0b20775
380 changed files with 38917 additions and 46821 deletions

View file

@ -2,76 +2,63 @@ package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import com.earth2me.essentials.Console;
import static com.earth2me.essentials.I18n.tl;
import com.earth2me.essentials.IReplyTo;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.FormatUtil;
import org.bukkit.Server;
import static com.earth2me.essentials.I18n.tl;
public class Commandr extends EssentialsCommand
{
public Commandr()
{
super("r");
}
@Override
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
public class Commandr extends EssentialsCommand {
public Commandr() {
super("r");
}
String message = getFinalArg(args, 0);
IReplyTo replyTo;
String senderName;
@Override
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
if (args.length < 1) {
throw new NotEnoughArgumentsException();
}
if (sender.isPlayer())
{
User user = ess.getUser(sender.getPlayer());
message = FormatUtil.formatMessage(user, "essentials.msg", message);
replyTo = user;
senderName = user.getDisplayName();
}
else
{
message = FormatUtil.replaceFormat(message);
replyTo = Console.getConsoleReplyTo();
senderName = Console.NAME;
}
String message = getFinalArg(args, 0);
IReplyTo replyTo;
String senderName;
final CommandSource target = replyTo.getReplyTo();
if (sender.isPlayer()) {
User user = ess.getUser(sender.getPlayer());
message = FormatUtil.formatMessage(user, "essentials.msg", message);
replyTo = user;
senderName = user.getDisplayName();
} else {
message = FormatUtil.replaceFormat(message);
replyTo = Console.getConsoleReplyTo();
senderName = Console.NAME;
}
if (target == null || (target.isPlayer() && !target.getPlayer().isOnline()))
{
throw new Exception(tl("foreverAlone"));
}
final CommandSource target = replyTo.getReplyTo();
final String targetName = target.isPlayer() ? target.getPlayer().getDisplayName() : Console.NAME;
if (target == null || (target.isPlayer() && !target.getPlayer().isOnline())) {
throw new Exception(tl("foreverAlone"));
}
sender.sendMessage(tl("msgFormat", tl("me"), targetName, message));
if (target.isPlayer())
{
User player = ess.getUser(target.getPlayer());
if (sender.isPlayer() && player.isIgnoredPlayer(ess.getUser(sender.getPlayer())))
{
return;
}
}
target.sendMessage(tl("msgFormat", senderName, tl("me"), message));
replyTo.setReplyTo(target);
if (target != sender)
{
if (target.isPlayer())
{
ess.getUser(target.getPlayer()).setReplyTo(sender);
}
else
{
Console.getConsoleReplyTo().setReplyTo(sender);
}
}
}
final String targetName = target.isPlayer() ? target.getPlayer().getDisplayName() : Console.NAME;
sender.sendMessage(tl("msgFormat", tl("me"), targetName, message));
if (target.isPlayer()) {
User player = ess.getUser(target.getPlayer());
if (sender.isPlayer() && player.isIgnoredPlayer(ess.getUser(sender.getPlayer()))) {
return;
}
}
target.sendMessage(tl("msgFormat", senderName, tl("me"), message));
replyTo.setReplyTo(target);
if (target != sender) {
if (target.isPlayer()) {
ess.getUser(target.getPlayer()).setReplyTo(sender);
} else {
Console.getConsoleReplyTo().setReplyTo(sender);
}
}
}
}