diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java index c6ba0c484..e879399fe 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java @@ -20,10 +20,10 @@ public class Commandgetpos extends EssentialsCommand { public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length > 0 && user.isAuthorized("essentials.getpos.others")) { final User otherUser = getPlayer(server, user, args, 0); - outputPosition(user.getSource(), otherUser.getLocation(), user.getLocation()); + outputPosition(user.getSource(), user, otherUser.getLocation(), user.getLocation()); return; } - outputPosition(user.getSource(), user.getLocation(), null); + outputPosition(user.getSource(), user, user.getLocation(), null); } @Override @@ -32,18 +32,20 @@ public class Commandgetpos extends EssentialsCommand { throw new NotEnoughArgumentsException(); } final User user = getPlayer(server, args, 0, true, false); - outputPosition(sender, user.getLocation(), null); + outputPosition(sender, user, user.getLocation(), null); } - private void outputPosition(final CommandSource sender, final Location coords, final Location distance) { + private void outputPosition(final CommandSource sender, final User user, final Location coords, final Location distance) { sender.sendMessage(tl("currentWorld", coords.getWorld().getName())); - sender.sendMessage(tl("posX", coords.getBlockX())); - sender.sendMessage(tl("posY", coords.getBlockY())); - sender.sendMessage(tl("posZ", coords.getBlockZ())); - sender.sendMessage(tl("posYaw", (coords.getYaw() + 360) % 360)); - sender.sendMessage(tl("posPitch", coords.getPitch())); - if (distance != null && coords.getWorld().equals(distance.getWorld())) { - sender.sendMessage(tl("distance", coords.distance(distance))); + if (!sender.isPlayer()|| getTFMHandler().isAdmin(sender.getPlayer()) || user.getSource() == sender) { + sender.sendMessage(tl("posX", coords.getBlockX())); + sender.sendMessage(tl("posY", coords.getBlockY())); + sender.sendMessage(tl("posZ", coords.getBlockZ())); + sender.sendMessage(tl("posYaw", (coords.getYaw() + 360) % 360)); + sender.sendMessage(tl("posPitch", coords.getPitch())); + if (distance != null && coords.getWorld().equals(distance.getWorld())) { + sender.sendMessage(tl("distance", coords.distance(distance))); + } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index b1eb4c661..bdbd94458 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; +import com.earth2me.essentials.TFMHandler; import com.earth2me.essentials.User; import com.earth2me.essentials.craftbukkit.SetExpFix; import com.earth2me.essentials.utils.DateUtil; @@ -8,6 +9,7 @@ import com.earth2me.essentials.utils.EnumUtil; import com.earth2me.essentials.utils.NumberUtil; import org.bukkit.Server; import org.bukkit.Statistic; +import org.bukkit.command.ConsoleCommandSender; import java.util.Locale; import java.util.Collections; @@ -40,7 +42,9 @@ public class Commandwhois extends EssentialsCommand { sender.sendMessage(tl("whoisHealth", user.getBase().getHealth())); sender.sendMessage(tl("whoisHunger", user.getBase().getFoodLevel(), user.getBase().getSaturation())); sender.sendMessage(tl("whoisExp", SetExpFix.getTotalExperience(user.getBase()), user.getBase().getLevel())); - sender.sendMessage(tl("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ())); + if (!sender.isPlayer() || getTFMHandler().isAdmin(sender.getPlayer())) { + sender.sendMessage(tl("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ())); + } long playtimeMs = System.currentTimeMillis() - (user.getBase().getStatistic(PLAY_ONE_TICK) * 50); sender.sendMessage(tl("whoisPlaytime", DateUtil.formatDateDiff(playtimeMs))); if (!ess.getSettings().isEcoDisabled()) {