diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index f9bae3311..1efa4ca1b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -28,16 +28,16 @@ public class Commandseen extends EssentialsCommand { @Override protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { - seen(server, sender, commandLabel, args, true, true, true); + seen(server, sender, commandLabel, args, true, true, true, true); } @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - seen(server, user.getSource(), commandLabel, args, user.isAuthorized("essentials.seen.banreason"), user.isAuthorized("essentials.seen.extra"), user.isAuthorized("essentials.seen.ipsearch")); + seen(server, user.getSource(), commandLabel, args, user.isAuthorized("essentials.seen.banreason"), user.isAuthorized("essentials.seen.ip"), user.isAuthorized("essentials.seen.location"), user.isAuthorized("essentials.seen.ipsearch")); } protected void seen(final Server server, final CommandSource sender, final String commandLabel, final String[] args, - final boolean showBan, final boolean extra, final boolean ipLookup) throws Exception { + final boolean showBan, final boolean showIp, final boolean showLocation, final boolean ipLookup) throws Exception { if (args.length < 1) { throw new NotEnoughArgumentsException(); } @@ -80,23 +80,23 @@ public class Commandseen extends EssentialsCommand { if (user == null) { throw new PlayerNotFoundException(); } - showSeenMessage(server, sender, user, showBan, extra); + showSeenMessage(server, sender, user, showBan, showIp, showLocation); } }); } else { - showSeenMessage(server, sender, player, showBan, extra); + showSeenMessage(server, sender, player, showBan, showIp, showLocation); } } - private void showSeenMessage(Server server, CommandSource sender, User player, boolean showBan, boolean extra) throws Exception { + private void showSeenMessage(Server server, CommandSource sender, User player, boolean showBan, boolean showIp, boolean showLocation) throws Exception { if (player.getBase().isOnline() && canInteractWith(sender, player)) { - seenOnline(server, sender, player, showBan, extra); + seenOnline(server, sender, player, showBan, showIp, showLocation); } else { - seenOffline(server, sender, player, showBan, extra); + seenOffline(server, sender, player, showBan, showIp, showLocation); } } - private void seenOnline(final Server server, final CommandSource sender, final User user, final boolean showBan, final boolean extra) throws Exception { + private void seenOnline(final Server server, final CommandSource sender, final User user, final boolean showBan, final boolean showIp, final boolean showLocation) throws Exception { user.setDisplayNick(); sender.sendMessage(tl("seenOnline", user.getDisplayName(), DateUtil.formatDateDiff(user.getLastLogin()))); @@ -123,12 +123,12 @@ public class Commandseen extends EssentialsCommand { if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) { sender.sendMessage(tl("whoisGeoLocation", location)); } - if (extra) { + if (showIp) { sender.sendMessage(tl("whoisIPAddress", user.getBase().getAddress().getAddress().toString())); } } - private void seenOffline(final Server server, final CommandSource sender, User user, final boolean showBan, final boolean extra) throws Exception { + private void seenOffline(final Server server, final CommandSource sender, User user, final boolean showBan, final boolean showIp, final boolean showLocation) throws Exception { user.setDisplayNick(); if (user.getLastLogout() > 0) { sender.sendMessage(tl("seenOffline", user.getName(), DateUtil.formatDateDiff(user.getLastLogout()))); @@ -163,10 +163,12 @@ public class Commandseen extends EssentialsCommand { if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) { sender.sendMessage(tl("whoisGeoLocation", location)); } - if (extra) { + if (showIp) { if (!user.getLastLoginAddress().isEmpty()) { sender.sendMessage(tl("whoisIPAddress", user.getLastLoginAddress())); } + } + if (showLocation) { final Location loc = user.getLogoutLocation(); if (loc != null) { sender.sendMessage(tl("whoisLocation", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index af002af5b..1b25c5ed9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -41,7 +41,9 @@ public class Commandwhois extends EssentialsCommand { if (!ess.getSettings().isEcoDisabled()) { sender.sendMessage(tl("whoisMoney", NumberUtil.displayCurrency(user.getMoney(), ess))); } - sender.sendMessage(tl("whoisIPAddress", user.getBase().getAddress().getAddress().toString())); + if (!sender.isPlayer() || ess.getUser(sender.getPlayer()).isAuthorized("essentials.whois.ip")) { + sender.sendMessage(tl("whoisIPAddress", user.getBase().getAddress().getAddress().toString())); + } final String location = user.getGeoLocation(); if (location != null && (!sender.isPlayer() || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) { sender.sendMessage(tl("whoisGeoLocation", location)); diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 095c9da84..a71f191f2 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -535,3 +535,8 @@ permissions: essentials.gamemode: true essentials.gamemode.others: true essentials.gamemode.all: true + essentials.seen.extra: + default: op + children: + essentials.seen.ip: true + essentials.seen.location: true \ No newline at end of file