Fixed bug were coords were not save and changed how how the check if coords already exist works
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "dev.protron"
|
||||
version = "0.0.5-dev"
|
||||
version = "0.0.5"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user