Fixed not returning UUID as a string from uuidFromName and fixed no template for player
This commit is contained in:
parent
7a7d797401
commit
2841b3f924
|
|
@ -46,11 +46,13 @@ public class CheckLinked implements SubCommand {
|
||||||
Optional<Player> optionalPlayer = DiscordLink.getPlugin().getProxy().getPlayer(args[1]);
|
Optional<Player> optionalPlayer = DiscordLink.getPlugin().getProxy().getPlayer(args[1]);
|
||||||
if (optionalPlayer.isEmpty())
|
if (optionalPlayer.isEmpty())
|
||||||
{
|
{
|
||||||
optionalPlayer = DiscordLink.getPlugin().getProxy()
|
String uuidFromName = DiscordLink.getPlugin().getDatabase().uuidFromName(args[1]);
|
||||||
.getPlayer(UUID.fromString(DiscordLink.getPlugin().getDatabase().uuidFromName(args[1])));
|
if (uuidFromName != null)
|
||||||
|
optionalPlayer = DiscordLink.getPlugin().getProxy()
|
||||||
|
.getPlayer(UUID.fromString(uuidFromName));
|
||||||
if (optionalPlayer.isEmpty())
|
if (optionalPlayer.isEmpty())
|
||||||
{
|
{
|
||||||
source.sendMessage(miniMessage.parse(Config.INVALID_PLAYER));
|
source.sendMessage(miniMessage.parse(Config.INVALID_PLAYER, Template.of("player", args[1])));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -255,11 +255,11 @@ public class Database {
|
||||||
public String uuidFromName(String playerName) {
|
public String uuidFromName(String playerName) {
|
||||||
try {
|
try {
|
||||||
PreparedStatement statement = DatabaseConnection.getConnection()
|
PreparedStatement statement = DatabaseConnection.getConnection()
|
||||||
.prepareStatement("SELECT * FROM linked_accounts WHERE player_name = '" + playerName + "'");
|
.prepareStatement("SELECT player_uuid FROM linked_accounts WHERE player_name = '" + playerName + "'");
|
||||||
ResultSet resultSet = statement.executeQuery();
|
ResultSet resultSet = statement.executeQuery();
|
||||||
|
|
||||||
if (resultSet.next()) {
|
if (resultSet.next()) {
|
||||||
return resultSet.getString("player_name");
|
return resultSet.getString("player_uuid");
|
||||||
}
|
}
|
||||||
} catch (SQLException exception) {
|
} catch (SQLException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user