2022-01-03 21:33:03 +00:00
|
|
|
package com.alttd.database;
|
|
|
|
|
|
2022-01-11 22:02:04 +00:00
|
|
|
import com.alttd.storage.PlayerSettings;
|
|
|
|
|
|
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
2022-01-03 21:33:03 +00:00
|
|
|
public class Queries {
|
2022-01-11 22:02:04 +00:00
|
|
|
public static PlayerSettings getPlayerSettings(UUID uuid) {
|
|
|
|
|
String sql = "SELECT * FROM user_settings WHERE uuid = ?";
|
|
|
|
|
try {
|
2022-01-12 21:26:22 +00:00
|
|
|
PreparedStatement preparedStatement = Database.getConnection().prepareStatement(sql);
|
2022-01-11 22:02:04 +00:00
|
|
|
preparedStatement.setString(1, uuid.toString());
|
|
|
|
|
|
|
|
|
|
ResultSet resultSet = preparedStatement.executeQuery();
|
|
|
|
|
if (resultSet.next()) {
|
|
|
|
|
boolean particlesActive = resultSet.getInt("particles_active") == 1;
|
|
|
|
|
boolean seeingParticles = resultSet.getInt("seeing_particles") == 1;
|
|
|
|
|
return new PlayerSettings(particlesActive, seeingParticles, uuid);
|
|
|
|
|
}
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2022-01-03 21:33:03 +00:00
|
|
|
}
|