Fix for teleporting to another world before spying.

This commit is contained in:
Brianna O'Keefe 2019-03-09 12:40:22 -05:00
parent 1709251803
commit 445ae829c8
1 changed files with 11 additions and 8 deletions

View File

@ -18,17 +18,27 @@ public class CommandSpy extends AbstractCommand {
super(true, true, "Spy");
}
public static void spy(OfflinePlayer player, Player senderP) {
public static void spy(OfflinePlayer oPlayer, Player senderP) {
UltimateModeration instance = UltimateModeration.getInstance();
Player player = oPlayer.getPlayer();
if (player == null) {
senderP.sendMessage(instance.getReferences().getPrefix() + "That player does not exist or is not online.");
return;
}
if (player == senderP) {
senderP.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("command.spy.cant"));
return;
}
boolean didVanish = false;
if (!CommandVanish.isVanished(senderP)) {
didVanish = true;
CommandVanish.vanish(senderP);
}
senderP.teleport(player.getPlayer().getLocation());
spying.put(senderP.getUniqueId(), new Spy(senderP.getLocation(), didVanish));
player.getPlayer().addPassenger(senderP);
@ -55,13 +65,6 @@ public class CommandSpy extends AbstractCommand {
return ReturnType.SUCCESS;
}
Player player = Bukkit.getPlayer(args[0]);
if (player == null) {
sender.sendMessage(instance.getReferences().getPrefix() + "That player does not exist or is not online.");
return ReturnType.FAILURE;
}
spy(player, senderP);
return ReturnType.SUCCESS;