Skip to content

Commit

Permalink
Only create objects where we need them.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcferrin committed Jul 9, 2012
1 parent c567e27 commit a31d509
Showing 1 changed file with 2 additions and 5 deletions.
Expand Up @@ -17,8 +17,6 @@
public class InspectCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player target;
PlayerProfile profile;
String usage = "Proper usage is /inspect <player>"; //TODO: Needs more locale.

if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) {
Expand All @@ -30,8 +28,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
McMMOPlayer mcmmoPlayer = Users.getPlayer(args[0]);

if (mcmmoPlayer != null) {
target = mcmmoPlayer.getPlayer();
profile = mcmmoPlayer.getProfile();
Player target = mcmmoPlayer.getPlayer();

if (sender instanceof Player && !sender.isOp() && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !Permissions.getInstance().inspectDistanceBypass((Player) sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
Expand All @@ -52,7 +49,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
return true;
}

profile = new PlayerProfile(args[0], false); //Temporary Profile
PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile

if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
Expand Down

0 comments on commit a31d509

Please sign in to comment.