Add player name auto-completion, Close #105

This commit is contained in:
William committed 2021-11-23 00:26:23 +00:00
1 parent 830a7443b9
commit 8a1cc15d1d
7 files changed
+58 -4

No files matched your search

@@ -3,6 +3,7 @@ package me.william278.huskhomes2.commands;
import me.william278.huskhomes2.HuskHomes;
import me.william278.huskhomes2.MessageManager;
import me.william278.huskhomes2.teleport.TeleportManager;
import me.william278.huskhomes2.util.NameAutoCompleter;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
@@ -21,7 +22,7 @@ public class TpHereCommand extends CommandBase {
String targetPlayer = args[0];
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
try (Connection connection = HuskHomes.getConnection()) {
TeleportManager.teleportHere(p, targetPlayer, connection);
TeleportManager.teleportHere(p, NameAutoCompleter.getAutoCompletedName(targetPlayer), connection);
} catch (SQLException e) {
plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred using /tphere");
}