diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java index c6ba0c484..6d9ca4ea1 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,19 @@ 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) { - 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))); + private void outputPosition(final CommandSource sender, final User user, final Location coords, final Location 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/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index 83c17c076..84caa5f9d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -8,6 +8,7 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.messaging.IMessageRecipient; import com.earth2me.essentials.utils.FormatUtil; +import org.bukkit.ChatColor; import org.bukkit.Server; import java.util.List; @@ -51,6 +52,11 @@ public class Commandmsg extends EssentialsLoopCommand { @Override protected void updatePlayer(final Server server, final CommandSource sender, final User messageReceiver, final String[] args) { IMessageRecipient messageSender = sender.isPlayer() ? ess.getUser(sender.getPlayer()) : Console.getInstance(); + if (getTFMHandler().isVanished(messageReceiver) && !getTFMHandler().isAdmin(sender.getSender())) + { + messageSender.sendMessage(ChatColor.RED + "Error: " + ChatColor.RED + "Player not found."); + return; + } messageSender.sendMessage(messageReceiver, args[0]); // args[0] is the message. } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java index 45b297898..4568f42b2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnear.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnear.java @@ -89,6 +89,9 @@ public class Commandnear extends EssentialsCommand { for (User player : ess.getOnlineUsers()) { if (!player.equals(user) && !player.isAuthorized("essentials.near.exclude") && (!player.isHidden(user.getBase()) || showHidden || user.getBase().canSee(player.getBase()))) { + if (getTFMHandler().isVanished(player) && !getTFMHandler().isAdmin(user)) { + continue; + } final Location playerLoc = player.getLocation(); if (playerLoc.getWorld() != world) { continue; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandshowkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandshowkit.java index b280b02df..87510ff41 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandshowkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandshowkit.java @@ -28,7 +28,11 @@ public class Commandshowkit extends EssentialsCommand { Kit kit = new Kit(kitName, ess); user.sendMessage(tl("kitContains", kitName)); for (String s : kit.getItems()) { - user.sendMessage(tl("kitItem", s)); + String item = tl("kitItem", s); + if (item.length() >= 50) { + item = item.substring(0, 50); + } + user.sendMessage(item); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index 2cc62b305..c250e050c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -40,13 +40,15 @@ 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()) { sender.sendMessage(tl("whoisMoney", NumberUtil.displayCurrency(user.getMoney(), ess))); } - if (!sender.isPlayer() || getTFMHandler().isAdmin(user)) { + if (!sender.isPlayer() || getTFMHandler().isAdmin(sender.getPlayer())) { sender.sendMessage(tl("whoisIPAddress", user.getBase().getAddress().getAddress().toString())); } final String location = user.getGeoLocation(); diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..e69de29bb