mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
Only create objects where we need them.
This commit is contained in:
parent
c567e2714a
commit
a31d50924d
@ -17,8 +17,6 @@ import com.gmail.nossr50.util.Users;
|
|||||||
public class InspectCommand implements CommandExecutor {
|
public class InspectCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
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.
|
String usage = "Proper usage is /inspect <player>"; //TODO: Needs more locale.
|
||||||
|
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.inspect")) {
|
||||||
@ -30,8 +28,7 @@ public class InspectCommand implements CommandExecutor {
|
|||||||
McMMOPlayer mcmmoPlayer = Users.getPlayer(args[0]);
|
McMMOPlayer mcmmoPlayer = Users.getPlayer(args[0]);
|
||||||
|
|
||||||
if (mcmmoPlayer != null) {
|
if (mcmmoPlayer != null) {
|
||||||
target = mcmmoPlayer.getPlayer();
|
Player target = mcmmoPlayer.getPlayer();
|
||||||
profile = mcmmoPlayer.getProfile();
|
|
||||||
|
|
||||||
if (sender instanceof Player && !sender.isOp() && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !Permissions.getInstance().inspectDistanceBypass((Player) sender)) {
|
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"));
|
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
|
||||||
@ -52,7 +49,7 @@ public class InspectCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
profile = new PlayerProfile(args[0], false); //Temporary Profile
|
PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile
|
||||||
|
|
||||||
if (!profile.isLoaded()) {
|
if (!profile.isLoaded()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||||
|
Loading…
Reference in New Issue
Block a user