Remove offline tp command

This commit is contained in:
Business Goose 2022-03-29 00:34:06 +01:00
parent 193b22adb0
commit 01e12a617b
No known key found for this signature in database
GPG key ID: 77DCA801362E9645
3 changed files with 0 additions and 54 deletions

View file

@ -1,49 +0,0 @@
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;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
public class Command_offlinetp extends FreedomCommand {
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
OfflinePlayer target = null;
String searchString = args[0];
for (OfflinePlayer offlinePlayer : Bukkit.getOfflinePlayers()) {
if(offlinePlayer.getName().equalsIgnoreCase(searchString)) {
target = offlinePlayer;
break;
} else if (offlinePlayer.getName().startsWith(searchString.toLowerCase())) {
target = offlinePlayer;
break;
}
}
if(target == null) {
playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
if(target.isOnline()) {
playerMsg(sender, "That player is already online. Use /tp.");
return true;
}
playerMsg(sender, String.format("Teleporting to %s's last known location...", target.getName()));
try {
Location location = EssentialsBridge.getEssentialsUser(target.getName()).getLastLocation();
sender_p.teleport(location);
} catch (Exception e) {
playerMsg(sender, "Oops");
}
return true;
}
}

View file

@ -107,7 +107,6 @@ public class Commands {
plugin.getCommand("wipeflatlands").setExecutor(new Command_wipeflatlands()); plugin.getCommand("wipeflatlands").setExecutor(new Command_wipeflatlands());
plugin.getCommand("wipeuserdata").setExecutor(new Command_wipeuserdata()); plugin.getCommand("wipeuserdata").setExecutor(new Command_wipeuserdata());
plugin.getCommand("whoami").setExecutor(new Command_whoami()); plugin.getCommand("whoami").setExecutor(new Command_whoami());
plugin.getCommand("offlinetp").setExecutor(new Command_offlinetp());
plugin.getCommand("resetplayer").setExecutor(new Command_resetplayer()); plugin.getCommand("resetplayer").setExecutor(new Command_resetplayer());
} }
} }

View file

@ -334,10 +334,6 @@ commands:
whoami: whoami:
description: 'Who am I? Who are you? What am I doing here?' description: 'Who am I? Who are you? What am I doing here?'
usage: '/<command>' usage: '/<command>'
offlinetp:
aliases: ["otp"]
description: 'Teleport to an offline player''s last known location.'
usage: '/<command> <partialName>'
resetplayer: resetplayer:
aliases: ["resetplayerdata"] aliases: ["resetplayerdata"]
description: 'Reset a player''s data.' description: 'Reset a player''s data.'