summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-10-16 20:59:39 +0100
committerKHobbits <rob@khobbits.co.uk>2013-10-16 21:05:33 +0100
commitff46b39f2b42abbe4ce8dc39e564f3dc71a2a104 (patch)
treed4438b241ea1b251105a2622aada79542c2f41ce /Essentials/src/com/earth2me/essentials/commands/Commandseen.java
parentd6dfe5da65fdc9bda682615488f5dc9917c394b5 (diff)
downloadEssentials-ff46b39f2b42abbe4ce8dc39e564f3dc71a2a104.tar
Essentials-ff46b39f2b42abbe4ce8dc39e564f3dc71a2a104.tar.gz
Essentials-ff46b39f2b42abbe4ce8dc39e564f3dc71a2a104.tar.lz
Essentials-ff46b39f2b42abbe4ce8dc39e564f3dc71a2a104.tar.xz
Essentials-ff46b39f2b42abbe4ce8dc39e564f3dc71a2a104.zip
Extract CommandSender to CommandSource, this should prevent Ess user object leaks.
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandseen.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandseen.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
index 6393b2e4e..c63671e1f 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.UserMap;
@@ -10,8 +11,6 @@ import java.util.ArrayList;
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
@@ -22,7 +21,7 @@ public class Commandseen extends EssentialsCommand
}
@Override
- protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
+ protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
{
seen(server, sender, args, true, true, true);
}
@@ -30,10 +29,10 @@ public class Commandseen extends EssentialsCommand
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
- seen(server, user.getBase(), args, user.isAuthorized("essentials.seen.banreason"), user.isAuthorized("essentials.seen.extra"), user.isAuthorized("essentials.seen.ipsearch"));
+ seen(server, user.getSource(), args, user.isAuthorized("essentials.seen.banreason"), user.isAuthorized("essentials.seen.extra"), user.isAuthorized("essentials.seen.ipsearch"));
}
- protected void seen(final Server server, final CommandSender sender, final String[] args, final boolean showBan, final boolean extra, final boolean ipLookup) throws Exception
+ protected void seen(final Server server, final CommandSource sender, final String[] args, final boolean showBan, final boolean extra, final boolean ipLookup) throws Exception
{
if (args.length < 1)
{
@@ -67,7 +66,7 @@ public class Commandseen extends EssentialsCommand
}
}
- private void seenOnline(final Server server, final CommandSender 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 extra) throws Exception
{
user.setDisplayNick();
@@ -89,7 +88,7 @@ public class Commandseen extends EssentialsCommand
: _("true"))));
}
final String location = user.getGeoLocation();
- if (location != null && (!(sender instanceof Player) || ess.getUser(sender).isAuthorized("essentials.geoip.show")))
+ if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show")))
{
sender.sendMessage(_("whoisGeoLocation", location));
}
@@ -99,7 +98,7 @@ public class Commandseen extends EssentialsCommand
}
}
- private void seenOffline(final Server server, final CommandSender 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 extra) throws Exception
{
user.setDisplayNick();
if (user.getLastLogout() > 0)
@@ -115,7 +114,7 @@ public class Commandseen extends EssentialsCommand
sender.sendMessage(_("whoisBanned", showBan ? user.getBanReason() : _("true")));
}
final String location = user.getGeoLocation();
- if (location != null && (!(sender instanceof Player) || ess.getUser(sender).isAuthorized("essentials.geoip.show")))
+ if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show")))
{
sender.sendMessage(_("whoisGeoLocation", location));
}
@@ -133,7 +132,7 @@ public class Commandseen extends EssentialsCommand
}
}
- private void seenIP(final Server server, final CommandSender sender, final String ipAddress) throws Exception
+ private void seenIP(final Server server, final CommandSource sender, final String ipAddress) throws Exception
{
final UserMap userMap = ess.getUserMap();