summaryrefslogtreecommitdiffstats
path: root/Essentials/src/net/ess3/commands/Commandgetpos.java
diff options
context:
space:
mode:
authorgravypod <gravypod@gravypod.com>2012-12-30 20:29:37 -0500
committergravypod <gravypod@gravypod.com>2012-12-30 20:29:37 -0500
commita6b83ca260386fbafb24473aca5f95dc2d5c284b (patch)
tree8a1f37e91c468acefe4c77ccd9ce71365c4fb50a /Essentials/src/net/ess3/commands/Commandgetpos.java
parent67a6971e5b39785f581c790fcf91bff9945a52cd (diff)
downloadEssentials-a6b83ca260386fbafb24473aca5f95dc2d5c284b.tar
Essentials-a6b83ca260386fbafb24473aca5f95dc2d5c284b.tar.gz
Essentials-a6b83ca260386fbafb24473aca5f95dc2d5c284b.tar.lz
Essentials-a6b83ca260386fbafb24473aca5f95dc2d5c284b.tar.xz
Essentials-a6b83ca260386fbafb24473aca5f95dc2d5c284b.zip
Updates, fixes, speedups and more
Diffstat (limited to 'Essentials/src/net/ess3/commands/Commandgetpos.java')
-rw-r--r--Essentials/src/net/ess3/commands/Commandgetpos.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/Essentials/src/net/ess3/commands/Commandgetpos.java b/Essentials/src/net/ess3/commands/Commandgetpos.java
index 8bbd28b52..439655776 100644
--- a/Essentials/src/net/ess3/commands/Commandgetpos.java
+++ b/Essentials/src/net/ess3/commands/Commandgetpos.java
@@ -3,7 +3,10 @@ package net.ess3.commands;
import net.ess3.api.IUser;
import net.ess3.permissions.Permissions;
import org.bukkit.Location;
+import org.bukkit.World;
import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
import static net.ess3.I18n._;
@@ -13,18 +16,20 @@ public class Commandgetpos extends EssentialsCommand
@Override
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
+ final Player mainPlayer = user.getPlayer();
+ final Location mainPlayerLoc = mainPlayer.getLocation();
if (args.length > 0 && Permissions.GETPOS_OTHERS.isAuthorized(user))
{
//todo permissions
final IUser otherUser = ess.getUserMap().matchUser(args[0], false);
- if (user.getPlayer().canSee(otherUser.getPlayer()) || Permissions.LIST_HIDDEN.isAuthorized(user))
+ if (mainPlayer.canSee(otherUser.getPlayer()) || Permissions.LIST_HIDDEN.isAuthorized(user))
{
- outputPosition(user, otherUser.getPlayer().getLocation(), user.getPlayer().getLocation());
+ outputPosition(user, otherUser.getPlayer().getLocation(), mainPlayerLoc);
return;
}
}
- outputPosition(user, user.getPlayer().getLocation(), null);
+ outputPosition(user, mainPlayerLoc, null);
}
@Override
@@ -40,13 +45,14 @@ public class Commandgetpos extends EssentialsCommand
private void outputPosition(final CommandSender sender, final Location coords, final Location distance)
{
- sender.sendMessage(_("getposWorld", coords.getWorld().getName()));
+ final World world = coords.getWorld();
+ sender.sendMessage(_("getposWorld", world.getName()));
sender.sendMessage(_("getposX", coords.getBlockX()));
sender.sendMessage(_("getposY", coords.getBlockY()));
sender.sendMessage(_("getposZ", coords.getBlockZ()));
sender.sendMessage(_("getposYaw", (coords.getYaw() + 540) % 360));
sender.sendMessage(_("getposPitch", coords.getPitch()));
- if (distance != null && coords.getWorld().equals(distance.getWorld()))
+ if (distance != null && world.equals(distance.getWorld()))
{
sender.sendMessage(_("getposDistance", coords.distance(distance)));
}