summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIaccidentally <coryhuckaby@gmail.com>2013-04-01 14:20:42 -0700
committerIaccidentally <coryhuckaby@gmail.com>2013-04-01 14:20:42 -0700
commit93b76446f549ccbd03ce559fca3a191f61e8fc4f (patch)
treee3ea8cc68f94f8f456c6067c24ca830fc0991e5d
parent9d1f25c45530d142fe61d6ea4147fa6ed4a80206 (diff)
parente3183e66df6abfe5cc043fbd03c8f5640b1697cc (diff)
downloadEssentials-93b76446f549ccbd03ce559fca3a191f61e8fc4f.tar
Essentials-93b76446f549ccbd03ce559fca3a191f61e8fc4f.tar.gz
Essentials-93b76446f549ccbd03ce559fca3a191f61e8fc4f.tar.lz
Essentials-93b76446f549ccbd03ce559fca3a191f61e8fc4f.tar.xz
Essentials-93b76446f549ccbd03ce559fca3a191f61e8fc4f.zip
Merge pull request #431 from GunfighterJ/2.9
Show Geolocation in /seen
-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()));