mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-24 14:33:51 +00:00
Stripping vanilla colour from /helpop and /mail
Adding support for &k in EssChat Adding support for colour in /msg and /r - New perm: essentials.msg.color
This commit is contained in:
parent
1d5a09a03e
commit
1f2c669eca
6 changed files with 51 additions and 9 deletions
|
@ -4,6 +4,7 @@ import com.earth2me.essentials.Console;
|
|||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.IReplyTo;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -24,9 +25,31 @@ public class Commandr extends EssentialsCommand
|
|||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
final String message = getFinalArg(args, 0);
|
||||
final IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
|
||||
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
||||
String message = getFinalArg(args, 0);
|
||||
IReplyTo replyTo;
|
||||
String senderName;
|
||||
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
User user = ess.getUser(sender);
|
||||
if (user.isAuthorized("essentials.msg.color"))
|
||||
{
|
||||
message = message.replaceAll("&([0-9a-fk])", "§$1");
|
||||
}
|
||||
else
|
||||
{
|
||||
message = Util.stripColor(message);
|
||||
}
|
||||
replyTo = user;
|
||||
senderName = user.getDisplayName();
|
||||
}
|
||||
else
|
||||
{
|
||||
message = message.replaceAll("&([0-9a-fk])", "§$1");
|
||||
replyTo = Console.getConsoleReplyTo();
|
||||
senderName = Console.NAME;
|
||||
}
|
||||
|
||||
final CommandSender target = replyTo.getReplyTo();
|
||||
final String targetName = target instanceof Player ? ((Player)target).getDisplayName() : Console.NAME;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue