Fixed bug were coords were not save and changed how how the check if coords already exist works

This commit is contained in:
Doc
2024-03-01 14:15:18 +01:00
parent 2016add473
commit a0acee4950
3 changed files with 5 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ plugins {
}
group = "dev.protron"
version = "0.0.5-dev"
version = "0.0.5"
repositories {
mavenCentral()

View File

@@ -27,7 +27,7 @@ public class Commands {
checkPstmt.setString(2, coordname);
ResultSet checkResult = checkPstmt.executeQuery();
if (Objects.equals(checkResult.getString("coordname"), coordname)) {
if (checkResult.getString("coordname") != null) {
TextComponent alreadyExistMessage = text()
.content("A entry with the name ")
.append(text(coordname)).color(TextColor.color(RED))
@@ -46,10 +46,10 @@ public class Commands {
// Executing the query
pstmt.executeUpdate();
String validateQuery = "SELECT * FROM coords WHERE uuid = ? and coordname = ?";
String validateQuery = "SELECT * FROM coords WHERE uuid = ? AND coordname = ?";
PreparedStatement validatePstmt = connection.prepareStatement(validateQuery);
checkPstmt.setString(1, playerUUID);
checkPstmt.setString(2, coordname);
validatePstmt.setString(1, playerUUID);
validatePstmt.setString(2, coordname);
ResultSet validateResult = validatePstmt.executeQuery();
if (Objects.equals(validateResult.getString("coordname"), coordname)) {

View File

@@ -63,7 +63,6 @@ public class CoordSave extends JavaPlugin {
final TextComponent errorMessage = text()
.content("No name provided").color(color(RED))
.build();
player.sendMessage(errorMessage);
yield false;
}