and all the commits after

pull/6/head
Super_ 3 years ago
parent 380aaab76c
commit 220ddf1c1e

@ -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)));
}
}
}

@ -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.
}

@ -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;

@ -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);
}
}
}

@ -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();

Loading…
Cancel
Save