mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-25 10:38:00 +01:00
New permission: essentials.seen.banreason
With this permission players can see why a user was banned, in /seen.
This commit is contained in:
parent
adffbab678
commit
2da802d4b7
@ -16,6 +16,17 @@ public class Commandseen extends EssentialsCommand
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
seen(server,sender,args,true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
seen(server,user,args,user.isAuthorized("essentials.seen.banreason"));
|
||||
}
|
||||
|
||||
protected void seen (final Server server, final CommandSender sender, final String[] args, final boolean show) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
@ -23,20 +34,20 @@ public class Commandseen extends EssentialsCommand
|
||||
}
|
||||
try
|
||||
{
|
||||
User user = getPlayer(server, args, 0);
|
||||
sender.sendMessage(_("seenOnline", user.getDisplayName(), Util.formatDateDiff(user.getLastLogin())));
|
||||
User player = getPlayer(server, args, 0);
|
||||
sender.sendMessage(_("seenOnline", player.getDisplayName(), Util.formatDateDiff(player.getLastLogin())));
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
User user = ess.getOfflineUser(args[0]);
|
||||
if (user == null)
|
||||
User player = ess.getOfflineUser(args[0]);
|
||||
if (player == null)
|
||||
{
|
||||
throw new Exception(_("playerNotFound"));
|
||||
}
|
||||
sender.sendMessage(_("seenOffline", user.getDisplayName(), Util.formatDateDiff(user.getLastLogout())));
|
||||
if (user.isBanned())
|
||||
sender.sendMessage(_("seenOffline", player.getDisplayName(), Util.formatDateDiff(player.getLastLogout())));
|
||||
if (player.isBanned())
|
||||
{
|
||||
sender.sendMessage(_("whoisBanned", user.getBanReason()));
|
||||
sender.sendMessage(_("whoisBanned", show ? player.getBanReason() : _("true")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user