summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunfighterJ <joseph.jenniges@gmail.com>2013-04-01 15:49:03 -0500
committerGunfighterJ <joseph.jenniges@gmail.com>2013-04-01 16:00:09 -0500
commite3183e66df6abfe5cc043fbd03c8f5640b1697cc (patch)
treeb6c58a4a1c0888456c69e2f2b8ef35f3474179e7
parentc7f62700d5ba8ea259f4f57d79dfd3fc8bb25ee7 (diff)
downloadEssentials-e3183e66df6abfe5cc043fbd03c8f5640b1697cc.tar
Essentials-e3183e66df6abfe5cc043fbd03c8f5640b1697cc.tar.gz
Essentials-e3183e66df6abfe5cc043fbd03c8f5640b1697cc.tar.lz
Essentials-e3183e66df6abfe5cc043fbd03c8f5640b1697cc.tar.xz
Essentials-e3183e66df6abfe5cc043fbd03c8f5640b1697cc.zip
Show Geolocation in /seen
Refactor argument for clarity
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandseen.java40
1 files changed, 26 insertions, 14 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
index 0b6cd6e46..b6640a0ca 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
@@ -9,6 +9,7 @@ import java.util.List;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
public class Commandseen extends EssentialsCommand
@@ -72,43 +73,54 @@ public class Commandseen extends EssentialsCommand
if (user.isJailed())
{
sender.sendMessage(_("whoisJail", (user.getJailTimeout() > 0
- ? Util.formatDateDiff(user.getJailTimeout())
- : _("true"))));
+ ? Util.formatDateDiff(user.getJailTimeout())
+ : _("true"))));
}
if (user.isMuted())
{
sender.sendMessage(_("whoisMuted", (user.getMuteTimeout() > 0
- ? Util.formatDateDiff(user.getMuteTimeout())
- : _("true"))));
+ ? Util.formatDateDiff(user.getMuteTimeout())
+ : _("true"))));
}
if (extra)
{
sender.sendMessage(_("whoisIPAddress", user.getAddress().getAddress().toString()));
+ final String location = user.getGeoLocation();
+ if (location != null && (!(sender instanceof Player) || ess.getUser(sender).isAuthorized("essentials.geoip.show")))
+ {
+ sender.sendMessage(_("whoisGeoLocation", location));
+ }
+
}
}
- private void seenOffline(final Server server, final CommandSender sender, User player, final boolean showBan, final boolean extra) throws Exception
+ private void seenOffline(final Server server, final CommandSender sender, User user, final boolean showBan, final boolean extra) throws Exception
{
- player.setDisplayNick();
- if (player.getLastLogout() > 0)
+ user.setDisplayNick();
+ if (user.getLastLogout() > 0)
{
- sender.sendMessage(_("seenOffline", player.getName(), Util.formatDateDiff(player.getLastLogout())));
+ sender.sendMessage(_("seenOffline", user.getName(), Util.formatDateDiff(user.getLastLogout())));
}
else
{
- sender.sendMessage(_("userUnknown", player.getName()));
+ sender.sendMessage(_("userUnknown", user.getName()));
}
- if (player.isBanned())
+ if (user.isBanned())
{
- sender.sendMessage(_("whoisBanned", showBan ? player.getBanReason() : _("true")));
+ sender.sendMessage(_("whoisBanned", showBan ? user.getBanReason() : _("true")));
}
if (extra)
{
- if (!player.getLastLoginAddress().isEmpty())
+ if (!user.getLastLoginAddress().isEmpty())
+ {
+ sender.sendMessage(_("whoisIPAddress", user.getLastLoginAddress()));
+ }
+ final String location = user.getGeoLocation();
+ if (location != null && (!(sender instanceof Player) || ess.getUser(sender).isAuthorized("essentials.geoip.show")))
{
- sender.sendMessage(_("whoisIPAddress", player.getLastLoginAddress()));
+ sender.sendMessage(_("whoisGeoLocation", location));
}
- final Location loc = player.getLogoutLocation();
+ final Location loc = user.getLogoutLocation();
if (loc != null)
{
sender.sendMessage(_("whoisLocation", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));