Add offline tp command

This commit is contained in:
Business Goose 2022-03-28 22:36:08 +01:00
parent bcb179a2a1
commit 8dcf315305
No known key found for this signature in database
GPG key ID: 77DCA801362E9645

View file

@ -1,6 +1,9 @@
package me.StevenLawson.TotalFreedomMod.commands;
import com.earth2me.essentials.User;
import me.StevenLawson.TotalFreedomMod.bridge.EssentialsBridge;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -34,7 +37,12 @@ public class Command_offlinetp extends FreedomCommand {
}
playerMsg(sender, String.format("Teleporting to %s's last known location...", target.getName()));
sender_p.teleport(target.getPlayer().getLocation());
try {
Location location = EssentialsBridge.getEssentialsUser(target.getName()).getLastLocation();
sender_p.teleport(location);
} catch (Exception e) {
playerMsg(sender, "Oops");
}
return true;
}