mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 11:49:12 +00:00
/getpos and /whois changes
This commit is contained in:
parent
e7881f72a8
commit
c705a7be88
2 changed files with 18 additions and 12 deletions
|
@ -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 {
|
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")) {
|
if (args.length > 0 && user.isAuthorized("essentials.getpos.others")) {
|
||||||
final User otherUser = getPlayer(server, user, args, 0);
|
final User otherUser = getPlayer(server, user, args, 0);
|
||||||
outputPosition(user.getSource(), otherUser.getLocation(), user.getLocation());
|
outputPosition(user.getSource(), user, otherUser.getLocation(), user.getLocation());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
outputPosition(user.getSource(), user.getLocation(), null);
|
outputPosition(user.getSource(), user, user.getLocation(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,18 +32,20 @@ public class Commandgetpos extends EssentialsCommand {
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
final User user = getPlayer(server, args, 0, true, false);
|
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("currentWorld", coords.getWorld().getName()));
|
||||||
sender.sendMessage(tl("posX", coords.getBlockX()));
|
if (!sender.isPlayer()|| getTFMHandler().isAdmin(sender.getPlayer()) || user.getSource() == sender) {
|
||||||
sender.sendMessage(tl("posY", coords.getBlockY()));
|
sender.sendMessage(tl("posX", coords.getBlockX()));
|
||||||
sender.sendMessage(tl("posZ", coords.getBlockZ()));
|
sender.sendMessage(tl("posY", coords.getBlockY()));
|
||||||
sender.sendMessage(tl("posYaw", (coords.getYaw() + 360) % 360));
|
sender.sendMessage(tl("posZ", coords.getBlockZ()));
|
||||||
sender.sendMessage(tl("posPitch", coords.getPitch()));
|
sender.sendMessage(tl("posYaw", (coords.getYaw() + 360) % 360));
|
||||||
if (distance != null && coords.getWorld().equals(distance.getWorld())) {
|
sender.sendMessage(tl("posPitch", coords.getPitch()));
|
||||||
sender.sendMessage(tl("distance", coords.distance(distance)));
|
if (distance != null && coords.getWorld().equals(distance.getWorld())) {
|
||||||
|
sender.sendMessage(tl("distance", coords.distance(distance)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.CommandSource;
|
import com.earth2me.essentials.CommandSource;
|
||||||
|
import com.earth2me.essentials.TFMHandler;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.craftbukkit.SetExpFix;
|
import com.earth2me.essentials.craftbukkit.SetExpFix;
|
||||||
import com.earth2me.essentials.utils.DateUtil;
|
import com.earth2me.essentials.utils.DateUtil;
|
||||||
|
@ -8,6 +9,7 @@ import com.earth2me.essentials.utils.EnumUtil;
|
||||||
import com.earth2me.essentials.utils.NumberUtil;
|
import com.earth2me.essentials.utils.NumberUtil;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.Statistic;
|
import org.bukkit.Statistic;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -40,7 +42,9 @@ public class Commandwhois extends EssentialsCommand {
|
||||||
sender.sendMessage(tl("whoisHealth", user.getBase().getHealth()));
|
sender.sendMessage(tl("whoisHealth", user.getBase().getHealth()));
|
||||||
sender.sendMessage(tl("whoisHunger", user.getBase().getFoodLevel(), user.getBase().getSaturation()));
|
sender.sendMessage(tl("whoisHunger", user.getBase().getFoodLevel(), user.getBase().getSaturation()));
|
||||||
sender.sendMessage(tl("whoisExp", SetExpFix.getTotalExperience(user.getBase()), user.getBase().getLevel()));
|
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);
|
long playtimeMs = System.currentTimeMillis() - (user.getBase().getStatistic(PLAY_ONE_TICK) * 50);
|
||||||
sender.sendMessage(tl("whoisPlaytime", DateUtil.formatDateDiff(playtimeMs)));
|
sender.sendMessage(tl("whoisPlaytime", DateUtil.formatDateDiff(playtimeMs)));
|
||||||
if (!ess.getSettings().isEcoDisabled()) {
|
if (!ess.getSettings().isEcoDisabled()) {
|
||||||
|
|
Loading…
Reference in a new issue